Jump to content

Recommended Posts

I am trying to make a repeating script that spawns a cargo box randomly on the map (within my trigger area).

 

The cargo box spawns with an "holdAction" attached and a map marker to show the location the cargo box has spawned at. Once the "holdAction" has been completed, the cargo box is removed, "CuratorPoints" are added to the side that secured the box and the map marker is also removed.

 

My current script can spawn the cargo box, with the map marker, at the start of the game. However, I am unsure how to repeat the trigger, or have the cargo box removed once the "holdAction" has been completed.

Spoiler

_randomPosition = [];

_loopCount = 0;

while { _randomPosition isEqualTo [] && _loopCount < 100 } do {

    _randomPosition = Zeus_T_DropZone1_1 call BIS_fnc_randomPosTrigger;

    _randomPosition = _randomPosition findEmptyPosition [ 0, 0 ];

    _loopCount = _loopCount +1; //Prevents infinite executions with severe hit on performance if no position can be found

};

 

_mrk = createMarker [ "Zeus_M_PickUp1_1", _randomPosition ];

_mrk setMarkerShape "ICON";

_mrk setMarkerSize [ 0.8, 0.8 ];

_mrk setMarkerType "hd_pickup";

_mrk setMarkerColor "ColorGUER";

 

_cargoNet = createVehicle [ "CargoNet_01_box_F", getMarkerPos _mrk, [], 0, "NONE" ];

if ( isTouchingGround _cargoNet ) then {

    _cargoNet setDamage 1;

};

 

[

    _cargoNet,

    "Secure Airdrop",

    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

    "_this distance _target < 3.5 && side _this == west && isPlayer _this",

    "_caller distance _target < 3.5 && side _this == west && isPlayer _this",

    {},

    {},

    {

        _this call {

            deleteVehicle _target; {

                if ( ( side getAssignedCuratorUnit _x ) == west ) then {

                    [ _x, ( 0.3 / ( { ( alive _x ) and ( side _x == west ) } count playableUnits ) ) ] remoteExec [ "addCuratorPoints", 0, true ];

                };

            } foreach allCurators;

            deleteMarker "Zeus_M_PickUp1_1";

        };

    },

    {},

    [],

    5,

    0,

    true,

    false

] remoteExec [ "BIS_fnc_holdActionAdd", 0, _cargoNet ];

 

[

    _cargoNet,

    "Secure Airdrop",

    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa",

    "_this distance _target < 3.5 && side _this == independent",

    "_caller distance _target < 3.5 && side _this == independent",

    {},

    {},

    {

        _this call {

            deleteVehicle _target; {

                if ( ( side getAssignedCuratorUnit _x ) == independent ) then {

                    [ _x, 0.3 ] remoteExec [ "addCuratorPoints", 0, true ];

                };

            } foreach allCurators;

            deleteMarker "Zeus_M_PickUp1_1";

        };

    },

    {},

    [],

    5,

    0,

    true,

    false

] remoteExec [ "BIS_fnc_holdActionAdd", 0, _cargoNet ];

Later on, I would like it to be like a proper airdrop, but currently, I'd just like it just to actually appear on the map.

 

Please help!

Edited by rkemsley
holdAction fixed

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×