Triggered Spell Question (%Health)

lionheadxO

New Member
Reaction score
3
I was wondering how you would make a spell that varies depending on how much life you have or how much life a target has. The skill I'm trying to make is: the lower your life total is, you gain +attackspeed/damage, and whenever you kill a unit you heal 40% of their max life total. You don't have to make the skill for me, but just explain how it works. But if you really want to, you can make it. I just want to learn how to make new triggers.
 

Avaleirra

Is back. Probably.
Reaction score
128
To do the 40% health thing.

Events
A unit dies
Condition
Action
If killing unit has the buff (whatever)

then (use arithmetic) set life of killing unit to life of killing unit + 0.40 (life of dying unit)

else





Sorry bout the mess :p

change it to your liking.
 

Laiev

Hey Listen!!
Reaction score
188
To do the 40% health thing.

Events
A unit dies
Condition
Action
If killing unit has the buff (whatever)

then (use arithmetic) set life of killing unit to life of killing unit + 0.40 (life of dying unit)

else





Sorry bout the mess :p

change it to your liking.

you mean....

Trigger:
  • unit -set life of (killing unit) to (life of (killing unit) + 0.40 x (life of triggering unit))


:p
 

lionheadxO

New Member
Reaction score
3
Trigger:
  • Masamune Life
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has buff Masamune ) Equal to True
    • Actions
      • Unit - Set life of (Killing unit) to ((Life of (Killing unit)) + (0.40 x (Life of (Triggering unit))))


K so I tried recreating it, but it doesnt seem to work whether i use triggering unit or dying unit at the end at 0.4xlife of triggering unit.
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Of course it doesn't work, you're giving the killing unit 0.4x0 life xD. You need to do:
Trigger:
  • Unit - Set life of (Killing unit) to ((Life of (Killing unit)) + (0.40 x (Max Life of (Dying unit))))
 

lionheadxO

New Member
Reaction score
3
OHHH wow i feel so dumb :p I didn't even notice that function. Thank you very much props :). Anyone know how the life to damage/attackspeed works? Would I need to break it down into chunks of life? Like every 10%?
 

Ayanami

칼리
Reaction score
288
Take a look at the spell Demonic Rage. It's basically what you want, however this increases damage for a percent of health missing. So at level 3, it gives 15% of health missing as damage. It isn't done by percent. But this can be easily changed.

Trigger:
  • Actions
    • Set TempReal = (((Max life of (Picked unit)) - (Life of (Picked unit))) x (0.05 x (Real((Level of DRAbility[1] for (Picked unit))))))


This line decides your damage bonus. Just come up with something for that line. Everything else should be find. As for the attack speed, do the same I did for my damage part.
 

lionheadxO

New Member
Reaction score
3
Trigger:
  • Demonic Rage
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DRUnitGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in DRUnitGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of DRAbility[1] for (Picked unit)) Equal to 0
                • Then - Actions
                  • For each (Integer A) from 2 to 6, do (Actions)
                    • Loop - Actions
                      • Unit - Remove DRAbility[(Integer A)] from (Picked unit)
                  • Unit Group - Remove (Picked unit) from DRUnitGroup
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Life of (Picked unit)) Less than ((Max life of (Picked unit)) x 0.50)
                    • Then - Actions
                      • -------- Damage bonus amount --------
                      • Set TempReal = (((Max life of (Picked unit)) - (Life of (Picked unit))) x (0.05 x (Real((Level of DRAbility[1] for (Picked unit))))))
                      • -------- ----------------------------------------- --------
                      • Set TempDivider = 10000
                      • For each (Integer A) from 2 to 6, do (Actions)
                        • Loop - Actions
                          • Set TempInt = ((Integer(TempReal)) / TempDivider)
                          • Unit - Set level of DRAbility[(Integer A)] for (Picked unit) to (TempInt + 1)
                          • Set TempReal = (TempReal - (Real((TempInt x TempDivider))))
                          • Set TempDivider = (TempDivider / 10)
                    • Else - Actions
                      • For each (Integer A) from 2 to 6, do (Actions)
                        • Loop - Actions
                          • Unit - Set level of DRAbility[(Integer A)] for (Picked unit) to 1


reading through the trigger I get how everything works other than everything under the damage bonus amount. Like what is a TempDivider used for? And what does the series of functions under the "Set TempReal" function do?
 

Ayanami

칼리
Reaction score
288
Basically, everything TempDivider and the loop functions set the level of the dummy spells. The dummy spells are basically "Item - Damage Bonus". In that case, I made 5 different abilities of the same "Item - Damage Bonus". Then at map init, I set it as DRAbility. Each ability contains 10 levels. Level 1 all starting at 0 damage bonus. For every level of the spell, it increases the damage by 1/10/100/1000/10000. That's why there are 5 different spells. For example, the 1st spell would have a series like: 0,1,2,3,4,5... while another one could have: 0,10,20,30,40,50... With this, you can have up to 99999 damage if all levels of the dummy spells are set to 10. This prevents you from actually creating 1 "Item - Damage Bonus" spell and setting it with 99999 levels. That would cause hideous lags and extremely troublesome to do. Here's an explanation.

Let us say we want the damage bonus to be 145. So set TempReal = 145.00. Set the greatest damage bonus spell (0, 10000, 20000...) to DRAbility[2] and the weakest damage bonus spell (0, 1, 2...) to DRAbility[6]. DRAbility[1] was used as another ability, so don't mind it. You can actually use DRAbility[1] to DRAbility[5] and set the loop to from 1 to 5 instead of 2 to 6.

1st Loop
When the loop is ran the first time, TempReal is converted to an integer. Thus, 145.00 becomes 145. Easy so far. Then TempReal is divided by TempDivider, which is 10000. So it becomes 145/10000. Since it's an integer, it's rounded down to 0. Then the ability is set to TempInt + 1, in this case which becomes 1. So your DRAbility[2] will provide 0 bonus damage. Remember TempReal = 145.00 right now. TempInt is 0. So when you take TempReal - (TempInt x TempDivider) it becomes, 145.00 - (0 x 10000). So basically, it reamins 145.00. So TempReal remains 145.00 since there isn't any digit in the ten-thousands place. Then TempDivider is divided by 10, thus TempDivider becoming 1000.

2nd Loop
Since there is no digit in the thousands place either, TempReal remains as 145.00, similar to the 1st loop case. Thus DRAbility[3] is set to TempInt + 1, which is 1. DRAbility[3] provides 0 bonus damage. TempDivider is divided by 10 again, which becomes 100.

3rd Loop
When loop is ran the third time, same process occurs again. TempReal = 145.00 now. Then converted to 145. Divider is now 100, your TempInt becomes 145/100, which gives you 1, due to the round down. DRAbility[4] is now set to TempInt + 1, which is 2. So DRAbility[4] provides you with 100 bonus damage. Ok, here's where the re-setting the TempReal comes in. TempReal is currently 145.00. It is then subtracted by TempInt x TempDivider, which is (1 x 100) = 100. Thus, you are left with (145.00 - 100.00) = 45.00. Now, TempReal = 45.00. TempDivider is divided by 10 again, which becomes 10.

4th Loop
Loop is ran for the fourth time. Same process occurs again. TempReal = 45.00 now. Then converted to 45. Divider is now 10, your TempInt becomes 45/10, which gives you 4, due to the round down. DRAbility[5] is now set to TempInt + 1, which is 5. So DRAbility[5] provides you with 40 bonus damage. TempReal becomes (45.00 - (4 x 10)) = 5.00. TempDivider is divided by 10 again, which becomes 1.

5th Loop
Loop is ran for the fifth time. Same process occurs again. TempReal = 5.00 now. Then converted to 5. Divider is now 1, your TempInt becomes 5/1, which is 5. DRAbility[6] is now set to TempInt + 1, which is 6. So DRAbility[6] provides you with 5 bonus damage.

In total, this amounts up to 145 damage. Hope you understood this.
 

lionheadxO

New Member
Reaction score
3
After reading it again, I think I do get how it works. Am I going to need this system for the attack speed bonus also?
 

Lifee

New Member
Reaction score
46
i guess you are trying to combine 2 spells from dota in 1 aren't you?
 

lionheadxO

New Member
Reaction score
3
Yeah basically. The passive abilities synergize very well together. My hero is also almost complete actually. I just need to finish this ability and an execute ability and he will be finished. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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