Add 30% of max HP and then remove it

Leazy

You can change this now in User CP.
Reaction score
50
Hello!

I'm creating a spell like survival instincts. The spell is for a druid character, who can shapeshift into a bear form where he has this ability. I want it to have 30% extra hp during this spell, but afterwards all the hp should be removed. The thing is, that if you swap out of bear form you should still have 30% extra hp, but 30% extra hp of the hp you have outside bear form (which is less). After the 20 sec I want the hp to become like the old one again, bugg free. It should also be removed when ressurected if you die with the effect. I can't think of any way to do this GUI (been testing for about an hour), so I would like to request a spell like this to be done (I think JASS is the only way to do this). Thanks in advance!
 

avalya

New Member
Reaction score
37
I believe making a percentage bonus could prove more trouble than you think, but I'd give it a shot in GUI. First of all, how much health do your druid have in bear form (will his health go over 3300 at any point or even over 33000)? Depending on his health, make item health bonuses, obviously based on Item Health Bonus, so they all got 10 levels, the first one goes from +0 to +9 health, the second from +0 to +90 (note that this is 0, 10, 20, 30 and so on and not 0, 1, 2, 3), a third one from +0 to +900, and if the health would go over 3000, make another +0 to +9000, a +0 to +90000 can also be made, depending on how high his health may be. That is the abilities that add the health, unfortunately, if he gains any new health bonuses (from Strength or Health from items) he will not get the extra percentage bonus from that until he casts the spell the next time.

Trigger:
  • SI Setup
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set SI_HealthBonus[1] = Health Bonus Level 4
      • Set SI_HealthBonus[2] = Health Bonus Level 3
      • Set SI_HealthBonus[3] = Health Bonus Level 2
      • Set SI_HealthBonus[4] = Health Bonus Level 1

Those are all the abilities that are set to make sure the correct ones are added.

Trigger:
  • SI Cast
    • Events
      • Unit - A Unit Starts the effect of an Ability
    • Conditions
      • Ability Being Cast equal to Survival Instincts
    • Actions
      • Set SIP = Player Number of (Owner of (Triggering Unit)
      • Set SI_Caster[SIP] = Triggering Unit
      • Set SI_MaxHealth = (Max Life of SI_Caster[SIP] x 0.3)
      • Set TempDivider = 1000
      • For Each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Unit - Add SI_HealthBonus[Integer A] to (SI_Caster[SIP])
      • For Each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set TempInteger = ((Integer(SI_MaxHealth)) / TempDivider)
          • Set Level of SI_HealthBonus[Integer A] for (SI_Caster[SIP]) to (TempInteger + 1)
          • Set SI_MaxHealth = (SI_MaxHealth - (Real((TempInteger x TempDivider)))
          • Set TempDivider = (TempDivider / 10)
      • Wait 20 seconds
      • For Each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Unit - Remove SI_HealthBonus[Integer A] from (SI_Caster[SIP])
      • Set SI_Caster[SIP] = No Unit

Make sure everything is correct and if you face any problems, let me know, this was completely freehanded so tell me if anything needs clarification.
 

Ayanami

칼리
Reaction score
288
I believe making a percentage bonus could prove more trouble than you think, but I'd give it a shot in GUI. First of all, how much health do your druid have in bear form (will his health go over 3300 at any point or even over 33000)? Depending on his health, make item health bonuses, obviously based on Item Health Bonus, so they all got 10 levels, the first one goes from +0 to +9 health, the second from +0 to +90 (note that this is 0, 10, 20, 30 and so on and not 0, 1, 2, 3), a third one from +0 to +900, and if the health would go over 3000, make another +0 to +9000, a +0 to +90000 can also be made, depending on how high his health may be. That is the abilities that add the health, unfortunately, if he gains any new health bonuses (from Strength or Health from items) he will not get the extra percentage bonus from that until he casts the spell the next time.

Trigger:
  • SI Setup
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set SI_HealthBonus[1] = Health Bonus Level 1
      • Set SI_HealthBonus[2] = Health Bonus Level 2
      • Set SI_HealthBonus[3] = Health Bonus Level 3
      • Set SI_HealthBonus[4] = Health Bonus Level 4

Those are all the abilities that are set to make sure the correct ones are added.

Trigger:
  • SI Cast
    • Events
      • Unit - A Unit Starts the effect of an Ability
    • Conditions
      • Ability Being Cast equal to Survival Instincts
    • Actions
      • Set SIP = Player Number of (Owner of (Triggering Unit)
      • Set SI_Caster[SIP] = Triggering Unit
      • Set SI_MaxHealth = (Max Life of SI_Caster[SIP] x 0.3)
      • Set TempDivider = 1000
      • For Each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Unit - Add SI_HealthBonus[Integer A] to (SI_Caster[SIP])
      • For Each (Integer A) from 2 to 5, do (Actions)
        • Loop - Actions
          • Set TempInteger = ((Integer(SI_MaxHealth)) / TempDivider)
          • Set Level of SI_HealthBonus[Integer A] for (SI_Caster[SIP]) to (TempInteger + 1)
          • Set SI_MaxHealth = (SI_MaxHealth - (Real((TempInteger x TempDivider)))
          • Set TempDivider = (TempDivider / 10)
      • Wait 20 seconds
      • For Each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Unit - Remove SI_HealthBonus[Integer A] from (SI_Caster[SIP])
      • Set SI_Caster[SIP] = No Unit

Make sure everything is correct and if you face any problems, let me know, this was completely freehanded so tell me if anything needs clarification.

You kind of got it wrong. The loop numbers are wrong. Should be 1 to 4, not 2 to 5. I suspect you copied the trigger from one of my explanations in the other trigger XD. Bear in mind that SI_HealthBonus[1] should be the highest health bonus while SI_HealthBonus[4] should be the lowest health bonus. However, this isn't MUI. It is MPI. There is a way to make this MUI, that is if you want to.
 

avalya

New Member
Reaction score
37
Oh, right, yeah, changing that. It is MPI however, unless I'm totally wrong today. And using an increasing Integer (up to 200 or so) it could be MUI, yes. I just decided not to, since I'm guessing he's making a hero, and even if every player can have the same hero, it wouldn't be any problem.
 

Leazy

You can change this now in User CP.
Reaction score
50
Good idea, however this would bugg if you die with the buff, and it won't work if you go out of form (don't want 30% of the bear form hp if you leave it, want 30% of the normal hp). The hp in bear form will not be a constant value (you can get new items etc). I prefer MUI if possible, MPI is fine though.
 

Ayanami

칼리
Reaction score
288
Good idea, however this would bugg if you die with the buff, and it won't work if you go out of form (don't want 30% of the bear form hp if you leave it, want 30% of the normal hp). The hp in bear form will not be a constant value (you can get new items etc). I prefer MUI if possible, MPI is fine though.

Can be easily fixed. Use a periodic trigger. Every 0.10 seconds or so, check if the unit is dead. If it is dead, remove the Health Bonuses. So you're saying the 30% should scale? In this case, you need to move the the whole trigger into the periodic one. Save a real variable every periodic. The saved amount should be equal to amount of health added. Then every 0.10 seconds, Set SI_MaxHealth = ((Max Life of SI_Caster - SavedReal) x 0.3). An easy way to save a real variable is by using a hashtable.
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
here somewhere is e-gui it can help you VERY MUCH (max hp/mp damage def and many others to change values)
 

Leazy

You can change this now in User CP.
Reaction score
50
Glenphir and avalya, thanks for helping me out, you got me on the right directon. I decided to use this system to modify the hp, as it looked cleaner. +rep for helping me!
 

Ayanami

칼리
Reaction score
288
Using the loop action posted on the second post is much shorter than using that system. It basically does everything in 1 loop.
 

Dirac

22710180
Reaction score
147
I think its easier to create an ability that has 100 levels with 10 hp bonus difference between each one or 5... then do (Max Hp) x 0.03 (in case of 10hp interval) and set the level of the ability to that number
 

Ayanami

칼리
Reaction score
288
I think its easier to create an ability that has 100 levels with 10 hp bonus difference between each one or 5... then do (Max Hp) x 0.03 (in case of 10hp interval) and set the level of the ability to that number

It isn't accurate. And imagine if the health bonus is needed to be 10000. Setting that huge amount of levels would be both inefficient and would cause lags.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top