• 🏆 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] Miniature damage detection system and Backstab

Status
Not open for further replies.
Level 12
Joined
Jun 28, 2008
Messages
688
I have a problem with a quick non-MUI damage detection system I made in GUI. I have a Backstab Ability that works just fine and triggers when the attacked unit takes damage from the back.

  • Backstab Setup
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Dual Agility for (Attacking unit)) Greater than or equal to 1
    • Actions
      • Set tempAttacker = (Attacking unit)
      • Set tempAttacked = (Attacked unit)
      • Trigger - Add to Backstab Damage <gen> the event (Unit - tempAttacked's life becomes Less than (Life of tempAttacked))
  • Backstab Damage
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Facing of tempAttacked) Less than or equal to ((Facing of tempAttacker) + 15.00)
              • (Facing of tempAttacked) Greater than or equal to ((Facing of tempAttacker) - 15.00)
        • Then - Actions
          • Unit - Cause tempAttacker to damage tempAttacked, dealing 25.00 damage of attack type Pierce and damage type Acid
          • Special Effect - Create a special effect attached to the chest of tempAttacked using Abilities\Weapons\HydraliskImpact\HydraliskImpact.mdl
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Create floating text that reads Backstab! above tempAttacked with Z offset 0.00, using font size 7.50, color (100.00%, 50.00%, 0.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
          • 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 0.20 seconds
        • Else - Actions
          • Do nothing
Then I have another ability that causes the unit's next attack to deal additional damage. This is where the problem is. The buff has infinite (-1) duration and is only removed when the unit's attack hits. This uses the same system as the Backstab ability, but does not work. It triggers upon the unit's second attack, rather than its first.

  • Stealth effect setup
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Stealth Technique ) Equal to True
    • Actions
      • Set tempAttacker2 = (Attacking unit)
      • Set tempAttacked2 = (Attacked unit)
      • Trigger - Add to Stealth effect <gen> the event (Unit - tempAttacked2's life becomes Less than (Life of tempAttacked2))
  • Stealth effect
    • Events
    • Conditions
    • Actions
      • Unit - Cause tempAttacker2 to damage tempAttacked2, dealing 50.00 damage of attack type Pierce and damage type Poison
      • Unit - Remove Stealth Technique buff from tempAttacker2
      • Animation - Change tempAttacker2's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Floating Text - Create floating text that reads 50! above tempAttacked2 with Z offset 0.00, using font size 7.50, color (100.00%, 25.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
      • 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 0.20 seconds
Why does it trigger on the second attack instead of the first, and how can I fix it?
 
Level 22
Joined
Jun 24, 2008
Messages
3,050
  • Trigger - Add to Stealth effect <gen> the event (Unit - tempAttacked2's life becomes Less than (Life of tempAttacked2))
This means that if the life of the attacked unit, is less than the life of the attacked unit.
And cause it gets less before, this event was added, its the second attack.

(Why dont you just:)
  • Trigger - Add to Stealth effect <gen> the event (Unit - tempAttacked2 is attacked
 
Level 9
Joined
May 27, 2006
Messages
498
I guess its because your first trigger adds the event to the second trigger, which deals the real damage... Thats why it bugs, first attack adds event, second attack triggers damage.

Solution? Merge these two triggers into one... If you bother about the delay, just add a short wait and use some variables.

(may be plotting shi-, im kinda sleepy now, cant even read what i wrote... duh)
 
Level 12
Joined
Jun 28, 2008
Messages
688
Alright, I made the event for the trigger "A unit is attacked" and used waits based on animation properties to make it look good. The Stealth ability works fine now, but I still have the same problem with the Backstab. It doesn't work the first time the Hero attacks a new unit, only on the second attack.

  • Backstab
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Dual Agility for (Attacking unit)) Greater than or equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Facing of (Attacked unit)) Less than or equal to ((Facing of (Attacking unit)) + 15.00)
              • (Facing of (Attacked unit)) Greater than or equal to ((Facing of (Attacking unit)) - 15.00)
        • Then - Actions
          • Wait 0.35 seconds
          • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing 25.00 damage of attack type Pierce and damage type Acid
          • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Weapons\HydraliskImpact\HydraliskImpact.mdl
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Create floating text that reads Backstab! above (Attacked unit) with Z offset 0.00, using font size 7.50, color (100.00%, 50.00%, 0.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
          • 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 0.20 seconds
        • Else - Actions
          • Do nothing
 
Status
Not open for further replies.
Top