• 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.

[Trigger] Problem with skill

Status
Not open for further replies.
Level 7
Joined
Nov 19, 2007
Messages
253
Hey all,

I was making an ability similar to Backtrack (faceless void from dota) and i wanted that when spell is cast on target it will have higher chance to trigger and i wanted it to remove all negative buffs from target. But this seems work strange sometimes it triggers randomly sometime it triggers as attack deflect then spell is cast and other way. I cant find what cause this problem.
  • Reverse 1
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Reverse Time
    • Actions
      • Set ReverseLearn = (Learning Hero)
      • Trigger - Add to Reverse 4 <gen> the event (Unit - ReverseLearn Takes damage)
      • Trigger - Turn off (This trigger)
  • Reverse 2
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Target unit of ability being cast) Equal to ReverseLearn
    • Actions
      • Set ReverseTarget = (Target unit of ability being cast)
      • Set ReverseChance[2] = ((Level of Reverse Time for ReverseTarget) x 10)
  • Reverse 3
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacked unit) Equal to ReverseLearn
    • Actions
      • Set ReverseAttacked = (Attacked unit)
      • Set ReverseChance[1] = ((Level of Reverse Time for ReverseAttacked) x 5)
  • Reverse 4
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ReverseAttacked Equal to ReverseLearn
          • (Random integer number between 1 and 100) Less than or equal to ReverseChance[1]
        • Then - Actions
          • Unit - Set life of ReverseAttacked to ((Life of ReverseAttacked) + (Damage taken))
          • Special Effect - Create a special effect attached to the origin of ReverseAttacked using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set ReverseAttacked = No unit
          • Game - Display to (All players) the text: Works attack!
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ReverseTarget Equal to ReverseLearn
          • (Random integer number between 1 and 100) Less than or equal to ReverseChance[2]
        • Then - Actions
          • Unit - Set life of ReverseTarget to ((Life of ReverseTarget) + (Damage taken))
          • Special Effect - Create a special effect attached to the origin of ReverseTarget using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Remove Negative buffs from ReverseTarget
          • Set ReverseTarget = No unit
          • Game - Display to (All players) the text: Works spell!
        • Else - Actions
Game - Display to (All players) the text: Works spell!
Game - Display to (All players) the text: Works attack!
Is just to check which part of trigger works
 
  • Reverse 3
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Attacked unit) Equal to ReverseLearn
The condition should be "Equal to ReverseTarget", because you want the ability to fire when the unit casts it, not when the unit learns it.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • ReverseAttacked Equal to ReverseLearn
Should be:
(Triggering unit) Equal to ReverseTarget, because you want to check if the unit that takes the damage is equal to your casting unit.

Use "Starts the effect of an ability" as an event.
Use "Triggering unit" instead of "Learning Hero", it procs faster.

NOTE:
Setting "ReverseTarget/ReverseAttacked = No unit" will delete the data of that variable, so, the trigger cannot refer to that unit anymore. Remove that line. Global variables don't need to be nulled anyway, unless you use an indexing system.

  • Trigger
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Target unit of ability being cast) Equal to ReverseLearn
  • Actions
    • Set ReverseTarget = (Target unit of ability being cast)
    • Set ReverseChance[2] = ((Level of Reverse Time for ReverseTarget) x 10)
Should be:
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Target unit of ability being cast) Equal to ReverseLearn
      • Then - Actions
        • Set ReverseTarget = (Target unit of ability being cast)
        • Set ReverseChance[2] = ((Level of Reverse Time for ReverseTarget) x 10)
      • Else - Actions
So that you do not prevent effects from taking place, if the target unit is not the caster themselves.

In case my suggestions are not lucrative, let me know of the effect you want to achieve. For example, what's the difference if the unit gets attacked and the difference of taking damage? Do you want to distinguish physical damage and magical?
 
Level 7
Joined
Nov 19, 2007
Messages
253
Reverse 2 and Reverse 3 triggers are the same just one triggers when attacked other triggers when unit takes damage from spell.

And this spell should work like this:
when units gets attacked or takes damage from spell it has chance to evade it, at 4 lvl 20% chance to evade attack and 40% chance to evade any spell damage and spell effect. This ability is passive.
 
Level 7
Joined
Nov 19, 2007
Messages
253
Will Elune's Grace block spell effect also ? and how to set Elune's Grace i dont understand anything there..
 
Status
Not open for further replies.
Top