Events: Unit Enters Region: Any Unit Enters Region X
Actions: If Then Else: If unit type = x Then set Counter +1
And another
Events: Unit Leaves Region: Any Unit Leaves Region X
Actions: If Then Else: If unit type = x Then set Counter -1
The problem is when a unit is created there, it adds the +1 like it's supposed to but when the unit is Removed via trigger the -1 does not happen.
Is there any simple way to get this working? I thought the way I had it set up was easy enough but maybe Remove unit doesn't trigger as Leaving the region?
Make your own version of remove unit function, best with region argument, which will check if unit you want to remove is in region you specified. If it is, substract from counter and call "normal" remove. If it doesn't just call normal remove.
Its common practice in programming.
If your use the action "remove unt" rather then "kill unit" It may not trigger the "leaves region event"
I would first try killing the unit with a trigger. If that does not work, the unit more then likely is set not to trigger the "leaves" event .... this would be on the Unit properties..... but i do believe the unit "enters" and leaves" events are controlled by the same setting on the unit.
So try to use "kill" and get back to us.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
Solved my issue. I found the event Unit is being removed and added a condition requiring it to be in the region. Thanks anyhow guys.
Thanks for the ideas.
I didn't quite understand the "make my own version of remove" idea. I did try the kill instead of remove. Unfortunately it did not work.
My remove/kill unit trigger is a simple Kill/Remove and then adding via function Merc B to the closest point in region B at most 1.
Add to Counter (Works)
Events
Unit - Any Unit Enters Region A
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == Merc B
Then
Variable - Set B Counter = (B Counter + 1)
Else
Subtract from Counter (Does not Work)
Events
Unit - Any Unit Leaves Region A
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == Merc B
Then
Variable - Set B Counter = (B Counter - 1)
Else
So I have a counter set up basically like this:
Events: Unit Enters Region: Any Unit Enters Region X
Actions: If Then Else: If unit type = x Then set Counter +1
And another
Events: Unit Leaves Region: Any Unit Leaves Region X
Actions: If Then Else: If unit type = x Then set Counter -1
The problem is when a unit is created there, it adds the +1 like it's supposed to but when the unit is Removed via trigger the -1 does not happen.
Is there any simple way to get this working? I thought the way I had it set up was easy enough but maybe Remove unit doesn't trigger as Leaving the region?
Any ideas? Appreciate the help.
@Quelex: Go
could u attach the map please?
Make your own version of remove unit function, best with region argument, which will check if unit you want to remove is in region you specified. If it is, substract from counter and call "normal" remove. If it doesn't just call normal remove. Its common practice in programming.
Regards
@Quelex: Go
If your use the action "remove unt" rather then "kill unit" It may not trigger the "leaves region event"
I would first try killing the unit with a trigger. If that does not work, the unit more then likely is set not to trigger the "leaves" event .... this would be on the Unit properties..... but i do believe the unit "enters" and leaves" events are controlled by the same setting on the unit.
So try to use "kill" and get back to us.
Thanks for the ideas. I didn't quite understand the "make my own version of remove" idea. I did try the kill instead of remove. Unfortunately it did not work. My remove/kill unit trigger is a simple Kill/Remove and then adding via function Merc B to the closest point in region B at most 1. Add to Counter (Works) Events Unit - Any Unit Enters Region A Local Variables Conditions Actions General - If (Conditions) then do (Actions) else do (Actions) If (Unit type of (Triggering unit)) == Merc B Then Variable - Set B Counter = (B Counter + 1) Else Subtract from Counter (Does not Work) Events Unit - Any Unit Leaves Region A Local Variables Conditions Actions General - If (Conditions) then do (Actions) else do (Actions) If (Unit type of (Triggering unit)) == Merc B Then Variable - Set B Counter = (B Counter - 1) Else