Spell trigger doesn't fire under certain conditions. Why?

Cookie!

Member
Reaction score
0
I've made a spell that damages all units in a line upto a certain range. Damage is calculated by adding the Hero's strength(multiplied by a level factor) to a base damage value. The spell is very similar to the Tauren Chieftain's Shockwave, with a Strength based damage bonus.

I've based the spell off of Breath of Frost, and in general, it works like this:

1)Spell deals base damage, according to object editor values.
2)Spell also adds a buff (Trueshot, not the aura, just a custom buff that does pretty much nothing :p).
3)Trigger fires whenever the spell is cast, and works as follows.

Trigger:
  • Add Strength Damage
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Trueshot
    • Actions
      • Set temp_unit = (Casting unit)
      • Set temp_point = (Position of temp_unit)
      • Set temp_unit_group = (Units within 1200.00 of temp_point matching (((Matching unit) has buff Trueshot ) Equal to True))
      • Unit Group - Pick every unit in temp_unit_group and do (Actions)
        • Loop - Actions
          • Unit - Cause temp_unit to damage (Picked unit), dealing ((((Real((Level of Trueshot for temp_unit))) / 4.00) + 0.25) x (Real((Strength of temp_unit (Include bonuses))))) damage of attack type Hero and damage type Normal
          • Unit - Remove Trueshot buff from (Picked unit)
      • Unit Group - Destroy unit group temp_unit_group
      • Point - Remove temp_point

The spell works splendidly :D, except, there's a little catch.
If I cast the spell, and then move my Hero away fast enough, it seems that the trigger never fires :confused:. I've tried using "starts the effect of an ability" instead, but that fails miserably (I'm guessing it doesn't give the spell any time to buff the target units, and, therefore, the unit group is empty).

Any help is greatly appreciated :)
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
"Finishes casting" only fires if the spell is allowed to go until completion. Moving your hero interrupts it.

"Stops casting" fires when the spell stops for any reason. That's what you're looking for.

Anyhow, using damage detection would be a better approach; have a look around the forums for threads discussing how to do so.
 

Cookie!

Member
Reaction score
0
"Finishes casting" only fires if the spell is allowed to go until completion. Moving your hero interrupts it.

"Stops casting" fires when the spell stops for any reason. That's what you're looking for.

I gave "Stops casting" a try, but it's got a similar problem. The trigger works flawlessly if I stand still, but if I move immediately after casting, the bonus damage doesn't occur, even though the trigger fires :confused:.

Anyhow, using damage detection would be a better approach; have a look around the forums for threads discussing how to do so.

Thanks, I'll look into that :).
 

Cookie!

Member
Reaction score
0
Weep said:
Anyhow, using damage detection would be a better approach; have a look around the forums for threads discussing how to do so.
I used your damage detection system, and it works like a charm :p.
+rep :thup:.

Here's the new code snippet:
Trigger:
  • Add Strength Damage usingGDD
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamagedUnit has buff Trueshot ) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing ((((Real((Level of Trueshot for GDD_DamageSource))) / 4.00) + 0.25) x (Real((Strength of GDD_DamageSource (Include bonuses))))) damage of attack type Hero and damage type Normal
      • Unit - Remove Trueshot buff from GDD_DamagedUnit
      • Trigger - Turn on (This trigger)


Code looks a lot cleaner now :).

Once again, much thanks :D.
 

Bogrim

y hello thar
Reaction score
154
Out of experience with using Breath of Frost and GDD, I doubt that really works and you may want to test more thoroughly. Breath of Frost usually runs more than one check on a unit, causing your trigger to fire several times and dealing more damage than intended to the unit. Instead, add the unit to a unit group as the first thing in the damage trigger and check with your trigger conditions that the triggering unit isn't already in the group, then clear the group with a second trigger with a "Unit starts the effect of ability" event so that the group is always empty when the hero starts casting the spell again.
 

Cookie!

Member
Reaction score
0
Out of experience with using Breath of Frost and GDD, I doubt that really works and you may want to test more thoroughly. Breath of Frost usually runs more than one check on a unit, causing your trigger to fire several times and dealing more damage than intended to the unit. Instead, add the unit to a unit group as the first thing in the damage trigger and check with your trigger conditions that the triggering unit isn't already in the group, then clear the group with a second trigger with a "Unit starts the effect of ability" event so that the group is always empty when the hero starts casting the spell again.

I thoroughly tested the spell (using a rather unwilling Ghoul :eek:). I foresaw what you're saying, which is why I replaced the Breath of Frost buff with my own, and removed it as soon as I finished dealing bonus damage. That way, even if the Unit is Damaged event occurs, the damaged unit (poor little Ghoul :D) doesn't have the buff anymore, so the trigger doesn't fire.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top