Hi guys
So I may just have realized why all my maps have always been a bit bugged. I have always used Temp_Variables. Both for units, integers, points e.g.
As an example I have these 2 triggers:
Trigger 1:
When an enemy hits the Hero, there will be created a dummy unit to make an attack animation while the Hero deals instant damage to the target.
Trigger 2:
This trigger is for an enemy units ability. When it is attacked, it will blink to the attacking unit.
So what I discovered was, all of a sudden my Hero, when it was attacking, it created a dummy unit to attack the attacking unit, but the dummy unit was owned by Player 12. It really should be owned by the owner of Unit, which in trigger 1 is the Hero having the ability.
So what I am curious about is:
When I set my Unit variable in a trigger, is it possible it does not only work for this individual trigger, but will also apply and affect other triggers which shares an identical event?
What I mean: The Unit variable set from trigger 2, becomes the responding unit to trigger 1?
Additionally, in another topic. Trigger 2, which is originally as shown below, causing the enemy units to freeze. At some point of which I can't explain, the unit stops taking action. It still has mana and will take damage. Whatever I do to it, it will keep standing still as if stunned. It is not paused. Any ideas what is going on?
So I may just have realized why all my maps have always been a bit bugged. I have always used Temp_Variables. Both for units, integers, points e.g.
As an example I have these 2 triggers:
Trigger 1:
When an enemy hits the Hero, there will be created a dummy unit to make an attack animation while the Hero deals instant damage to the target.
-
Demon Hunter Counter Attack
-
Events
-
Unit - A unit Is attacked
-
-
Conditions
-
(Unit-type of (Triggering unit)) Equal to Demon Hunter
-
(Level of Demon Hunter R for (Triggering unit)) Greater than or equal to 1
-
(Owner of (Attacking unit)) Equal to Player 12 (Brown)
-
-
Actions
-
Set Unit = (Triggering unit)
-
Set Unit1 = (Attacking unit)
-
Set Integer = (Level of Demon Hunter R for Unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer Equal to 1
-
-
Then - Actions
-
Unit - Cause Unit to damage Unit1, dealing 50.00 damage of attack type Normal and damage type Normal
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer Equal to 2
-
-
Then - Actions
-
Unit - Cause Unit to damage Unit1, dealing 100.00 damage of attack type Normal and damage type Normal
-
-
Else - Actions
-
-
Set PointDefault = (Position of Unit1)
-
Unit - Create 1 Dummy Unit (Demon Hunter) for (Owner of Unit) at PointDefault facing PointDefault
-
Custom script: call RemoveLocation (udg_PointDefault)
-
Set Unit2 = (Last created unit)
-
Unit - Add a 0.40 second Generic expiration timer to Unit2
-
Set PointDefault = (Position of Unit1)
-
Unit - Make Unit2 face Unit1 over 0.00 seconds
-
Set Integer = (Random integer number between 1 and 3)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer Equal to 1
-
-
Then - Actions
-
Animation - Play Unit2's attack animation
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer Equal to 2
-
-
Then - Actions
-
Animation - Play Unit2's attack 2 animation
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer Equal to 3
-
-
Then - Actions
-
Animation - Play Unit2's spell throw animation
-
-
Else - Actions
-
-
-
Trigger 2:
This trigger is for an enemy units ability. When it is attacked, it will blink to the attacking unit.
-
Area 1 Wave 2 Abilities
-
Events
-
Unit - A unit Is attacked
-
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Unit-type of (Attacking unit)) Equal to Maiden of Pain
-
(Unit-type of (Attacking unit)) Equal to Overlord
-
(Unit-type of (Attacking unit)) Equal to Demon Spawn
-
(Unit-type of (Triggering unit)) Equal to Faceless Demon
-
(Unit-type of (Attacking unit)) Equal to Ghost
-
-
-
-
Actions
-
Set Unit = (Attacking unit)
-
Set Unit1 = (Triggering unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of Unit1) Equal to Faceless Demon
-
(Mana of Unit1) Greater than or equal to 10.00
-
-
Then - Actions
-
Set PointDefault = (Position of Unit)
-
Unit - Make Unit1 face Unit over 0.00 seconds
-
Unit - Order Unit1 to Night Elf Warden - Blink PointDefault
-
Custom script: call RemoveLocation (udg_PointDefault)
-
-
Else - Actions
-
-
Set Unit = No unit
-
Set Unit1 = No unit
-
-
So what I discovered was, all of a sudden my Hero, when it was attacking, it created a dummy unit to attack the attacking unit, but the dummy unit was owned by Player 12. It really should be owned by the owner of Unit, which in trigger 1 is the Hero having the ability.
So what I am curious about is:
When I set my Unit variable in a trigger, is it possible it does not only work for this individual trigger, but will also apply and affect other triggers which shares an identical event?
What I mean: The Unit variable set from trigger 2, becomes the responding unit to trigger 1?
Additionally, in another topic. Trigger 2, which is originally as shown below, causing the enemy units to freeze. At some point of which I can't explain, the unit stops taking action. It still has mana and will take damage. Whatever I do to it, it will keep standing still as if stunned. It is not paused. Any ideas what is going on?
-
Area 1 Wave 2 Abilities
-
Events
-
Unit - A unit Is attacked
-
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Unit-type of (Attacking unit)) Equal to Maiden of Pain
-
(Unit-type of (Attacking unit)) Equal to Overlord
-
(Unit-type of (Attacking unit)) Equal to Demon Spawn
-
(Unit-type of (Triggering unit)) Equal to Faceless Demon
-
(Unit-type of (Attacking unit)) Equal to Ghost
-
-
-
-
Actions
-
Set Unit = (Attacking unit)
-
Set Unit1 = (Triggering unit)
-
Set Real = (Mana of (Attacking unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of Unit) Equal to Demon Spawn
-
(Mana of Unit) Greater than or equal to 50.00
-
-
Then - Actions
-
Unit - Order Unit to Special Archimonde - Finger Of Death Unit1
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of Unit) Equal to Overlord
-
(Mana of Unit) Greater than or equal to 100.00
-
-
Then - Actions
-
Unit - Order Unit to Orc Far Seer - Feral Spirit
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of Unit) Equal to Maiden of Pain
-
(Mana of Unit) Greater than or equal to 50.00
-
-
Then - Actions
-
Unit - Order Unit to Neutral Alchemist - Acid Bomb Unit1
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of Unit) Equal to Ghost
-
-
Then - Actions
-
Set Integer = (Random integer number between 1 and 2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Integer Equal to 1
-
(Mana of Unit) Greater than or equal to 100.00
-
-
Then - Actions
-
Unit - Order Unit to Undead Death Knight - Death Coil Unit1
-
-
Else - Actions
-
Unit - Order Unit to Undead Banshee - Curse Unit1
-
-
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of Unit1) Equal to Faceless Demon
-
(Mana of Unit1) Greater than or equal to 10.00
-
-
Then - Actions
-
Set PointDefault = (Position of Unit)
-
Unit - Make Unit1 face Unit over 0.00 seconds
-
Unit - Order Unit1 to Night Elf Warden - Blink PointDefault
-
Custom script: call RemoveLocation (udg_PointDefault)
-
-
Else - Actions
-
-
Set Unit = No unit
-
Set Unit1 = No unit
-
-
Last edited: