- Joined
- Feb 19, 2006
- Messages
- 237
I have what appears to be a basic trigger which checks if a unit is in the field of view of any other unit. If they are NOT in anyone's field of view the variable "visible" is set to 0 and the text "undetected" is displayed. The trigger does not seem to work. It displays detected /undetected randomly. Here is the code.
-
Untitled Trigger 001
-
Events
- Time - Every 1.00 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in (Units within 400.00 of (Position of Baskiran Bandit 0017 <gen>)) and do (Actions)
-
Loop - Actions
- Set Point[1] = (Position of Baskiran Bandit 0017 <gen>)
- Set Point[2] = (Position of (Picked unit))
- Set Real[1] = (Angle from Point[1] to Point[2])
- Set Real[2] = (Facing of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
- Real[1] Greater than or equal to (Real[2] - 90.00)
- Real[1] Less than or equal to (Real[2] + 90.00)
-
Conditions
-
And - All (Conditions) are true
-
Then - Actions
- -------- behind (invisible) --------
- Set visible = 0
-
Else - Actions
- -------- in front (visible) --------
- Set visible = 1
-
If - Conditions
- Custom script: call RemoveLocation (udg_Point[2])
- Custom script: call RemoveLocation (udg_Point[1])
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- visible Equal to 0
-
Then - Actions
- Game - Display to (All players) the text: undetected
-
Else - Actions
- Game - Display to (All players) the text: DETECTED
-
If - Conditions
-
Unit Group - Pick every unit in (Units within 400.00 of (Position of Baskiran Bandit 0017 <gen>)) and do (Actions)
-
Events