Home   Help Search Login Register  

Author Topic: Nearest enemy  (Read 731 times)

0 Members and 1 Guest are viewing this topic.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Nearest enemy
« 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.
« Last Edit: 22 Mar 2003, 18:58:10 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Nearest enemy
« Reply #1 on: 22 Mar 2003, 20:19:36 »
I would also be glad if this answer was found.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Nearest enemy
« Reply #2 on: 22 Mar 2003, 20:33:19 »
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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Nearest enemy
« Reply #3 on: 22 Mar 2003, 22:25:36 »
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.
Plenty of reviewed ArmA missions for you to play

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Nearest enemy
« Reply #4 on: 22 Mar 2003, 23:35:34 »
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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Nearest enemy
« Reply #5 on: 22 Mar 2003, 23:42:40 »
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  
Plenty of reviewed ArmA missions for you to play

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Nearest enemy
« Reply #6 on: 23 Mar 2003, 00:14:51 »
lol

tel me if it works ;D also gimme links 2 all ur unanswered Qs nd ill answer em ;) ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Nearest enemy
« Reply #7 on: 23 Mar 2003, 00:18:52 »
I haven't tried it, but it'll work I think ... I'm not trying to do anything complicated.

But now ... heheheheheheh

link colour

rank
Plenty of reviewed ArmA missions for you to play

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Nearest enemy
« Reply #8 on: 23 Mar 2003, 01:54:31 »
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 :)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Nearest enemy
« Reply #9 on: 23 Mar 2003, 18:53:56 »
Gentlemen, thank you all very much.     :)
Plenty of reviewed ArmA missions for you to play