OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GRFoxhound 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
[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 [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!
-
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
trig_opfor = thislist; [] exec "marker.sqs"
your marker script should look something like this
#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.
-
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
{[_x] exec "mark.sqs"} forEach thislist
If this fails completely, it looks like bedges has given you a working example.
Wadmann
-
#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 ?_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 ;)
-
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].
-
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 ;)