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

Blood Mage steal life for each attack made.

Status
Not open for further replies.
Level 8
Joined
Jul 14, 2010
Messages
235
Hi, Im making a Blood Mage passive ability, which is supposed to give the Blood Mage 25HP for each time he attacks a target enemy. So I made this:
  • Blood Mage Life steal
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Tiara
    • Actions
      • Set TempLoc3 = (Position of (Attacking unit))
      • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + (25.00 x 1.00))
      • Special Effect - Create a special effect at TempLoc3 using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_TempLoc3)
The only thing is, if you spam the "Stop" action, the Blood Mage will: Stop attacking, but then go for a new attack if there is a enemy nearby, over and over, which result in ALOT of "A unit is attacked". The easiest would be if there is a Event: "Unit - A Unit is damaged", but I just can't find it, only "Unit - A Unit is attacked".
What to do?
 
Level 15
Joined
Oct 16, 2010
Messages
941
There are two ways I could see doing this.

The first (and best option) is using an indexing system (take a look at the jass section of the site) which would basically allow you to use the "Unit - A Unit is damaged" event efficiently.

The second is creating a cooldown timer for you're trigger. So at the end of the "Blood Mage Life steal" trigger you would turn it off and start a x-seconds timer and create another trigger that runs whenever that timer ends and turns on the initial trigger. If that made any sense at all?

like this:

  • Blood Mage Life steal
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Tiara
    • Actions
      • Set TempLoc3 = (Position of (Attacking unit))
      • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + (25.00 x 1.00))
      • Special Effect - Create a special effect at TempLoc3 using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_TempLoc3)
      • Countdown Timer - Start LifeSteal_Cooldown as a One-shot timer that will expire in 1.00 seconds
      • Trigger - Turn off (This trigger)
  • Blood Mage Life steal timer
    • Events
      • Time - LifeSteal_Cooldown expires
    • Conditions
    • Actions
      • Trigger - Turn on Blood Mage Life steal <gen>
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Use this trigger:

  • Trigger - Add to Trigger 2 the event (Unit - (Attacked unit) Takes damage)

EDIT:

Okay, we need 2 triggers for this to work
1st trigger:

  • Initialization
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) belongs to an enemy of (Owner of Tiara) Equal to True
    • Actions
      • Trigger - Add to Heal <gen> the event (Unit - (Attacked unit) Takes damage)
      • Trigger - Turn off (This trigger)
2nd:

  • Heal
    • Events
    • Conditions
    • Actions
      • Unit - Set life of Tiara to ((Life of Tiara) + 25.00)
Both must be Initially On
The 1st trigger needs to be turned off because, the Heal trigger will be doubled later on
Okay, 1st heal is +25, but second will heal +50, +100, +200... and so on
The trigger is turned off to prevent endless calculations
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
However, Raven0's trigger requires a Timer creation every time he attacks
This will make the game can be lag if it's multiple trigger running at a time
I suggest use my trigger, doesn't need any timer creation
Just 2 Initially On trigger, that's all
 
Status
Not open for further replies.
Top