• 🏆 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!

[Solved] "Unit - Damage Target" crushing reforged?

Level 2
Joined
Jul 31, 2023
Messages
2
Hello. I was making a skill that passively adds random damage, but I ran into the problem. When a hero with this skill dealing damage, the game crashes without any message. I also tested this trigger on a empty map without other lines and preset 100.00 damage value. Definition of "Damage source" and "Triggered unit" works fine (tested with a text).
  • RandomDamage
    • Events
      • Unit - A unit Получает урон
    • Conditions
      • (Level of Random damage for (Damage source)) Greater than 0
    • Actions
      • Set VariableSet RandomDamageValue = (Random integer number between 1 and (50 x (Level of Random damage for (Damage source))))
      • Unit - Cause (Damage source) to damage (Triggering unit), dealing (Real(RandomDamageValue)) damage of attack type Chaos and damage type Normal
      • Floating Text - Create floating text that reads (String(RandomDamageValue)) at (Position of (Triggering unit)) with Z offset 10.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
      • 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 2.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
P.S. "Получает урон" = "Takes Damage".
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
You've created an infinite loop.

A unit takes damage -> Deal damage.

Simply turn off the trigger before the damage is dealt to prevent it from running again:
  • Trigger - Turn off RandomDamage <gen>
  • Unit - Cause (Damage source) to damage (Triggering unit), dealing (Real(RandomDamageValue)) damage of attack type Chaos and damage type Normal
  • Trigger - Turn on RandomDamage <gen>
You can also check whether the damage came from an Attack in the Conditions:
  • (Damage From Normal Attack) Equal to True
Also, if you want to modify the damage dealt rather than dealing a new instance of damage, there's an Action for that:
  • Event Response - Set Damage of Unit Damaged Event to 0.00
 
Last edited:
Top