• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Dummy Spell causing issues with 'Charge'

Status
Not open for further replies.
Level 6
Joined
Sep 17, 2004
Messages
277
okay, here's how it goes. There's a dummy unit, and no matter where I place it, it causes this problem. Here's the idea, the hero "charges" (teleports) an enemy, stunning them for 3 seconds.

Here's the triggers.

  • Charge Action
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Charge (Triggers)
    • Actions
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\Invisibility\InvisibilityTarget.mdl
      • Set SpecialFX = (Last created special effect)
      • Trigger - Run Special Effect Destruction <gen> (ignoring conditions)
      • Sound - Play WarriorHeroricLeap <gen> at 100.00% volume, located at (Position of (Triggering unit)) with Z offset 1500.00
      • Set Stored_Unit[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
      • Wait 0.15 game-time seconds
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real(((Level of Charge (Triggers) for (Triggering unit)) x 1))) damage of attack type Hero and damage type Normal
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + (4.00 x (Real((Level of Charge (Triggers) for (Triggering unit))))))
  • Charge Teleport
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge (Triggers)
    • Actions
      • Set ChargeTempReal = (Angle from (Position of (Triggering unit)) to (Position of (Target unit of ability being cast)))
      • Set ChargeTempReal = (ChargeTempReal + 180.00)
      • Unit - Order Dummy Caster (Charge Stun) 0068 <gen> to Neutral - Firebolt (Target unit of ability being cast)
      • Set ChargeTempPoint = (Position of (Target unit of ability being cast))
      • Unit - Move (Triggering unit) instantly to (ChargeTempPoint offset by 100.00 towards ChargeTempReal degrees), facing ChargeTempPoint
      • Custom script: call RemoveLocation( udg_ChargeTempPoint )
      • Unit - Order (Casting unit) to Attack Stored_Unit[(Player number of (Owner of (Triggering unit)))]
Okay, this should work, right? Right. Everything works except the stun. When I try to create a dummy spell based off Firebolt (Neutral), and give it no mana cost, my hero warps north about 100 yards away from her target instead of charging the enemy and stunning it. If I remove the dummy spell from the dummy unit, the charge works fine, except the unit is not stunned.

I copied this from Blizzard's "Extreme Candy Wars 2005," bit by bit with a few modifications, and yet this bug continues to occur.

What am I doing wrong? Anyone?

Here are some screenshots:

Preparing to Charge
Vanished!
Back north above the Spirit Lodge

Also, the cooldown stops working.

Edit: Ah HA! I got it to work. I just edited the dummy spell to have a cast time of .15 seconds, and it works! No more teleporting north! :D And the cooldown works now.
 
Last edited:

Rmx

Rmx

Level 19
Joined
Aug 27, 2007
Messages
1,164
Well before u say it works ... You spell Leaks Locations ...

Unit - Move (Triggering unit) instantly to (ChargeTempPoint offset by 100.00 towards ChargeTempReal degrees), facing ChargeTempPoint


Also leaks a Special effect ... You did not destroy it ..

Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\Invisibility\InvisibilityTarget.mdl
Set SpecialFX = (Last created special effect

Try to fix them to make ur map more efficient :)
 
Level 6
Joined
Sep 17, 2004
Messages
277
You forgot to notice the "Destroy Special Effects" trigger I copied over.

And shouldn't

  • Custom script: call RemoveLocation( udg_ChargeTempPoint )
Clean up the ChargeTempPoint Variable? Or are you referring to the ChargeTempReal variable?
 
Level 9
Joined
Apr 25, 2009
Messages
468
TRIGGER 1 - Charge Action
Well, first of all, you must set the unit since you are using a Wait action.
So, make a new Variable of type: Unit
Set the variable to, for example: Set ChargeUnit = (Casting Unit) (if you want it to be MUI, do this:Set ChargeUnit[Player number of (owner of(Casting Unit))] = (Casting Unit)
Then, you change all your "Triggering Unit" to ChageUnit.
Once done, you must set the Variables to "No Unit", example, when the spellis done, do this:
Set Stored_Unit[(Player number of (Owner of (Triggering unit)))] = No Unit
Set ChargeUnit = No Unit

TRIGGER 2 - Charge Teleport
You have made 1 misstake here, move the Set ChargeTempPoint to the top of the trigger. Else it will bug.
Oh, one more thing. A rule when you want to Move unit Instantly, ALLWAYS PAUSE THE UNIT FIRST, THEN MOVE, THEN UNPAUSE!
Try that, let me know how it works :)
 
Level 9
Joined
Apr 25, 2009
Messages
468
It does leak... u cant have a Wait - timer without setting the units...
It will leak if you cast 2 spells at the same time.
 

Rmx

Rmx

Level 19
Joined
Aug 27, 2007
Messages
1,164
Well it does not leak... it's MPI ... and will bug if casted twice by the same player ..

Also the minimum wait in GUI is 0.27 seconds...

But for u it is not MPI coz .. u didn't use the stored Varibels ... into the damage triger..

So not MPI nor MUI ... try to make it with locals .. JASS
 
Level 9
Joined
Apr 25, 2009
Messages
468
Aegis, did you eaven read my previous post??

TRIGGER 1 - Charge Action
Well, first of all, you must set the unit since you are using a Wait action.
So, make a new Variable of type: Unit
Set the variable to, for example: Set ChargeUnit = (Casting Unit) (if you want it to be MUI, do this:Set ChargeUnit[Player number of (owner of(Casting Unit))] = (Casting Unit)
Then, you change all your "Triggering Unit" to ChageUnit.
Once done, you must set the Variables to "No Unit", example, when the spellis done, do this:
Set Stored_Unit[(Player number of (Owner of (Triggering unit)))] = No Unit
Set ChargeUnit = No Unit

TRIGGER 2 - Charge Teleport
You have made 1 misstake here, move the Set ChargeTempPoint to the top of the trigger. Else it will bug.
Oh, one more thing. A rule when you want to Move unit Instantly, ALLWAYS PAUSE THE UNIT FIRST, THEN MOVE, THEN UNPAUSE!
Try that, let me know how it works :)

If you do like that, your spell will work MUI without any bugs...
 
Level 6
Joined
Sep 17, 2004
Messages
277
I found a problem when trying to destroy the sound. I put destroy (last played sound) in the trigger, but then when she charges again, the sound does not play. How do I play the sound repeatedly without it leaking?
 
Level 9
Joined
Apr 25, 2009
Messages
468
Set a variable for the sound, and dont destroy the sound directly, destroy it at the end of your trigger (destroy the sound variable)
 
Level 8
Joined
Aug 4, 2006
Messages
357
sounds are created at map initialization. sound variables are pointers to the sounds that were created at initialization. if you destroy a sound, whether through a variable or directly, you cannot play it again. basically, do not destroy sounds in GUI since they are reused.

also, here's an improved version of your second trigger:
  • Charge Teleport
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge (Triggers)
    • Actions
      • Set ChargeCastPoint = (Position of (Triggering unit))
      • Set ChargeTargetPoint = (Position of (Target unit of ability being cast))
      • Set ChargeTempReal = (Angle from ChargeTargetPoint to ChargeCastPoint)
      • Unit - Order Dummy Caster (Charge Stun) 0068 <gen> to Neutral - Firebolt (Target unit of ability being cast)
      • Set ChargeTempPoint = (ChargeTargetPoint offset by 100.00 towards ChargeTempReal degrees)
      • Unit - Move (Triggering unit) instantly to ChargeTempPoint, facing ChargeTargetPoint
      • Custom script: call RemoveLocation( udg_ChargeCastPoint )
      • Custom script: call RemoveLocation( udg_ChargeTargetPoint )
      • Custom script: call RemoveLocation( udg_ChargeTempPoint )
      • Unit - Order (Casting unit) to Attack Stored_Unit[(Player number of (Owner of (Triggering unit)))]
now it won't leak.
 
Level 6
Joined
Sep 17, 2004
Messages
277
Ummm... You can't do
  • Unit - Move (Triggering unit) instantly to ChargeTempPoint, facing ChargeTargetPoint
Without needing coordinates or a polar offset. :/

And how do you "create" sounds at initialization?
 
Status
Not open for further replies.
Top