HexicGaming

Crash Loot

19 posts in this topic

This is a simple script that will allow you to recover the gear that is in a destroyed vehicle. This is my first post like this on here, and i'm hoping this brings joy to server owners.

credit to @MGTDB for the hints on getting this to work

ExileClient_object_container_pack

Spoiler

/**
 * ExileClient_object_container_pack
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_object", "_pincode", "_objectDisplayname", "_control"];

_object = _this select 0;
_pincode = "";
_objectDisplayname = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName");

if (getDammage _object >=1) then
{
    _control = [format ["Do you really want to loot this %1?", _objectDisplayname], "Confirm", "Sure", "Nah"] call BIS_fnc_guiMessage;        
}
else
{
    _control = [format ["Do you really want to pack this %1?", _objectDisplayname], "Confirm", "Sure", "Nah"] call BIS_fnc_guiMessage;
};

waitUntil { !isNil "_control"; };
if !(_control) exitWith {};
if (getNumber(configFile >> "CfgVehicles" >> typeOf _object >> "exileIsLockable") isEqualTo 1) then
{
    _pincode = 4 call ExileClient_gui_keypadDialog_show;
    if (_pincode isEqualTo "") exitWith{};
};
["packRequest", [netId _object, _pincode]] call ExileClient_system_network_send;
true

ExileServer_object_container_packContainer

Spoiler

/**
 * ExileServer_object_container_packContainer
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_object", "_objectpos", "_objectpos2", "_items", "_magazines", "_weapons", "_containers", "_popTabs", "_typeof", "_groundHolder", "_popTabsObject", "_filter", "_kitMagazine"];
_object = _this;
_objectpos = getPosATL _object;
_objectpos2 = _objectpos vectorAdd [0,0,0.1];
_items = _object call ExileServer_util_getItemCargo;
_magazines = magazinesAmmoCargo _object;
_weapons = weaponsItemsCargo _object;
_containers =_object call ExileServer_util_getObjectContainerCargo;
_popTabs = _object getVariable ["ExileMoney",0];
_typeof = typeOf _object;
deleteVehicle _object;
_object call ExileServer_object_container_database_delete;
_groundHolder = createVehicle ["GroundWeaponHolder",_objectpos2, [], 0, "CAN_COLLIDE"];
_groundHolder setPosATL _objectpos2;
if (_popTabs > 0 ) then
{
    _popTabsObject = createVehicle ["Exile_PopTabs", _objectpos2, [], 0, "CAN_COLLIDE"];    
    _popTabsObject setVariable ["ExileMoney", _popTabs, true];
};
_filter  = ("getText(_x >> 'staticObject') == _typeof" configClasses(configFile >> "CfgConstruction")) select 0;
_kitMagazine = getText(_filter >> "kitMagazine");
_groundHolder addItemCargoGlobal [_kitMagazine,1];
[_groundHolder,_items] call ExileServer_util_fill_fillItems;
[_groundHolder,_magazines] call ExileServer_util_fill_fillMagazines;
[_groundHolder,_weapons] call ExileServer_util_fill_fillWeapons;
[_groundHolder,_containers] call ExileServer_util_fill_fillContainers;
true

CfgExileCustomCode

Spoiler

ExileClient_object_container_pack = "Custom\ExileClient_object_container_pack.sqf";

ExileServer_object_container_packContainer = "Custom\ExileServer_object_container_packContainer.sqf";

mission config.cpp

Spoiler

            class Loot: ExileAbstractAction
            {
                title = "Loot Vehicle";
                condition = "(!(alive (ExileClientInteractionObject)))";
                action = "_this spawn ExileClient_object_container_pack";
            };

add this at the end of class Car, class Air, and class Boat (optional)

Edited by HexicGaming
  • Like 3
  • Thanks 4

Share this post


Link to post
Share on other sites
Advertisement
On 1/29/2019 at 9:21 PM, HexicGaming said:

 

  Hide contents

            class Loot: ExileAbstractAction
            {
                title = "Loot Vehicle";
                condition = "(!(alive (ExileClientInteractionObject)))";
                action = "_this spawn ExileClient_object_container_pack";
            };

add this at the end of class Car, class Air, and class Boat (optional)

there appears to be some weird ascii encoding in the white space around the class name in the last  section if you cut and paste it for anyone trying it. (around the 'class Loot: ExileAbstractAction' bit)

TjAGixh.png

Edited by second_coming

Share this post


Link to post
Share on other sites

The script works great, the only inconvenience is that the loot appears just below the ground and is not visible visually.

Share this post


Link to post
Share on other sites

In the file ExileServer_object_container_packContainer.sqf line №15  _objectpos2 = _objectpos vectorAdd [0,0.2,0]  at the end of the missing character ;  Also changed z position to [0,0.2,0.1];

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.