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

TRIGGER: mana as experience

Status
Not open for further replies.
Level 7
Joined
Dec 28, 2011
Messages
145
What I'm trying to accomplish is when a unit kills another unit, it gains a point of mana, and when it reaches a certain point (let's just say 20), they gain an ability (most likely passive) and either change the unit name or change the colour. I know, or at least, can figure out the ability and changing colour thing, but 'm having trouble with the mana increasing when a unit is killed. Can someone help me with this?
 
Level 7
Joined
Nov 19, 2015
Messages
283
Unit dies

Attacking unit = your unit

Set mana of killing unit = mana of killing unit + 1

Manke sure you disable mana regen from intelligence and base mana regen.
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
in the trig of which you give the ability to the hero, give the unit a custom value.

then you can say if unit has custom value of 6 then don't give them that ability.

easy
 
Level 7
Joined
Nov 19, 2015
Messages
283
Unit dies

Unit equal to <your unit>

Set man of unit = mana of unit + 1
If mana of unit = X
Set mana = 0
If level of <ability A> of unit >= 1 (this is an integer comparison to check whether they have the ability)
then give <ability B>
Else give <ability A>

You probs need something like this.
I wouldn't recommend using custom values since it can be used for other more important things such as unit indexing.
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
you mean to tell me custom values can't work on multiple units? I very much double that. you would just get a lot of units all with the same custom number, that doesn't hurt the game.
 
Level 19
Joined
Jul 2, 2011
Messages
2,162
it's part of the unit trig

unit, set custom value... it's that simple. then you can create an if statement to check if an ability should be given or not according to the custom value.

custom values! I used them for may things. it's an int.
 
Level 7
Joined
Nov 19, 2015
Messages
283
I wouldn't recommend using custom values. Get into a good habit of using unit indexing or learn how to use hashtables.

http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-v3-5-4-1-a-201016/

This is a damage detection system which also uses unit indexing. By using unit indexing you can also save the experience of the unit as a stored variable rather than as mana. This allows you to use mana for other things.
 
Level 7
Joined
Dec 28, 2011
Messages
145
Thanks everyone, but for now I'll stick with a very linear version of the trigger. The unit has a max mana pool of 35. when the reach exactly 10 mana, or exactly 20 mana, or exactly 30 mana, they gain a new ability. The extra 5 mana is a buffer to prevent them from re-getting the other abilities. They're won't be any mana syphoning in the map so I think this will work decently well. Only a ton of testing will truly tell. Thank you all though.
 
Level 7
Joined
Nov 19, 2015
Messages
283
Thanks everyone, but for now I'll stick with a very linear version of the trigger. The unit has a max mana pool of 35. when the reach exactly 10 mana, or exactly 20 mana, or exactly 30 mana, they gain a new ability. The extra 5 mana is a buffer to prevent them from re-getting the other abilities. They're won't be any mana syphoning in the map so I think this will work decently well. Only a ton of testing will truly tell. Thank you all though.

A unit dies
Unit equal to XXX
Set manaa of unit = mana of unit +1
If mana of unit = 10 add ability A
If mana of unit = 20 add ability B
If mana of unit = 30 add ability C

You dont really need the 5 buffer mana. Also it might look nicer if you use the trigger I posted before checking if the unit has the ability. This lets you set the mana back to 0 each time.
 
Status
Not open for further replies.
Top