OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: eegore on 01 Sep 2014, 01:51:34
-
I'm trying to come up with an efficient method to randomly assign a unit to the cargo of one of 4 vehicles.
I have 2x wheeled vehicle, a helo and a boat all heading to a single location but I am not sure how to randomize the moveinCargo command.
The Unit (T1) is not the player he is the intended target to eliminate. The objective is to increase replayability by not having the exact same insertion each time.
-
Put the vehicles in an array and randomly select them based on array count:
_inserts = [wheel1,wheel2,helo,boat];
T1 moveInCargo (_inserts select (random ((count _inserts)-1))); // -1 needed because count starts from 1 and array element idx from 0. BIS should really provide a arrayCount command already..
-
Ok I placed this in the init file and it usually works.
For some reason the UH1 will land and let the T1 unit out then fly away. Not sure why it wont carry the unit to the LZ. They are both BLUFOR units.
-
Does the T1 have some waypoint?
-
He does not. I haven't exactly figured out how to get him out of the vehicles and into a building yet.
Maybe a distance activated trigger that tells him to eject, and another that tells him to go to a gameLogic.
-
Oops, there might a bug in that scrip I posted, try:
_inserts = [wheel1,wheel2,helo,boat];
_rVeh = (_inserts select (random ((count _inserts)-1)));
T1 assignAsCargo _rVeh;
T1 moveInCargo _rVeh;
Maybe the chopper spits him out because he's not assigned to it :dunno:
Maybe a distance activated trigger that tells him to eject, and another that tells him to go to a gameLogic.
You could also try to add 'get out' waypoint for him that would be setpossed the the correct place depending on what insertion method is used and other to the final position.
Dunno, might be trickier than that trigger idea.
Although with the helo he might die if he jumps out of the thing too early. :dunno: