• 🏆 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!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

Another damage to variable question.

Status
Not open for further replies.
Level 7
Joined
Jul 29, 2007
Messages
172
Well I wish to make a spell with the fuction of :

Every X damage you dealt, a spell will be autocasted.

What should I do with the X? How should I set it to a Real variable?
 
This only works if a Player has only 1 Unit with this skill.
  • INITSample
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Sample <gen> the event (Unit - (Picked unit) Takes damage)
  • Sample
    • Events
    • Conditions
      • (Level of <SKILLNAME> for (Damage source)) Greater than 0
    • Actions
      • Set Skill_DamageDealt[(Player number of (Owner of (Damage source)))] = (Skill_DamageDealt[(Player number of (Owner of (Damage source)))] + (Damage taken))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Skill_DamageDealt[(Player number of (Owner of (Damage source)))] Greater than or equal to <DAMAGEAMOUNT>
        • Then - Actions
          • Do your stuff...
          • Set Skill_DamageDealt[(Player number of (Owner of (Damage source)))] = 0.00
        • Else - Actions

If you want to have multiple units per player to have this skill you have to work with Custom Value of Unit:
(NOTE: A Unit can only have ONE Custom Value, so you can't use it for other triggers)
  • Unit - Set the custom value of (Damage source) to ((Custom value of (Damage source)) + (Integer((Damage taken))))
 
Status
Not open for further replies.
Top