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

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

I want create a spell, that drains a random amount of life and mana from the hero, each friendly unit in range get healed by both amounts and nearly enemy units get damage by both amounts. Also the Hero should lose the drained life and the drained mana.

I create the following trigger, but it doesn't work correct. The casting hero always die, and the damage/heal is always the same. Tested it 20 times and always the same. Can someone help me please? =)

  • Heart of Sheria
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ds Basic
    • Actions
      • Set TempPoint11 = (Position of (Casting unit))
      • Set DragonCounterLife = (Random integer number between (Integer((Life of (Casting unit)))) and (Integer((Max life of (Casting unit)))))
      • Set DragonCounterMana = (Random integer number between (Integer((Mana of (Casting unit)))) and (Integer((Max mana of (Casting unit)))))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 450.00 of TempPoint11 matching (((Matching unit) belongs to an ally of (Owner of (Casting unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Real(DragonCounterLife)) + (Real(DragonCounterMana))))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 450.00 of TempPoint11 matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - ((Real(DragonCounterLife)) + (Real(DragonCounterMana))))
      • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) - (Real(DragonCounterLife)))
      • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) - (Real(DragonCounterMana)))
      • Custom script: call RemoveLocation(udg_TempPoint11)
 
Level 10
Joined
Sep 21, 2007
Messages
517
hehe silly :) life of casting unit is the current life of the casting unit, and max life is the maximum life it can sustain, meaning the damage caused to casting unit is equal to a number between its current life and the maximum life it can sustain, so lets say the hp of the casting unit is 5, and its max hp is 7, the random integer will not be any less than 5, and so 5-5 = 0 = dead unit :p

dont worry, everyone makes silly mistakes like this xP

happy mapping!
 
Status
Not open for further replies.
Top