- Joined
- Oct 9, 2015
- Messages
- 721
Hello everyone, I would like to request help to acomplish a system I'm developing. It's a system that makes unit able only to see what are in front of them, like this pic:
To acomplish that, I've set the unit sight radius (both day and night) to 0, then I trigger a visibility modifier ahead of the unit so it won't show what's behind it too. Now I'm having the problem of removing the visibility modifier after the unit explores a new area, like this:
So my question is how can I destroy the first visibility modifier after the unit leaves it's reach?
I'm using the following code:

To acomplish that, I've set the unit sight radius (both day and night) to 0, then I trigger a visibility modifier ahead of the unit so it won't show what's behind it too. Now I'm having the problem of removing the visibility modifier after the unit explores a new area, like this:

So my question is how can I destroy the first visibility modifier after the unit leaves it's reach?
I'm using the following code:
-
Stealth Periodic
-
Events
-
Time - Every 0.33 seconds of game time
-
-
Conditions
-
Actions
-
Set STSYS_TempGroup = (Units in (Playable map area))
-
Unit Group - Pick every unit in STSYS_TempGroup and do (Actions)
-
Loop - Actions
-
Set STESYS_TempUnit1 = (Picked unit)
-
Set STESYS_TempPlayer = (Owner of (Picked unit))
-
-------- LOCATION IN FRONT --------
-
Set STSYS_TempReal = (Current acquisition range of STESYS_TempUnit1)
-
Set STSYS_TempReal1 = (STSYS_TempReal + 100.00)
-
Set STESYS_TempLoc1 = (Position of (Picked unit))
-
Set STESYS_TempLoc1 = (STESYS_TempLoc1 offset by STSYS_TempReal towards (Facing of (Picked unit)) degrees)
-
Visibility - Create an initially Enabled visibility modifier for STESYS_TempPlayer emitting Visibility from STESYS_TempLoc1 to a radius of STSYS_TempReal1
-
Set STESYS_TempVis = (Last created visibility modifier)
-
-------- LOCATION IN BACK --------
-
-------- HERE I TRY TO CREATE A FOG OF WAR BEHIND THE UNIT, BUT IT DOESN'T WORK --------
-
Set STSYS_TempReal = (STSYS_TempReal x 2.00)
-
Set STSYS_TempReal1 = (STSYS_TempReal + 100.00)
-
Set STESYS_TempLoc1 = (Position of (Picked unit))
-
Set STESYS_TempLoc1 = (STESYS_TempLoc1 offset by STSYS_TempReal towards ((Facing of STESYS_TempUnit1) + 180.00) degrees)
-
Visibility - Create an initially Enabled visibility modifier for STESYS_TempPlayer emitting Black mask from STESYS_TempLoc1 to a radius of STSYS_TempReal
-
Set STESYS_TempVis2 = (Last created visibility modifier)
-
Custom script: call RemoveLocation(udg_STESYS_TempLoc1)
-
-
-
-