Help with a spell

VergilSSS

New Member
Reaction score
0
Hey guys.

I have been trying to make a spell that, when casted will deal eg:100 pure damage + your attack damage and heal caster equaly to total damage dealt, but i am failing for quite some time, since i do not know how to do triggers that will heal up caster for his attack damage...

Could you post trigger about how to do this spell, or simply teach me how to do it?

Thanks in advance. :)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Probably the easiest way to do it would be to manually calculate a random number to use as the damage and apply it that way. However, this will probably not be truly accurate since you have to take into account the number of dice and the number of sides, and so on.

The best way to get the damage that a unit deals in-game is the Unit Takes Damage event, since it has a function to grab how much damage was dealt, however, this requires that an attack has actually been made....
 

darkreapers

New Member
Reaction score
6
i dont think its possible to do your attack damage, however you could try doing your agility/intel/strength including or excluding bonuses as damage?
 

Grundy

Ultra Cool Member
Reaction score
35
My way would be much more complicated but maybe work better, maybe not. the checking str/agi/int way wouldn't take into account any +damage items, abilities, or buffs. My way would but it might possibly malfunction in other ways depending on the units attack speed and the spells cooldown.

I would make the spell based on Black Arrow with 100 bonus damage and i would use 2 triggers. 1 trigger for "starts the effect of an ability"/"Ability being cast equal to Black Arrow" and that trigger would create a local trigger for when the target of the spell being cast takes damage (because that event requires a specific unit) and then in the local trigger's actions you could use damage taken (it would be the caster's attack damage + 100 minus any resistences or armor) and heal the damage source (the caster) for that much damage and have the local trigger self destruct (destroy it self!)

Now, I say it might malfunction depending on attack speed and spell cooldown because it might be possible for it to be cast twice before the 1st projectile hits and in that case the 1st hit would heal double. one way around that would be to keep a global unit group that has all the targets added to it and only create the local trigger if the target is not already in the group then add a condition to the local trigger to check for the Black Arrow buff to make sure the trigger doesn't go off from other damage sources.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Err... could you explained it in a GUI form?

Sure.

This will take a few triggers.

The main trigger will have no event to start, and will have a damage event added to it with another trigger. You have to do it this way because there is no general Unit Takes Damage event; only for specific units Conditions will be that Triggering Unit has specific buff (whatever buff you choose to use for the spell) and Level of (the Ability for the spell) for the Damage Source is greater than 0. Actions will be to remove that buff, and set the Damage Source's life to its Current Life + Damage Taken.

The next trigger will have event Unit starts the effect of an Ability, conditions Ability Being Cast equal to Your Ability (base it off of, say, frost arrows). Actions will be to check if the unit is in a unit group variable (name it whatever you want), and if it is not in the unit group, add it to the unit group and add to the first trigger the event Target Unit Of Ability Being Cast takes damage. The unit group check is to make sure you don't add the damage event more than once per unit or the trigger will start running multiple times.

Pretty short triggers. This won't work if the ability is set to autocast, though - only if you manually target it. It'll work for autocast if the event of the second trigger is A Unit Is Attacked, and you change Target Unit of Ability Being Cast to Triggering Unit and change the conditions to check whether Attacking Unit has a level of the spell ability greater than 0.


Trigger:
  • Heal Caster
    • Events
    • Conditions
      • ((Triggering unit) has buff Healing Arrows) Equal to True
      • (Level of Healing Arrows for (Damage source)) Greater than 0
    • Actions
      • Unit - Remove Healing Arrows buff from (Triggering unit)
      • Unit - Set life of (Damage source) to ((Life of (Damage source)) + (Damage taken))

Trigger:
  • Add Damage Detection
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Healing Arrows
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in HealingArrowTargetsGroup) Equal to False
        • Then - Actions
          • Unit Group - Add (Target unit of ability being cast) to HealingArrowTargetsGroup
          • Trigger - Add to Heal Caster <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
        • Else - Actions
 

Dest

New Member
Reaction score
26
Sure.

This will take a few triggers.

The main trigger will have no event to start, and will have a damage event added to it with another trigger. You have to do it this way because there is no general Unit Takes Damage event; only for specific units Conditions will be that Triggering Unit has specific buff (whatever buff you choose to use for the spell) and Level of (the Ability for the spell) for the Damage Source is greater than 0. Actions will be to remove that buff, and set the Damage Source's life to its Current Life + Damage Taken.

The next trigger will have event Unit starts the effect of an Ability, conditions Ability Being Cast equal to Your Ability (base it off of, say, frost arrows). Actions will be to check if the unit is in a unit group variable (name it whatever you want), and if it is not in the unit group, add it to the unit group and add to the first trigger the event Target Unit Of Ability Being Cast takes damage. The unit group check is to make sure you don't add the damage event more than once per unit or the trigger will start running multiple times.

Pretty short triggers. This won't work if the ability is set to autocast, though - only if you manually target it. It'll work for autocast if the event of the second trigger is A Unit Is Attacked, and you change Target Unit of Ability Being Cast to Triggering Unit and change the conditions to check whether Attacking Unit has a level of the spell ability greater than 0.


Trigger:
  • Heal Caster
    • Events
    • Conditions
      • ((Triggering unit) has buff Healing Arrows) Equal to True
      • (Level of Healing Arrows for (Damage source)) Greater than 0
    • Actions
      • Unit - Remove Healing Arrows buff from (Triggering unit)
      • Unit - Set life of (Damage source) to ((Life of (Damage source)) + (Damage taken))

Trigger:
  • Add Damage Detection
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Healing Arrows
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in HealingArrowTargetsGroup) Equal to False
        • Then - Actions
          • Unit Group - Add (Target unit of ability being cast) to HealingArrowTargetsGroup
          • Trigger - Add to Heal Caster <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
        • Else - Actions

In 2nd trigger, change the unit group to loop and give some custom scripts (I think thats for to remove the leaks)
 

Ayanami

칼리
Reaction score
288
Trigger:
  • Heal Caster
    • Events
    • Conditions
      • ((Triggering unit) has buff Healing Arrows) Equal to True
      • (Level of Healing Arrows for (Damage source)) Greater than 0
    • Actions
      • Unit - Remove Healing Arrows buff from (Triggering unit)
      • Unit - Set life of (Damage source) to ((Life of (Damage source)) + (Damage taken))


Trigger:
  • Add Damage Detection
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Healing Arrows
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in HealingArrowTargetsGroup) Equal to False
        • Then - Actions
          • Unit Group - Add (Target unit of ability being cast) to HealingArrowTargetsGroup
          • Trigger - Add to Heal Caster <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
        • Else - Actions

Instead of making it check a group like this, why not do it this way.

Trigger:
  • Add Damage Detection
    • Events
      • A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Heal Caster <gen> the event (Unit - (Triggering unit) Takes damage)


Trigger:
  • Heal Caster
    • Events
    • Conditions
      • ((Triggering unit) has buff Healing Arrows) Equal to True
      • (Level of Healing Arrows for (Damage source)) Greater than 0
    • Actions
      • Unit - Remove Healing Arrows buff from (Triggering unit)
      • Set RealDamage = ((Damage taken) + YOURDAMAGE)
      • Unit - Cause (Damage source) to damage (Triggering unit), dealing (YOUR DAMAGE) damage of attack type Chaos and damage type Universal
      • Unit - Set life of (Damage source) to ((Life of (Damage source)) + (RealDamage))
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Instead of making it check a group like this, why not do it this way.

That would also work, though you might need a third trigger that runs on map initialization to add the damage detection for pre-placed units. Using the triggers I posted would only add events for targets of the spell; adding damage detection for every unit on the map would make the main spell trigger run and have to check its conditions every time any unit takes damage. :nuts: That might not be a big deal, but it's still less efficient.
 
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

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top