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

Play with unit's max HP,available?

Status
Not open for further replies.
Level 6
Joined
Apr 29, 2008
Messages
94
Ther is anyway to modify a unit's (non hero) max HP?

I know ther is that "Item Life Bonus" thingy but the problem is that this ability gives hp equal to it's level 1 only (somewhy) so its not that useful if I wanna add non-specific amount of hp (got an always-changing varable integer and I want to set the unit's max HP to the amount of that varable...)

Sorry for my crappy spelling, hope someone understood my problem ;/
 
Level 5
Joined
Oct 3, 2008
Messages
104
i think this can only be accomplished by jass, if it can be accomplished at all

otherwise, best way i can think of is make 20 of the hp bonus skill
10 of them with a different order ID
this way you can stack say a bonus 800 hp and a bonus 60 hp together, and u get the total bonus of 860
in other words you can merge 2 digits together, instead of making like, 100 abilities for each value. if u make 30 of these abilities and 3 order ids, then u can have 1000 combinations, and so on. use arrays to sort these abilities, and this should be pretty easy to do
 
Level 6
Joined
Apr 29, 2008
Messages
94
Sounds too massive...
And what will be if I will want to modify 100 unit's max HP? -lag to crush?

Or i did'nt got you right, you meant each unit will have 20 abilities that change it's max HP or...?

And btw, whats up with the Item Life Bonus ability, why if I make it 100-levels ability, set all the HP bonus value per level and then when I add it to a unit via a trigger, increase it's level but still, the HP bonus value does not increase, why is that?
I can approve that:

 
Level 2
Joined
May 24, 2008
Messages
21
I was just in the editor messing around after seeing this post. Can anyone tell me if there is harm done in the way I decided to use this:

Make a 2-level ability based on Item Life Bonus. Level 1 is a bonus of 1, Level 2 is a bonus of 0.

  • Unit - Add ability to Hero
  • Unit - Increase level of ability for Hero
  • Unit - Remove ability from Hero
This adds 1 HP to the target unit, I have been using it in loops to great effect. Is this method ok and will it cause leaks or anything?

This is exciting since it is a fun stat I can add to new abilities in my map.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Less function calls = Happier computer.

Therefore, if you need to add, say, 400 life, calling the AddUnitAbility (or whatever it's called, I don't give a shnitzel) 400 times would be awesomely inefficient.

That's why you make a few abilities, for example 1,2,4,8,16,32,-1,-2,-4,-8,-16,-32 and then you put a loop with some if's to determine what ability to add next.
This is how the Max HP/MP system works, by the way.

As to tomes - it requires you to have a inventory which doesn't always look good.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
The set Unit max state, has 2 abilities, one for mana and one for life.
With multiple levels(7).
lvl 1: 0
lvl 2: 1
lvl 3: 10
lvl 4: 100
lvl 5: -1
lvl 6: -10
lvl 7: -100
Tomes require only that the unit does not have a unit inventory.
 
Level 6
Joined
Apr 29, 2008
Messages
94
Well, if you wonder how I made it in GUI trigger then I did it like this:

  • Calculate Health
    • Events
    • Conditions
    • Actions
      • -------- Max Health --------
      • Set Count_Integer = 0
      • Set Count_Integer = (((Stat_Stamina[(Player number of Picked Player)] x Stat_Stamina[(Player number of Picked Player)]) / 10) + 10)
      • Set Count_Integer = (Count_Integer + (Integer(((Real((Count_Integer x Statpower_MaxhealthPerc[(Player number of Picked Player)]))) / 100.00))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Max life of Hero[(Player number of Picked Player)]) Equal to (Real(Count_Integer))
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • Set SaveItem = (Item carried by Hero[(Player number of Picked Player)] in slot 1)
      • Set SaveReal = (Life of Hero[(Player number of Picked Player)])
      • Hero - Drop SaveItem from Hero[(Player number of Picked Player)]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Max life of Hero[(Player number of Picked Player)]) Greater than (Real(Count_Integer))
        • Then - Actions
          • Set Count_Integer = ((Integer((Max life of Hero[(Player number of Picked Player)]))) - Count_Integer)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Count_Integer Greater than 0
            • Then - Actions
              • For each (Integer A) from 1 to Count_Integer, do (Actions)
                • Loop - Actions
                  • Hero - Create Health Change -1 and give it to Hero[(Player number of Picked Player)]
                  • Hero - Order Hero[(Player number of Picked Player)] to use (Item carried by Hero[(Player number of Picked Player)] in slot 1)
            • Else - Actions
        • Else - Actions
          • Set Count_Integer = (Count_Integer - (Integer((Max life of Hero[(Player number of Picked Player)]))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Count_Integer Greater than 0
            • Then - Actions
              • For each (Integer A) from 1 to Count_Integer, do (Actions)
                • Loop - Actions
                  • Hero - Create Health Change +1 and give it to Hero[(Player number of Picked Player)]
                  • Hero - Order Hero[(Player number of Picked Player)] to use (Item carried by Hero[(Player number of Picked Player)] in slot 1)
            • Else - Actions
      • Hero - Give SaveItem to Hero[(Player number of Picked Player)]
      • Unit - Set life of Hero[(Player number of Picked Player)] to SaveReal
      • Set SaveReal = 0.00
I will explane the details a bit later, gotta go now...
 
Last edited:
Status
Not open for further replies.
Top