• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

drain attack

Status
Not open for further replies.
Level 5
Joined
Apr 22, 2008
Messages
139
i need an ability so that when the unit with the ability attacks, it will drain a set amount of life and mana from the attacked unit if the attacked unit has mana plz help, iv spent like an hour so far trying ty
 
Level 9
Joined
Oct 7, 2007
Messages
599
You can trigger it (with the event "When an unit is attacked"). Then, just cause the attacking unit to damage the attacked unit the appropriate amount and steal mana if the attacked unit has mana to steal. The only problem that arises is the repeated use of the "stop" key will cause multiple attacks to be registered, and the lifesteal and manasteal will trigger multiple times without an actual attack landing.
 
Level 5
Joined
Apr 22, 2008
Messages
139
two problems: 1: as far as i can find there isnt a gui to check if a unit has mana 2: how would i increase the health of the attacker
 
Level 5
Joined
Apr 22, 2008
Messages
139
ok that helps but i wanted the attacked unit to lose X mana and life and the attacker to gain X mana and life
EDIT: o and how ould i set a units mana regen to a negative value?
 
Last edited:
Level 5
Joined
Apr 22, 2008
Messages
139
Well i tried this trigger but its not working:*** Events******* Time - Every 1.00 seconds of game time*** Conditions******* (Unit-type of (Picked unit)) Equal to Felhound*** Actions******* Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 3.00))
 
Level 22
Joined
Feb 3, 2009
Messages
3,292
Negative mana = in object editor under mana regeneration Shift + Enter and write - and a number.

Trigger (Not MUI or MPI):
  • Drain Attack
  • Event:
  • A unit is attacked
  • Conditions:
  • Attacking unit has ability (your ability)
    • ((Mana of (Attacking unit)) Greater than or Equal to X
  • Actions:
  • Set Attacked = Attacked unit
  • Set Attacking = Attacking Unit
  • Unit - Set Mana of (Attacking) to ((Mana of (Attacking)) + X)
  • Unit - Set Life of (Attacking) to ((Life of (Attacking)) + X)
  • Unit - Set Mana of (Attacked) to ((Mana of (Attacked)) - X)
  • Unit - Set Life of (Attacked) to ((Life of (Attacked)) - X)
  • Custom Script - set udg_Attacked = null
  • Custom Script - set udg_Attacking = null
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
  • Events
    • Unit - A Unit is attacked
  • Conditions
    • Level of *your ability* for Attacking Unit Greater than 0
  • Actions
    • Set x = *mana to be drained*
    • Set y = *life to be drained*
    • Unit - Set Mana of (Attacking Unit) to ((Mana Of (Attacking Unit)) + x)
    • Unit - Set Mana of (Triggering Unit) to ((Mana of (Triggering Unit)) - x)
    • Unit - Set Life of (Attacking Unit) to ((Life Of (Attacking Unit)) + y)
    • Unit - Set Life of (Triggering Unit) to ((Life of (Triggering Unit)) - y)
On a sidenote:
Do NOT null globals
 
Status
Not open for further replies.
Top