Home   Help Search Login Register  

Author Topic: mark units in trigger area.  (Read 1523 times)

0 Members and 1 Guest are viewing this topic.

Offline GRFoxhound

  • OFPEC Patron
  • ****
    • Armaholic.com
mark units in trigger area.
« on: 14 Jun 2006, 10:00:29 »
Hey all.

First post in this forum although I am reading/learning a lot here for almost 2 years. Great place for resources  :)

Anyway, I have a problem which I cant figure out how to make it work like I want. I will post here an example of what I am trying to achieve.


I have an elipse trigger of 500x500. The trigger is activated by opfor present, and activated repeatidly.
On activation it starts a script which I want to place a marker "dot" over all OPFOR units in that trigger area. This way I will be able to see all units inside the trigger area marked on the map with a "dot". The script is called
Code: [Select]
[thislist select 0] exec "mark.sqs"Now the problem is, it wont set the "dot" marker over all OPFOR units inside the trigger, but only one until he left the trigger area. Only than it will mark another OPFOR unit.
I think by giving all OPFOR units a name and changing the scriptline to
Code: [Select]
[this] exec "mark.sqs" will give me the wanted result...........but I dont want to have to name all units since there are a lot of units on the map  ;D

Can anyone maybe tell me how I can make it so that all OPFOR units inside the trigger area are getting a "dot" marker on their position?
It should also be so that a unit which has the mark.sqs running over it should not run it again (otherwise one unit will activate the same script over and over again), inside the mark.sqs script its made so that it keeps marking the units position (i use a loop with a distance check) until he leaves the trigger area.
I hope I was clear enough in trying to explain my problem.

Thanks in advance for any help!


Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: mark units in trigger area.
« Reply #1 on: 14 Jun 2006, 11:43:09 »
you'll need a dot marker for every opfor unit that might be inside the trigger area at any one time. you should name the dot markers sequentially, i.e. dot1, dot2, dot3 etc.

the onactivation box for the trigger should be

Code: [Select]
trig_opfor = thislist; [] exec "marker.sqs"
your marker script should look something like this

Code: [Select]
#start

_dotnum = 1
_unit = 0
_max = count trig_opfor

#loop

_mark = format ["dot%1",_dotnum]
_who = trig_opfor select _unit

_mark setmarkerpos getpos _who

_dotnum = _dotnum + 1
_unit = _unit + 1

?not (_unit==_max):goto "loop"

~1
goto "start"

untested, but it should work. when a unit steps outside the trigger area, he will no longer be counted within the trigger's list, so the dot marker will vanish on the next loop. the script will continue to mark opfor units within the trigger area until the mission ends.
« Last Edit: 14 Jun 2006, 20:42:13 by bedges »

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re: mark units in trigger area.
« Reply #2 on: 14 Jun 2006, 17:27:21 »
Not really knowing how your script actually works so I am not sure if this will work but it will not cost anythting to give it a try. :P

Code: [Select]
{[_x] exec "mark.sqs"} forEach thislist
If this fails completely, it looks like bedges has given you a working example.

Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

Offline GRFoxhound

  • OFPEC Patron
  • ****
    • Armaholic.com
Re: mark units in trigger area.
« Reply #3 on: 14 Jun 2006, 23:16:32 »

Code: [Select]
#start

_dotnum = 1
_unit = 0
_max = count trig_opfor

#loop

_mark = format ["dot%1",_dotnum]
_who = trig_opfor select _unit

_mark setmarkerpos getpos _who

_dotnum = _dotnum + 1
_unit = _unit + 1

?not (_unit==_max):goto "loop"

~1
goto "start"

Thank you very much, only thing I had to add to make it work right was
Code: [Select]
?_max == 0 : exit just at the beginning of the loop.
I now got a script updating the map with locations of OPFOR units but only in a specified area :)

@Wadman, nope that doesnt work, if I use that it will just follow only 1 unit and not multiple (if present in the trigger area), but thanks anyway  ;)

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: mark units in trigger area.
« Reply #4 on: 15 Jun 2006, 10:55:31 »
something else just occurred to me. the dots won't disappear from the trigger area. you might want to include a small initialisation routine at the beginning of the script which either sets them to empty or moves them to [0,0].

Offline GRFoxhound

  • OFPEC Patron
  • ****
    • Armaholic.com
Re: mark units in trigger area.
« Reply #5 on: 15 Jun 2006, 15:51:57 »
Yes I noticed that aswell afterwards. Got it fixed aswell :) but thanks for mentioning it.

I have some more ideas with this script which I will try when I get home. But I think I will need some help there, so I will be back  ;)