ChaosWarlock
New Member
- Reaction score
- 7
I am trying to increase, and then after time decrease a units Max HP by a % using GUI (I am new to triggers and don't know JASS). I found an action to set the Life of a unit but no action to set the MAX Life of a unit. Can someone please point me in the right direction to accomplish this?
Thank you!
EDIT: Updated with solution I found to work best.
Thank you very much for all who have put their comments here. I would not have gotten the solution if wasn't for everyone contributing.
This is where the I got the trigger for changing the Max HP.
You could alternatively use this but I did not try it because in the post it says it uses some JASS which I am not familiar with.
This explains a little more of why it works.
This technique is what I used to make the spell MUI.
The spell that I needed this for is called Last Stand. Many of you may know it from WoW. For those of you who are not familiar with it, it increases the casters hit points (max and current) by a percent for a short period of time. I have set the % to increase per level of the spell. If you would like the duration to increase per level of the spell all you would have to do is make the buff last longer. As always comments are welcome. Enjoy!
Thank you!
EDIT: Updated with solution I found to work best.
Thank you very much for all who have put their comments here. I would not have gotten the solution if wasn't for everyone contributing.
This is where the I got the trigger for changing the Max HP.
You could alternatively use this but I did not try it because in the post it says it uses some JASS which I am not familiar with.
This explains a little more of why it works.
This technique is what I used to make the spell MUI.
The spell that I needed this for is called Last Stand. Many of you may know it from WoW. For those of you who are not familiar with it, it increases the casters hit points (max and current) by a percent for a short period of time. I have set the % to increase per level of the spell. If you would like the duration to increase per level of the spell all you would have to do is make the buff last longer. As always comments are welcome. Enjoy!
Trigger:
- Last Stand Cast
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Last Stand
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- LastStandCV Less than 1000
- Then - Actions
- Set LastStandCV = (LastStandCV + 1)
- Else - Actions
- Set LastStandCV = 1
- If - Conditions
- Set LastStandUnit[LastStandCV] = (Triggering unit)
- Set LastStandPoint = (Position of (Triggering unit))
- Unit - Create 1 Dummy for (Owner of (Triggering unit)) at LastStandPoint facing Default building facing degrees
- Unit - Set the custom value of (Last created unit) to LastStandCV
- Set LastStandDummy[LastStandCV] = (Last created unit)
- Unit - Add Last Stand (Buff) to (Last created unit)
- Unit - Set level of Last Stand (Buff) for (Last created unit) to (Level of Last Stand for (Triggering unit))
- Unit - Order (Last created unit) to Neutral Fire Lord - Soul Burn (Triggering unit)
- Set LastStandGain[LastStandCV] = (Integer((((((Real((Level of Last Stand for (Triggering unit)))) x 5.00) + 10.00) / 100.00) x (Max life of (Triggering unit)))))
- Game - Display to (All players) the text: (String(LastStandGain[LastStandCV]))
- Set LastStandHP = LastStandGain[LastStandCV]
- Trigger - Run Last Stand Health <gen> (ignoring conditions)
- Unit - Set life of LastStandUnit[LastStandCV] to ((Life of LastStandUnit[LastStandCV]) + (Real(LastStandGain[LastStandCV])))
- Custom script: call RemoveLocation(udg_LastStandPoint)
- Wait 0.26 seconds
- Unit Group - Add LastStandDummy[LastStandCV] to LastStandGroup
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
Trigger:
- Last Stand Remove
- Events
- Time - Every 0.25 seconds of game time
- Conditions
- (Number of units in LastStandGroup) Greater than 0
- Actions
- Unit Group - Pick every unit in LastStandGroup and do (Actions)
- Loop - Actions
- Set Temp_Integer = (Custom value of (Picked unit))
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (LastStandUnit[Temp_Integer] has buff Last Stand ) Equal to False
- Then - Actions
- Unit - Remove (Picked unit) from the game
- Set LastStandHP = (0 - LastStandGain[Temp_Integer])
- Set LastStandCV = Temp_Integer
- Trigger - Run Last Stand Health <gen> (ignoring conditions)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Integer((Life of LastStandUnit[Temp_Integer]))) - LastStandGain[Temp_Integer]) Greater than 0
- Then - Actions
- Unit - Set life of LastStandUnit[Temp_Integer] to ((Life of LastStandUnit[Temp_Integer]) - (Real(LastStandGain[Temp_Integer])))
- Else - Actions
- Unit - Set life of LastStandUnit[Temp_Integer] to 1.00
- If - Conditions
- Else - Actions
- If - Conditions
- Loop - Actions
- Unit Group - Pick every unit in LastStandGroup and do (Actions)
- Events
Trigger:
- Last Stand Health
- Events
- Conditions
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- LastStandHP Greater than 0
- Then - Actions
- Set LastStandLoop = ((LastStandHP - (LastStandHP mod 100)) / 100)
- For each (Integer A) from 1 to LastStandLoop, do (Actions)
- Loop - Actions
- Unit - Add Last Stand (Health) to LastStandUnit[LastStandCV]
- Unit - Set level of Last Stand (Health) for LastStandUnit[LastStandCV] to 4
- Unit - Remove Last Stand (Health) from LastStandUnit[LastStandCV]
- Loop - Actions
- Set LastStandHP = (LastStandHP mod 100)
- Set LastStandLoop = ((LastStandHP - (LastStandHP mod 10)) / 10)
- For each (Integer A) from 1 to LastStandLoop, do (Actions)
- Loop - Actions
- Unit - Add Last Stand (Health) to LastStandUnit[LastStandCV]
- Unit - Set level of Last Stand (Health) for LastStandUnit[LastStandCV] to 3
- Unit - Remove Last Stand (Health) from LastStandUnit[LastStandCV]
- Loop - Actions
- Set LastStandHP = (LastStandHP mod 10)
- For each (Integer A) from 1 to LastStandHP, do (Actions)
- Loop - Actions
- Unit - Add Last Stand (Health) to LastStandUnit[LastStandCV]
- Unit - Set level of Last Stand (Health) for LastStandUnit[LastStandCV] to 2
- Unit - Remove Last Stand (Health) from LastStandUnit[LastStandCV]
- Loop - Actions
- Else - Actions
- Set LastStandHP = (0 - LastStandHP)
- Set LastStandLoop = ((LastStandHP - (LastStandHP mod 100)) / 100)
- For each (Integer A) from 1 to LastStandLoop, do (Actions)
- Loop - Actions
- Unit - Add Last Stand (Health) to LastStandUnit[LastStandCV]
- Unit - Set level of Last Stand (Health) for LastStandUnit[LastStandCV] to 7
- Unit - Remove Last Stand (Health) from LastStandUnit[LastStandCV]
- Loop - Actions
- Set LastStandHP = (LastStandHP mod 100)
- Set LastStandLoop = ((LastStandHP - (LastStandHP mod 10)) / 10)
- For each (Integer A) from 1 to LastStandLoop, do (Actions)
- Loop - Actions
- Unit - Add Last Stand (Health) to LastStandUnit[LastStandCV]
- Unit - Set level of Last Stand (Health) for LastStandUnit[LastStandCV] to 6
- Unit - Remove Last Stand (Health) from LastStandUnit[LastStandCV]
- Loop - Actions
- Set LastStandHP = (LastStandHP mod 10)
- For each (Integer A) from 1 to LastStandHP, do (Actions)
- Loop - Actions
- Unit - Add Last Stand (Health) to LastStandUnit[LastStandCV]
- Unit - Set level of Last Stand (Health) for LastStandUnit[LastStandCV] to 5
- Unit - Remove Last Stand (Health) from LastStandUnit[LastStandCV]
- Loop - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)