OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: macguba on 22 Mar 2003, 18:50:49
-
If there was a command nearestEnemy I could have this:-
? player distance nearestEnemy > 200: savegame
Sadly, there is no such. So how I can I do it?
Many thanks.
-
I would also be glad if this answer was found.
-
think mac nd amsty think :P
very simple solution
make array of all enemies and den do
@ "_X distance player < 200" count arrayname > 0
savegame
tada :P
:cheers:
LCD OUT
-
OK, I've been putting this off for a whole year. I would be highly embarrassed to ask this, except that I've managed to fool everybody for a year that I would know the answer...
How do I make an array of all enemies?
PS - I knew that's what the answer would be :-[ No, really, I did.
-
lol ;D
u donno how 2 make enemies array ::) ur mision beter b good :P ;)
just make V BIG trig
triger size - covers da whole map
condition : side present (choose da enemy side)
on activision : arryname = thislist
(i think u need 2 add somin like 2 secs delay b4 startin da oder script cuz it takes time 2 da trig 2 activate)
should work ;D
if u wanna add som1 2 da array later (if u created soldiers as example) just name em and put
arrayname=arrayname+[unitname]
LCD OUT
-
Brilliant, that will do the trick beautifully, thank you.
Dunno what I'd do without you LCD, it seems every time I post a question there is either no answer or you solve it for me.
I gave up on arrays at an early stage, when I discovered this difference in syntax:-
count units group this
count units namedgroup1
Toooooo tricky for a bear of my little brain. :P
-
lol
tel me if it works ;D also gimme links 2 all ur unanswered Qs nd ill answer em ;) ;D
LCD OUT
-
I haven't tried it, but it'll work I think ... I'm not trying to do anything complicated.
But now ... heheheheheheh
link colour (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=7512)
rank (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=7540)
-
An alternative to a large trigger with a large array is a small trigger centered on the player's position ;)
Trigger
Radius: 300
Condition: East Present (repeatedly)
Name: Proxtrigger
Condition Field: this
OnActivation field: nmenear = true
OnDeactivation Field: nmenear = false
Now start that trigger somewhere the enemy will never go (ie. out to sea). When you want to check if there are any enemies near, simply:
Proxtrigger setpos (getpos player)
@ not (nmenear): savegame
Just another alternative... ;)
I used a similar method in a black ops mission I made to detect the enemy that knows the most about the player (grabbed an array of enemy units near the player and checked their knowsabout...), but anyway... the same principles apply here :)
-
Gentlemen, thank you all very much. :)