OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: angusjm on 09 Oct 2002, 22:03:52
-
How do you check if a unit is pointing a certain direction?
I want a condition for a trigger that will only activate if a unit is facing between certain angles.
-
the command you want is
getDir object
returns a number between 0 and 360
eg put in the condition field
175 <= getDir medic1 <= 185
As ever, I direct you to the un+official command refs in the Editors Depot for more info. :)
-
What if you don't know the name of the unit, you want to get the direction of any unit that enters the trigger area?
-
The azimut can be -53 as well as 307, it doesn't matter :)
...a bit like... nah, nevermind about that :-[ ;D
*cough* uuum, :D ya dunno the name of the guy?! May we guess? howsabout... "BOB" ??? ;D
j/k, check this out, m8 :o :wow: :o
Trigger (cond. field of horror-codes) :
"Getdir _X >= 230" Count ThisList >0 ;)
This trigger would fire (I believe) if some moron (anyone) was inside the
radius and had an azimut of 230 or above!
An exact direction check would be == instead of >= :-* But it's unrealistic to hope for that;
imagine a guy looking EXACTLY at 230 degrees ;D man, you'd have to wait for that trigg to fire!!!
Thus, I'd suggest something like this:
"Getdir _X >= 230" Count ThisList >0 && "Getdir _X <= 290" Count ThisList >0
This way, the trigger will ONLY fire if a d00d walks into it and turns his
fat head in some direction between 230 and 290 :o
(off course, ya can just change those #s to yer delight)
--------------------
Just a sidenote here : ya wouldn't be working on a "detection" trigger, oy ???
coz if so, use "knowsabout" - thats more realistic :) ...oh well, yer call.
-
That works Great! :)
The only problem is - what if I want it to go if the guy is pointing between 350 and 10 degrees? That means that it goes through 0 degrees, so how would I do it? ???
-
> what if I want it to go if the guy is pointing between 350 and 10 degrees?
"Getdir _X >= 350" Count ThisList > 0 OR "Getdir _X <= 10" Count ThisList > 0
Pope Zog