Home   Help Search Login Register  

Author Topic: Random unit moveinCargo command  (Read 2422 times)

0 Members and 1 Guest are viewing this topic.

Offline eegore

  • Members
  • *
Random unit moveinCargo command
« 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. 

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Random unit moveinCargo command
« Reply #1 on: 01 Sep 2014, 11:01:08 »
Put the vehicles in an array and randomly select them based on array count:
Code: [Select]
_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..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline eegore

  • Members
  • *
Re: Random unit moveinCargo command
« Reply #2 on: 10 Sep 2014, 05:35:02 »

  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.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Random unit moveinCargo command
« Reply #3 on: 10 Sep 2014, 08:52:03 »
Does the T1 have some waypoint?
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline eegore

  • Members
  • *
Re: Random unit moveinCargo command
« Reply #4 on: 11 Sep 2014, 19:51:29 »

  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.


Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Random unit moveinCargo command
« Reply #5 on: 12 Sep 2014, 13:47:20 »
Oops, there might a bug in that scrip I posted, try:
Code: [Select]
_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:

Quote
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:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.