Home   Help Search Login Register  

Author Topic: Random Routes  (Read 1262 times)

0 Members and 1 Guest are viewing this topic.

Offline snozzdog

  • Members
  • *
Random Routes
« on: 18 Jul 2008, 18:23:09 »
Does anyone know anyway i can get a convoy, well a unit really to randomly go either one of two ways.

Like a left route or a right route and everytime the game plays it'll randomly select a route so its not always predicatable

Cheers

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Random Routes
« Reply #1 on: 18 Jul 2008, 18:38:47 »
Are your rutes already existing in the editor as waypoints? Or do you mean to build the routes dynamically using a script?

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Random Routes
« Reply #2 on: 18 Jul 2008, 19:54:28 »
There are many ways you could do this.  I would do it using a switch trigger and a random number.

In your init.sqf file or in the init field of any unit, type:
Code: [Select]
route = ceil (random 2)
Then create waypoints for the first route, making sure that the last waypoint for that route is of the type "HOLD."  Next create waypoints for the second route, ignoring the fact that it looks like these waypoints are ordered after the unit has already taken the first route; if the unit takes the first route, it will stop at the HOLD waypoint, never reaching the waypoints for the second route.

Now create a trigger of type "Switch", the condition of which is the following:
Code: [Select]
route == 2
Now simply synchronize this trigger (F5 mode) with the HOLD waypoint and you're done.  50% of the time, the unit will take route one, the other 50% of the time it will take route two. 
« Last Edit: 18 Jul 2008, 19:58:11 by DucusSumus »

Offline snozzdog

  • Members
  • *
Re: Random Routes
« Reply #3 on: 20 Jul 2008, 21:30:47 »
Pure genious, thanks