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

Tome of Mana?

Status
Not open for further replies.
Level 12
Joined
Jan 13, 2008
Messages
559
Hi, I would like to increase a units Mana with trigger. It's quite easy with HP since there is the Manual of Health and I can just give this to the hero but what about Mana? I could create an ability with 200 levels but...just no ^^ any ideas?

PS: i don't want to increase intelligence for this.
 
Level 12
Joined
May 22, 2015
Messages
1,051
A few things:

1) Creating tomes like this is all good, but if you do it a ton, you could make your map slower. The items are not cleaned up properly (if they use the tome models, they actually just shrink into dots and you can see them forever). Just keep that in mind since it could suck if you over use this trick.

2) A mana ability with 200 levels doesn't actually work. I don't know the exact details, but levelling the item abilities that add max health or mana do not actually change values when they level up. It is a bug. There are a bunch of abilities like this, but these two are pretty big ones.

There are two main ways you can do this:
1) Make a system where you have a single mana ability that each adds:
1, 2 ,4 ,8, 16, 32, 64, 128 ... doubling each time.
You then have to use a hashtable or unit indexer to keep track of how much is added to each unit. You then add and remove the proper abilities to make them add up to the value you need. Once you get up to around 10 abilities, you can have any number all the way up to 1000. I can go into more detail if you want.

2) There is a sort of related bug with the health and mana abilities. They don't change when you increase the level of the ability with triggers, but when you remove them after increasing the level, it removes the current level value health / mana instead of the level 1 amount. This is exploitable as a tool.

Basically, you create a mana ability where it has level 1 adds 0 mana, and level 2 add -10 mana (could be -100 to add 100 at a time, etc). When you want to add the mana to a unit, you add the ability, increment the ability level for the unit, then remove the ability. It will remove -10 mana which adds it instead. You can use this to add any amount of health or mana without spamming tomes or anything. It is probably the best solution for this.

Note that you can add negative values for ability stats by holding shift and then editing the value. Don't know if you know that or not, but I think you need it for this method.
 
Level 12
Joined
Jan 13, 2008
Messages
559
1) but if I remove the item afterwards its all good, right?
2) okay, I didnt know this. Thanks
3) I do exactly this with other things but then I have to reset the mana everytime and then add it again. It laggs for a short time and is not a good solution.

Let's say I add 3 mana. So total mana is now 3 (2+1) now i I add 3 more mana, then it's 6 in total and the solution would be (2+4) but the +1 is still there and thats why I need to reset the mana everytime.

4) That's interesting. This would be a very easy solution and fix my problem. I will try this right now and see if it works. Thank you!
 
Level 23
Joined
Oct 18, 2008
Messages
937
2) There is a sort of related bug with the health and mana abilities. They don't change when you increase the level of the ability with triggers, but when you remove them after increasing the level, it removes the current level value health / mana instead of the level 1 amount. This is exploitable as a tool.

Basically, you create a mana ability where it has level 1 adds 0 mana, and level 2 add -10 mana (could be -100 to add 100 at a time, etc). When you want to add the mana to a unit, you add the ability, increment the ability level for the unit, then remove the ability. It will remove -10 mana which adds it instead. You can use this to add any amount of health or mana without spamming tomes or anything. It is probably the best solution for this.

Note that you can add negative values for ability stats by holding shift and then editing the value. Don't know if you know that or not, but I think you need it for this method.

wow, that is amazing. does it stack, too?
 
Level 12
Joined
May 22, 2015
Messages
1,051
can't I just remove the item afterwards when giving it to the hero?

I think it is safe to do that.

You have to remove the +1 ability in the 3 -> 6 example. It can be an expensive check, so you should do it as little as possible. It depends on what you need to do with the effect.

SetUnitMaxState - you have to do some stuff with JNGP or something for this, don't you? Or is it just a function / library someone made to do all this?
 
Level 12
Joined
Jan 13, 2008
Messages
559
A few things:

2) There is a sort of related bug with the health and mana abilities. They don't change when you increase the level of the ability with triggers, but when you remove them after increasing the level, it removes the current level value health / mana instead of the level 1 amount. This is exploitable as a tool.

Basically, you create a mana ability where it has level 1 adds 0 mana, and level 2 add -10 mana (could be -100 to add 100 at a time, etc). When you want to add the mana to a unit, you add the ability, increment the ability level for the unit, then remove the ability. It will remove -10 mana which adds it instead. You can use this to add any amount of health or mana without spamming tomes or anything. It is probably the best solution for this.

Note that you can add negative values for ability stats by holding shift and then editing the value. Don't know if you know that or not, but I think you need it for this method.

I need to ask: what ability gives mana?
 
Level 12
Joined
May 22, 2015
Messages
1,051
I need to ask: what ability gives mana?

I don't remember the exact name of the ability, but I suspect it is something like:
Item Mana Bonus (Greater)

There should be an item that adds it in the default game, but I don't know what it's called.
 
Status
Not open for further replies.
Top