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

Counter ability

Status
Not open for further replies.
Level 10
Joined
Jun 6, 2007
Messages
392
I'm working on a simple (or should be) ability called Counter. It gives a chance to block an attack and damage the attacker by the same amount of damage. However, the ability does nothing. If I disable the line "Unit -Cause ...", the damage is blocked properly. Why does that line mess the trigger up? Here's the trigger:

  • Counter
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Level of Counter for DamageEventTarget) Greater than 0
      • DamageEventPhysical Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Set TempInt = (5 x (Level of Counter for DamageEventTarget))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to TempInt
        • Then - Actions
          • Set Damage = DamageEventAmount
          • Set DamageEventAmount = 0.00
          • Floating Text - Create floating text that reads Counter! above DamageEventTarget with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
          • Floating Text - Show (Last created floating text) for (All players)
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
          • Unit - Cause DamageEventTarget to damage DamageEventSource, dealing Damage damage of attack type Spells and damage type Universal
        • Else - Actions
      • Trigger - Turn on (This trigger)
 
Level 18
Joined
May 11, 2012
Messages
2,103
there is no need to set ''DamageEventAmount'' to another variable since that already is the variable so remove that.

This should work properly, no reason for this to malfunction.
Maybe you can try this: create another trigger and name it Counter Damage and place the damaging line in that second trigger and in Then block after the: set ''DamageEventAmount'', put the action to run the Counter Damage.
 
Level 10
Joined
Jun 6, 2007
Messages
392
Thanks for your reply. I tried that , it didn't work though. However, I found a working solution:
  • Counter
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (Level of Counter for DamageEventTarget) Greater than 0
      • DamageEventPhysical Equal to True
    • Actions
      • Set TempInt = (5 x (Level of Counter for DamageEventTarget))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to TempInt
        • Then - Actions
          • Set Damage = DamageEventAmount
          • Set DamageEventAmount = 0.00
          • Set CounterBool = True
        • Else - Actions
  • Counter Damage
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • CounterBool Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Floating Text - Create floating text that reads Counter! above DamageEventTarget with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Show (Last created floating text) for (All players)
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
      • Unit - Cause DamageEventTarget to damage DamageEventSource, dealing Damage damage of attack type Spells and damage type Universal
      • Set CounterBool = False
      • Trigger - Turn on (This trigger)
For some reason dealing damage with damage modifier event caused it to bug.
 
Status
Not open for further replies.
Top