• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Gain mana every time unit attacks

Status
Not open for further replies.
Level 30
Joined
Sep 30, 2008
Messages
1,460
on my D3W map, the barbarian is set to gain 1 mana each time he attacks in order to make a rage style system.

I have used the trigger as shown below:

  • Barbarian Rage Gain
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to |cffe48b05Barbarian|r
    • Actions
      • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) + 1.00)
However, theres a slight bug. If the barbarian is in the middle of battle, and spams the stop button half ay through attacking, the rage still goes up.

In order to stop this, I need to find a way of detecting whether or not the barbarian does damage to the attacked unit.

For example, if attacked unit is damaged, receive 1 mana
if not, do nothing.

Any ideas?? :D
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
There are two ways:

1) Use the ability made by Blizzard which I don't remember its name and be done with it (and in case of "ooooo the icon doesn't look nice :((((((" you can hide it inside a disabled spell book, like any self respecting map does).

2) Create your own on-damage detection system (by your-own I mean not Blizzard's one, not literally your own, as there are tons of those ready for you if you search for them) and use it.

Solution 2 is better if you have many things that need to run upon getting hit.
If this is the only thing you need it for, just use the ability.
 
Level 6
Joined
Nov 10, 2006
Messages
181
Use LLDD if you know vJASS or JASS. It's under wc3c.

Well if you don't, in GUI at map initialization you do a pick every unit within playable map area and add a event to replace that Unit Is attacked event to A Unit is damaged.

You do a a unit enters playable map area and add them to the event as well.

This will leak a way or another though.
 
Status
Not open for further replies.
Top