Snippet Set Unit Maximum HP and Mana

Tom Jones

N/A
Reaction score
437
Documentation (Can be found in the attached map as well):
General:
MUI: Depends on usesage.
GUI/JASS: This one is GUI, a JASS version can be found at wc3campaigns by BladeDK
Leaks: Nope.

Requirements:
The custom abilities Max Life Modifier (A000) and Max Mana Modifier (A001).
The GUI triggers Set Max Hp and Set Max Mana.
The variables Loop_Integer, Max_Hp, Max_Mana, Some_Unit.

Import:
Copy/Paste the abilties to your map.
Copy/Paste the triggers to your map.
Check your variables (Ctrl+x) and check if you got all the needed variables.

How to use:
Set a unit to the Some_Unit, set either Max_Hp or Max_Mana to desired value, and run the respective
trigger.

Triggers:
Code:
Set Max Hp
    Events
    Conditions
    Actions
        Set Max_Hp = (Max_Hp - (Integer((Max life of Some_Unit))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Max_Hp Greater than 0
            Then - Actions
                Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Life Modifier  to Some_Unit
                        Unit - Set level of Max Life Modifier  for Some_Unit to 4
                        Unit - Remove Max Life Modifier  from Some_Unit
                Set Max_Hp = (Max_Hp mod 100)
                Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Life Modifier  to Some_Unit
                        Unit - Set level of Max Life Modifier  for Some_Unit to 3
                        Unit - Remove Max Life Modifier  from Some_Unit
                Set Max_Hp = (Max_Hp mod 10)
                For each (Integer A) from 1 to Max_Hp, do (Actions)
                    Loop - Actions
                        Unit - Add Max Life Modifier  to Some_Unit
                        Unit - Set level of Max Life Modifier  for Some_Unit to 2
                        Unit - Remove Max Life Modifier  from Some_Unit
            Else - Actions
                Set Max_Hp = (0 - Max_Hp)
                Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Life Modifier  to Some_Unit
                        Unit - Set level of Max Life Modifier  for Some_Unit to 7
                        Unit - Remove Max Life Modifier  from Some_Unit
                Set Max_Hp = (Max_Hp mod 100)
                Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Life Modifier  to Some_Unit
                        Unit - Set level of Max Life Modifier  for Some_Unit to 6
                        Unit - Remove Max Life Modifier  from Some_Unit
                Set Max_Hp = (Max_Hp mod 10)
                For each (Integer A) from 1 to Max_Hp, do (Actions)
                    Loop - Actions
                        Unit - Add Max Life Modifier  to Some_Unit
                        Unit - Set level of Max Life Modifier  for Some_Unit to 5
                        Unit - Remove Max Life Modifier  from Some_Unit

Code:
Set Max Mana
    Events
    Conditions
    Actions
        Set Max_Mana = (Max_Mana - (Integer((Max mana of Some_Unit))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Max_Mana Greater than 0
            Then - Actions
                Set Loop_Integer = ((Max_Mana - (Max_Mana mod 100)) / 100)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Mana Modifier  to Some_Unit
                        Unit - Set level of Max Mana Modifier  for Some_Unit to 4
                        Unit - Remove Max Mana Modifier  from Some_Unit
                Set Max_Mana = (Max_Mana mod 100)
                Set Loop_Integer = ((Max_Mana - (Max_Mana mod 10)) / 10)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Mana Modifier  to Some_Unit
                        Unit - Set level of Max Mana Modifier  for Some_Unit to 3
                        Unit - Remove Max Mana Modifier  from Some_Unit
                Set Max_Mana = (Max_Mana mod 10)
                For each (Integer A) from 1 to Max_Mana, do (Actions)
                    Loop - Actions
                        Unit - Add Max Mana Modifier  to Some_Unit
                        Unit - Set level of Max Mana Modifier  for Some_Unit to 2
                        Unit - Remove Max Mana Modifier  from Some_Unit
            Else - Actions
                Set Max_Mana = (0 - Max_Mana)
                Set Loop_Integer = ((Max_Mana - (Max_Mana mod 100)) / 100)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Mana Modifier  to Some_Unit
                        Unit - Set level of Max Mana Modifier  for Some_Unit to 7
                        Unit - Remove Max Mana Modifier  from Some_Unit
                Set Max_Mana = (Max_Mana mod 100)
                Set Loop_Integer = ((Max_Mana - (Max_Mana mod 10)) / 10)
                For each (Integer A) from 1 to Loop_Integer, do (Actions)
                    Loop - Actions
                        Unit - Add Max Mana Modifier  to Some_Unit
                        Unit - Set level of Max Mana Modifier  for Some_Unit to 6
                        Unit - Remove Max Mana Modifier  from Some_Unit
                Set Max_Mana = (Max_Mana mod 10)
                For each (Integer A) from 1 to Max_Mana, do (Actions)
                    Loop - Actions
                        Unit - Add Max Mana Modifier  to Some_Unit
                        Unit - Set level of Max Mana Modifier  for Some_Unit to 5
                        Unit - Remove Max Mana Modifier  from Some_Unit
Notes:
Thought I might as well upload it in one place instead of having it uploaded five different times.

Tom Jones.
 

Attachments

  • Set Unit Max hp.w3x
    19.1 KB · Views: 1,902

duyen

New Member
Reaction score
214
Mind telling us what's really good about it?

For example:

Code:
This system is good for easily manipulating <Fill in text here> and is simpler then <Fill in text here>.
You get the idea
 

Tom Jones

N/A
Reaction score
437
Mind telling us what's really good about it?

For example:

Code:
This system is good for easily manipulating <Fill in text here> and is simpler then <Fill in text here>.
You get the idea
No I don't. Seems rather pointless, since it's already described in the thread title. And I never, by principle, compare any of my work with anybody else's work.
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
Mind telling us what's really good about it?

For example:

Code:
This system is good for easily manipulating <Fill in text here> and is simpler then <Fill in text here>.
You get the idea
I think I can make an ability that add max life or max mana by percent <= this is good
 

Quauhtli

I have the right to remain silent.
Reaction score
62
I didn't know moderators used GUI :p

And I agree with Anman, I don't really see what this is supposed to do. (Perhaps if some day I actually am not lazy and look at the triggers:rolleyes:)
Set unit maximum hp and mana, does it reset the original hp and replace it with a new value? Like a footman normaly has like 120 hp and you reset it with the trigger which makes the footman now have 250 hp?

I like the idea of this, I'll probably use it to give like a non item power up for the heroes in my campaign when they do an optional quest :)
 

Somatic

You can change this now in User CP.
Reaction score
84
Its useful, espically in zombie survival maps where you can randomise the HP of the zombies, increasing and decreasing by a certain mark such that it really make all zombies look different and unique. Nice work Jones =)
 

Sil3nt

SUP?
Reaction score
134
This is pretty useful instead of setting a heroes hp which could conflict with leveling up stats or obtaining items (which is what i wouldve done cause im so dumb to think of something like this) and its in gui which makes noobs like me understand it =D
 

misterurafag

New Member
Reaction score
0
how did you get the negitive values on your abilities? and i tried to use your method but my unit just dies heres what i put down
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        Unit_Health Equal to 3
    Then - Actions
        For each (Integer A) from 1 to Unit_Health_1, do (Actions)
            Loop - Actions
                Unit - Add Item Life Bonus (Greater) to (Triggering unit)
                Unit - Set level of Item Life Bonus (Greater) for (Triggering unit) to 4
                Unit - Remove Item Life Bonus (Greater) from (Triggering unit)
    Else - Actions
        Do nothing
what did i do wrong?
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
how did you get the negitive values on your abilities? and i tried to use your method but my unit just dies heres what i put down
what did i do wrong?

From level 2: negative values will increase life/mana and positive values will decrease life/mana
Hold Shift and press Enter or Double Click to get negative value
 

misterurafag

New Member
Reaction score
0
ok i did that and edited my trigger a little so it looks like
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        Unit_Health Equal to (7 / 2)
    Then - Actions
        Set Unit_Health_1 = (Unit_Health_1 x Unit_Health)
        For each (Integer A) from 1 to Unit_Health_1, do (Actions)
            Loop - Actions
                Unit - Add Item Life Bonus (Greater) to (Triggering unit)
                Unit - Set level of Item Life Bonus (Greater) for (Triggering unit) to 3
                Unit - Remove Item Life Bonus (Greater) from (Triggering unit)
        For each (Integer A) from 1 to (Custom value of (Triggering unit)), do (Actions)
            Loop - Actions
                Unit - Add Item Life Bonus (Greater) to (Triggering unit)
                Unit - Set level of Item Life Bonus (Greater) for (Triggering unit) to 2
                Unit - Remove Item Life Bonus (Greater) from (Triggering unit)
    Else - Actions
        Do nothing
and when i ran it the health of the unit was originaly 150 and when it comes out it has 1650 health when i want it to have 550 health also it lags a little when it happens is there anyway yo stop this?
where
Unit_Health_1 = units health (at first)
(Custom value of (Triggering unit)) = units health
level of the abilites are
1 = 0
2 = 1
3 = -1
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
>when i ran it the health of the unit was originaly 150 and when it comes out it has 1650 health
I see you have add/remove 1500 times, no doubt you got lag :eek:
>i want it to have 550 health
Check the Unit_Health_1 and the Custom Value of (Trigger Unit), you give Unit_Health_1 HP to Trigger Unit and take away Custom Value of (Trigger Unit) HP from it.
>stop the lag
You should make this ability with more levels, I recommend 9 levels:
Code:
 1 = 0
 2 = -1
 3 = -10
 4 = -100
 5 = -1000
 6 = 1
 7 = 10
 8 = 100
 9 = 1000
So, if you want to increases 1500 HP, you only need to add/remove: 1 times level 5 and 5 times level 4 => 6 times add/remove in total => it should less lag than 1500 times :thup:
 

jaybles169

New Member
Reaction score
2
First off, great trigger, does exactly what I've been looking for. Except one thing. I noticed when the trigger gets called in game the game lags just a little bit, maybe a half second; I'm making like a Hero Defense type of map, and the trigger gets call at the start of each level, so the lag definitely noticeable. If I had to guess at the reason why, it'd be the way I have it set up. It changes the health of created units in a region based on how many people are playing, (kind of like a built in difficulty setter) running the trigger for every mob created, and it gets hung up on that. So I guess I'm wondering if its possible to get this trigger working so it changes the max hp of a unit-type, that way it can be applied before creating the creeps (in a template sort of way), therefore running the trigger once instead of x amount of times. And I'm hoping for a GUI solution, as I dont think I'm commited enough for JASS quite yet. Hope my question makes sense, sorry for the long post. Thanks.

EDIT: Woops, didn't realize how old this is, I was still thinking its 2008 yet when I saw the first posts, so I thought it was recent ><
Either way, if anyone can help me out, would be cool. Thanks.
 

M4573R

New Member
Reaction score
1
I'm using this same method to set damage and health for a unit. Why does it not do anything? Is there some catch I don't know that makes these triggers fail?

I have an ability based off of Item Permanent Damage Increase. I add it to a unit, set the level, then remove it. It doesn't change the damage of the unit at all. Same goes for health.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top