Home   Help Search Login Register  

Author Topic: How to get a unit to move into the nearest empty vehicle?  (Read 528 times)

0 Members and 1 Guest are viewing this topic.

McHale

  • Guest
The title is self explanatory.

I need to be able to get a general to run into the nearest empty vehicle and drive away once he has detected the player.

I can do the first bit (detection) but how can I make it so he runs into the closest available vehicle? The vehicles are spawned in random places at the mission start, and can be of several types.


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:How to get a unit to move into the nearest empty vehicle?
« Reply #1 on: 04 Aug 2003, 02:43:30 »
Hmmmm ... you could make an array of all the units in the game, check which ones are empty vehicles (I think) and then figure out which one was nearest to him.

No, don't ask me how to do this exactly ....

It might be easier to fake it - when the player gets close a random type of vehicle is spawned at a random location not far from the general, and when he spots the player that's the one he gets into.

In either case you are left with the problem of what happens if the vehicle is destroyed/immobilised between him deciding to get into it and actually doing so.   To say nothing of somebody else getting into it and driving off.

/pretty unhelpful post  ::)
Plenty of reviewed ArmA missions for you to play

peter

  • Guest
Re:How to get a unit to move into the nearest empty vehicle?
« Reply #2 on: 04 Aug 2003, 04:45:19 »
i did such a thing for a group sometime ago ... (dont have it anymore):

the unit had a waypoint it should reach, on the way it looked for useable vehicles, entered one and drove the rest of the way:

i placed a trigger on the units position, checked the trigger-list for vehicles that are empty and canmove, if there was one i assigned the unit & ordergetin  ... / if not ~3 (unit still moved) and run the script again (setpos of trigger on the units new position) ...
« Last Edit: 04 Aug 2003, 04:51:53 by peter »