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

zero mana required

Status
Not open for further replies.
Level 2
Joined
Jun 27, 2016
Messages
13
Is there a way to detect when a hero has exactly zero mana? or maybe when the hero can't cast an ability (make the ability cost 1 mana)?

I want the player to use a spell when they reach zero mana.

EDIT: Found a workaround for what I wanted to do in this case. If you have the answer to my question I'd still love to know!
 
Last edited:
Level 2
Joined
Jun 27, 2016
Messages
13
I am curious about your workaround. How does it work?
I just reversed everything and made it so that the spell cost 100% of the mana. Placed an invisible buff on the player and set a trigger to constantly try to cast the spell as long as the buff is there, removing it when it's cast.

Silly I guess but I didn't know how else to do it... I started using the editor this week.:(

EDIT: I love your profile picture :xxd:
 
Level 12
Joined
May 22, 2015
Messages
1,051
I just reversed everything and made it so that the spell cost 100% of the mana. Placed an invisible buff on the player and set a trigger to constantly try to cast the spell as long as the buff is there, removing it when it's cast.

Silly I guess but I didn't know how else to do it... I started using the editor this week.:(

EDIT: I love your profile picture :xxd:
Lol thanks. I saw this comic and thought batman looked hilarious in it: http://i.imgur.com/k0fUm5w.jpg

The editor takes a while to get used to. I think the biggest problem is that there's so many tools and little tricks but nowhere does it tell you how to use them or recommend strategies for anything. You basically just need experience. Coming here for help is definitely a good plan :)

Unfortunately, I don't know the best way to detect if a unit has 0 mana. I know there is a trigger event that fires when a unit's health drops below a certain amount. If there is one for mana, it might do the trick. Otherwise, a periodic check for how much mana the unit has might work, but it sort of depends what you want to do when the unit has 0 mana.
 
Level 2
Joined
Jun 27, 2016
Messages
13
There's a trigger event for "Units mana becomes equal to 0" but selecting unit requires me to pick a variable or "preset" and I don't really know how to make a variable it will accept (heck i barely understand how to make a regular one) and i don't know what presets even are.
 
Level 12
Joined
May 22, 2015
Messages
1,051
There's a trigger event for "Units mana becomes equal to 0" but selecting unit requires me to pick a variable or "preset" and I don't really know how to make a variable it will accept (heck i barely understand how to make a regular one) and i don't know what presets even are.
Presets are units that are already on the map at the start of the game. I don't know the exact reason that blizzard made it this way lol. It is the reason entire systems are built to handle damage events. There is no generic "a unit takes damage" event, but there IS a "specific unit takes damage".

Triggers can have events added to them at any time. Damage systems basically build a trigger and add events for every unit that can take damage to it. Then there is a ton of code to handle all the things that can happen when a unit takes damage.

Anyway, it WOULD be possible to set up a similar system like this. Make a trigger that does what you want when a unit has 0 mana. Then you will need a separate trigger that adds an event to the first trigger every time one of the units you want to check either spawns or gains the ability that causes you to need to check them.
 
Status
Not open for further replies.
Top