OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: punisher on 14 Feb 2007, 20:53:07

Title: All ai on map attack 1 unit?
Post by: punisher on 14 Feb 2007, 20:53:07
hi
im making a mission but theres too many people to add waypoints all on one man. Is there a way too make all units on east and res attack a single soldier?
thanks
Title: Re: All ai on map attack 1 unit?
Post by: THobson on 14 Feb 2007, 21:40:57
Given them all a doMove to the location of the victim.
{_x doMove getPos victim} forEach array

where array is a list of all the attacking units.

You might need to repeat it at intervals of 30 seconds or so.
Title: Re: All ai on map attack 1 unit?
Post by: punisher on 21 Feb 2007, 16:52:24
hmm so where do i pit this in a trigger?
Title: Re: All ai on map attack 1 unit?
Post by: h- on 22 Feb 2007, 08:29:38
If you need to repeat it in certain intervals (like THobson suggests) a simple script should be used..
Title: Re: All ai on map attack 1 unit?
Post by: bedges on 22 Feb 2007, 09:41:06
mkay. what you need is a trigger covering the whole map, activated by whichever side you want to do the chasing. in the 'on activation' box of this trigger you should put

Code: [Select]
all_enemies = thislist
now, when you want them all to start attacking the unfortunate unit, you need to run a script to get them all moving. as thobson said, repeating the script every 30 seconds or so is vital. if you run it only once, they will move to where the unit first was. the unit could have moved on by then, so you need an update of his position.

the script would look something like this

Code: [Select]
;all enemies chase unit

#loop
? not (alive unit_name):exit
{_x domove getpos unit_name} foreach all_enemies
~30
?alive unit_name:goto "loop"

and just for good measure, i've put all this into a demomission so you can see it in action. good luck  :good:
Title: Re: All ai on map attack 1 unit?
Post by: punisher on 22 Feb 2007, 13:37:32
thanks for going out of your way and making a demonstration! That works great , i put the time to 10 seconds because its a road chase and i dont want them falling far behind
again thanks for yourtime :)