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

Mana drain on attack? :)

Status
Not open for further replies.
Level 5
Joined
Jan 6, 2005
Messages
137
Hey, i tried making this myself, and i just dont see why it dosen't work, to me it seems kinda simple.. yet.. dosen't work .. well, i wan't an abillity that gives the hero 2%,4%,6%,8% and10% of it's damage it deals to enemies to its own mana, so that if it deals 100 damage, it will at level 5 give the hero 10 mana, now.. here is what i did

Event:
Any unit is attacked



Conditions:
Level of (mana burn spell dummy) is greater or equal to 1

Type of attacking unit Equal to (Hero type)



Actions:
Set Variable (lifeoftarget) to life of attaced unit

wait 0.5 seconds
set attacking units mana to (lifeoftarget) - (life of attacked unit*(level of (spell dummy for (hero))*0.02)


Set Variable (lifeoftarget) to life of attaced unit
 
Level 5
Joined
Jan 6, 2005
Messages
137
Perhaps, but as the trigger is triggred by "attacked" it is therefore the order of attack that triggers the trigger and again therefore will the trigger then execute before the target has lost hp and again then not work, see? :/-.- any other way to do this you think ?
 
Level 9
Joined
May 27, 2006
Messages
498
  • ManaDrainOnAttack
    • Events:
      • Unit - A unit deals damage
    • Conditions:
      • (Level of (ManaDrainAbility) for (Triggering unit) Greater than or equal to 1)
    • Actions:
      • Unit - Add ((Damage dealt) x ((Level of (ManaDrainAbility) for (Triggering unit)) x 0.02 ))) to (Triggering unit)'s mana
ManaDrainAbility should be a passive dummy ability that does really nothing (can be a 0% chance critical strike)
Watch for brackets in the multiplying, the order they're placed is important.
 
Last edited:
Level 5
Joined
Jan 6, 2005
Messages
137
...

Firstly, never seen "unit deals damage" event and i doubt it exists.
And, yes i realize this is a very dodgy way to achieve what i want, but i don't see any other way, oh and the fact that my earlier post didn't make much sense is prolly because i was very tired, sorry about that.

Now if anyone have an answer/solution, i'll still love to hear it, since the Hero using this is somewhat depending on this spell :)
 
Level 9
Joined
May 27, 2006
Messages
498
I dont have w3 right now on my computer, and i dont remember all the events Blizzard made in WE =/

Anyway, i'd love to help you, but you've read what Poot wrote - it can be easly made, but in JASS, at which i'm lame... Try waiting for somebody who knows it or post at JASS section :p
 
Level 5
Joined
Aug 23, 2007
Messages
141
Instead of A unit takes damage, use A unit is attacked.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Drainperattack for (Attacking unit)) Greater than 0
    • Actions
      • Unit - Create 1 Dummy for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing Default building facing degrees
      • Unit - Set level of Feedback for (Last created unit) to (Level of Drainperattack for (Attacking unit))
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Attack (Last created unit)
The dummy should have a 1 damage attack enabled, with an attack cooldown of at most 10 seconds, at least 5 seconds, to ensure it doesn't attack twice. (overkill, I know...) it should have the feedback ability.

Or why bother triggering, if you could just add the feedback ability to the main attacking unit?

BTW... I know, A unit is attacked isn't so efficient, since it triggers before the damage is dealt, but what the heck. Unless you do it in JASS, then you're forced to use it.
 
Last edited:
Level 5
Joined
Aug 27, 2007
Messages
138
What I would to is have a trigger which fired whenever that unit attacks, then create a local trigger or add an event to a GUI trigger that already has conditions/actions saying that the attacked unit takes damage. Then, get the damage dealt and multiply it by .10 or whatever and add it to the unit's mana. I'd post the JASS for it, but I'm not sure if it'd help any.
 
Status
Not open for further replies.
Top