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

[JASS] Unit MAX Hp increased

Status
Not open for further replies.
Level 7
Joined
Dec 30, 2008
Messages
72

I am currently working on a WAR3 version of MTG that actually follows MTG rules and regulations

and one of those is "creatures you control have +1/+1"

Now I can do the damage part just fine, but I can't seem to find anything to modify the max HP of a unit.

All units have inventory slots
Upgrades will not help as the unit buffing can be killed
Life Gain item ability only works for level 1
No SetUnitState can't increase the HP level so don't bother suggesting it

I feel like I've exhausted all options and will have to simply create 25 seperate abilities for LifeGain...

anyone know any other abilities / stuff thats useful?
The HP bonus also has to stack btw


Here are the solutions to adding HP to units max HP

PurgeandFire111
A Jass version of controlling max HP

watermelon_1234
A vJass solution: Unit Max State
A vJass solution: Bonus Mod

Dr Super Good
You can use tombs of health, those work on normal units perfectly and you just need to add a +1 to the units when spawned and a -1 when it dies.

The solution I used was my own,
it involved creating X life bonus abilities (seeing as I had a limited number of increases)
and creating a spellbook with X+1 levels in it, then controlling it via jass.
 
Last edited:
Item Life Bonus ability can have upgradeable levels, once it is set into a disabled spell book.
Just set your levels normally, then create an ability based off "Spell book", set Data - Minimum spells to 1 and add the Life Bonus ability to it in the Data - Spells list field. Then, use trigger:
  • TriR
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (IntegerA) from 1 to 12, do (Actions)
      • Loop - Actions
        • Player - Disable Spell book (custom) for (Player(IntegerA))
and use the following action to perform the level changes:
  • Unit - Set level of Item Life Bonus (custom) for Unit to X
 
Level 7
Joined
Dec 30, 2008
Messages
72
Well the only issue with that is I don't use vJass ^_^

So thanks for the suggestion, my self imposed limit forces me to find more 'creative' solutions, seeing as everything done in vJass has a solution in jass and the WE in general.

I have found a solution though, although I was lax to use it, but it works non the less

Spellbook with X levels
create X versions of Life Bonus each incremented by Y (mine was 10)

then use spellbook as you would Life Bonus, with the exception that it has to be disabled and enabled whenever it's used.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Using a 2 level item life bonous you can bug life in. Cause it removes the level 2 bonous to life when its removed at level 2 but does not add the level 2 life bonous when leveld from 1 to 2.
You can use tombs of health, those work on normal units perfectly and you just need to add a +1 to the units when spawned and a -1 when it dies.
Alternativly you could make a custom system for life of each unit.
Morphing between hero and non hero can add armor and life depending on settings, you could try messing with that.

Finally you could consider making this in SC2, where there are native triggers to modify units life, shield and energy.

Thats all the options I have.
 
Level 19
Joined
Oct 15, 2008
Messages
3,231
How about you make another unit which is about exactly the same as the first one, except that you change its Max HP, plus move over some items and such. Then in the trigger, you remove your current unit and place that new one over the spot where it was.

PS: I hope that helps! Because I'm not so good when it comes to these complex things...
 
Level 7
Joined
Dec 30, 2008
Messages
72
Well, I have solved it through a workaround, and tombs would work but would require an enormous amount of extra scripting, and I wouldn't be able to access the HP before the +1/+1 which is very important for abilities such as "target creature gains -X/-X" as those do not count the +1/+1.

and I'm already using custom values to store who owns them originally for blue's take ownership spells ^_^

But I suppose for other people looking for answers all these solutions would work brilliantly, I'll put all the links into my original posting
 
Status
Not open for further replies.
Top