• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Spell Trigger

Status
Not open for further replies.
Level 4
Joined
Feb 24, 2018
Messages
71
I would like my spell to instantly kill a target if he's lower than 5% health and give the caster strength and intelligence but this trigger gives stats to the hero regardless of the target's health if the spell one shots the target. Any idea ?
  • Unholy Exsecution
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Festering Strike
    • Actions
      • Unit - Set life of (Triggering unit) to ((Max life of (Triggering unit)) - (0.05 x (Max life of (Triggering unit))))
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (((100.00 x (Real((Level of Festering Strike for (Triggering unit))))) + ((2.00 x (Real((Strength of (Triggering unit) (Include bonuses))))) + (3.00 x (Real((Intelligence of (Triggering unit) (Include bonuses))))))) x (Real((Level of Festering Strike for (T damage of attack type Spells and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Percentage life of (Target unit of ability being cast)))) Less than or equal to 5
        • Then - Actions
          • Set TempLoc5 = (Position of (Target unit of ability being cast))
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 1000000000.00 damage of attack type Spells and damage type Normal
          • Hero - Modify Strength of (Triggering unit): Add (1 x (Level of Festering Strike for (Triggering unit)))
          • Hero - Modify Intelligence of (Triggering unit): Add (1 x (Level of Festering Strike for (Triggering unit)))
          • Special Effect - Create a special effect at TempLoc5 using units\undead\Banshee\Banshee.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at TempLoc5 using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation (udg_TempLoc5)
        • Else - Actions
 
The life comparison happens after you deal damage. This means if the damage killed the target, the target always has less than 5% hp after that (it has 0% hp).

You have to first check the hp. If it has more than 5%, deal normal damage, else kill it and give the killer the stats you want.
 
Like this ?
  • Unholy Exsecution
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Festering Strike
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Percentage life of (Target unit of ability being cast)))) Greater than 5
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Max life of (Triggering unit)) - (0.05 x (Max life of (Triggering unit))))
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (((100.00 x (Real((Level of Festering Strike for (Triggering unit))))) + ((2.00 x (Real((Strength of (Triggering unit) (Include bonuses))))) + (3.00 x (Real((Intelligence of (Triggering unit) (Include bonuses))))))) x (Real((Level of Festering Strike for (T damage of attack type Spells and damage type Normal
        • Else - Actions
          • Set TempLoc5 = (Position of (Target unit of ability being cast))
          • Unit - Set life of (Triggering unit) to ((Max life of (Triggering unit)) - (0.05 x (Max life of (Triggering unit))))
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 1000000000.00 damage of attack type Spells and damage type Normal
          • Hero - Modify Strength of (Triggering unit): Add (1 x (Level of Festering Strike for (Triggering unit)))
          • Hero - Modify Intelligence of (Triggering unit): Add (1 x (Level of Festering Strike for (Triggering unit)))
          • Special Effect - Create a special effect at TempLoc5 using units\undead\Banshee\Banshee.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at TempLoc5 using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation (udg_TempLoc5)
 
  • Unit - Set life of (Triggering unit) to ((Max life of (Triggering unit)) - (0.05 x (Max life of (Triggering unit))))
Shouldn't, this all the way up here ^^ be current? ?

Currently you are instantly setting the unit's life to 95% every time it casts the ability.
Also. you could put this part outside the if statement as it happens in both cases.
 
Status
Not open for further replies.
Back
Top