- Joined
- Jul 18, 2008
- Messages
- 4,866
If anyone's played the Legend of Zelda games for the DS then you remember the boomerang item that lets you draw out its path before unleashing it. I tried to carry over that to Wc3 and so far it works great, except for 1 issue:
-The boomerang is supposed to stun the units it hits once, and not be able to hit them again until the caster gives it another throw. This works fine for player 1, but when player 2 gives it a whirl it hits the enemies multiple times, contrary to what I want it to do. I looked at my stun trigger multiple times, and yet I still can't find out why it's not functioning correctly. As from this, the problem may be in another trigger as all the triggers are closely connected (at least the stun is connected closely to the throw and boomerang movement triggers).
Could you take a look at it and see if you can find the error?
Here's the stun trigger:
Of course I know this leaks in a few places and that it can be optimized a bit, but that's besides the point and not helping. I need to know why it only works right for player 1.
Heres the spell map itself
-The boomerang is supposed to stun the units it hits once, and not be able to hit them again until the caster gives it another throw. This works fine for player 1, but when player 2 gives it a whirl it hits the enemies multiple times, contrary to what I want it to do. I looked at my stun trigger multiple times, and yet I still can't find out why it's not functioning correctly. As from this, the problem may be in another trigger as all the triggers are closely connected (at least the stun is connected closely to the throw and boomerang movement triggers).
Could you take a look at it and see if you can find the error?
Here's the stun trigger:
-
Boomerang Stun
-
Events
-
Time - Every 0.20 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in Tb_BoomerangGroup and do (Actions)
-
Loop - Actions
-
Set P = (Position of (Picked unit))
-
Set Tb_ReferenceUnit = (Picked unit)
-
Set Tb_StunGroup = (Units within 250.00 of P matching (((Owner of (Matching unit)) is an enemy of (Owner of Tb_ReferenceUnit)) Equal to True))
-
Game - Display to (All players) the text: (Name of (Owner of (Picked unit)))
-
Unit Group - Pick every unit in Tb_StunGroup and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is alive) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is in Tb_AlreadyStunned[(Player number of (Owner of Tb_ReferenceUnit))]) Equal to False
-
-
Then - Actions
-
Unit Group - Add (Picked unit) to Tb_AlreadyStunned[(Player number of (Owner of Tb_ReferenceUnit))]
-
Set P2 = (Position of (Picked unit))
-
Unit - Create 1 Boomerang Cast Dummy for (Owner of Tb_ReferenceUnit) at P facing Default building facing degrees
-
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-
Unit - Order (Last created unit) to Neutral - Firebolt (Picked unit)
-
Sound - Play BoomerangHit <gen> at 100.00% volume, located at P2 with Z offset 0.00
-
-------- Unnecassary Stuff --------
-
Set Tb_RandomInt = (Random integer number between 1 and 5)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 1
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Whap!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 2
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Smack!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 3
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Thwap!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 4
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Shmack!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 5
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Shwap!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
-
Floating Text - Change (Last created floating text): Disable permanence
-
Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
-
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
-
-------- ------------------------------------------ --------
-
Custom script: call RemoveLocation(udg_P2)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
Custom script: call RemoveLocation(udg_P)
-
-
-
Unit Group - Pick every unit in Tb_BoomerangGroup2 and do (Actions)
-
Loop - Actions
-
Set P = (Position of (Picked unit))
-
Set Tb_ReferenceUnit = (Picked unit)
-
Set Tb_StunGroup = (Units within 250.00 of P matching (((Owner of (Matching unit)) is an enemy of (Owner of Tb_ReferenceUnit)) Equal to True))
-
Unit Group - Pick every unit in Tb_StunGroup and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is alive) Equal to True
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is in Tb_AlreadyStunned[(Player number of (Owner of Tb_ReferenceUnit))]) Equal to False
-
-
Then - Actions
-
Unit Group - Add (Picked unit) to Tb_AlreadyStunned[(Player number of (Owner of Tb_ReferenceUnit))]
-
Set P2 = (Position of (Picked unit))
-
Unit - Create 1 Boomerang Cast Dummy for (Owner of Tb_ReferenceUnit) at P facing Default building facing degrees
-
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-
Unit - Order (Last created unit) to Neutral - Firebolt (Picked unit)
-
Sound - Play BoomerangHit <gen> at 100.00% volume, located at P2 with Z offset 0.00
-
-------- Unnecassary Stuff --------
-
Set Tb_RandomInt = (Random integer number between 1 and 5)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 1
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Whap!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 2
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Smack!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 3
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Thwap!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 4
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Shmack!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Tb_RandomInt Equal to 5
-
-
Then - Actions
-
Floating Text - Create floating text that reads *Shwap!* at P2 with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
-
-
Else - Actions
-
-
Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
-
Floating Text - Change (Last created floating text): Disable permanence
-
Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
-
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
-
-------- ------------------------------------------ --------
-
Custom script: call RemoveLocation(udg_P2)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
Custom script: call RemoveLocation(udg_P)
-
-
-
-
Heres the spell map itself