New Spell - how refer to damage taken ?

Bonzo

New Member
Reaction score
4
Hi,

I want to make a buff spell that heals the buffed unit if the damage it has taken with one hit is above a certain percentage(10% in my map) of its max hp. So for example when the unit has 100 hp and it gets 8 damage nothing happens. If it takes 10 or more damage it is healed for some points.

Problem: With a generic unit event i can only refer to 'Unit is attacked', but then i cant get the amount of damage taken and cant compare it to the max hp of the attacked unit.
When I do it with a specific unit event I only can select units that are already placed on the map, what doesnt work with my idea. I tried to store the buffed units in a unit array, but that didnt work either.

Has anyone an idea how to realize that spell?

Greets Bonzo
 

linamus

I r bak!
Reaction score
57
Try:
Event: A unit starts the effect of ability
Conditions: Ability being cast equal to (your buff)
Actions: Add new event *target unit of ability being cast takes damage* to "your real trigger"

something like that
 

Bonzo

New Member
Reaction score
4
Thanks linamus for this quick answer, you helped me a lot. I'm testing it, because it doesnt work yet, but now I have an idea of how to realize it.
@Chocobo: I think you didnt get what my problem was, but thanks too.

Greets Bonzo
 

Flare

Stops copies me!
Reaction score
662
i believe this is what chocobo meant

Damage detection

btw, linamus's method is flawed, because if the same unit casts the ability more than once, the event will be added repeatedly. if that unit takes damage, the trigger actions are going to run for every event that was adding, using that unit. so, if you dealt additional damage when the unit that was added to the triggers event takes damage, it will be dealt numerous times
 

Bonzo

New Member
Reaction score
4
Ok I see both gave useful tips, the only thing that was missing in linamus' solution was the missing comparison whether the Target Unit has already been added to the 'Event List' of the coretrigger.

This is how i did it now (I have the German version so i tried to translate the German parts into English):

Code:
Spirit Bond Start
    Events
        Unit - A unit starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Spirit Bond 
        ((Target unit of ability being cast) is in SB_Group) Equal to False
    Actions
        Unit Group - Add (Target unit of ability being cast) to SB_Group
        Trigger - Add to Spirit Bond Do <gen> the event (Unit - (Target unit of ability being cast) Takes Damage)


Spirit Bond Do
    Events
    Conditions
        ((Triggering unit) has buff Spirit Bond ) Equal to True
    Actions
        Set HpSpiritBond[1] = (Damage taken)
        Set HpSpiritBond[2] = (Max. Life of (Triggering unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'IF'- Conditions
                (Integer(HpSpiritBond[1])) >= ((Integer(HpSpiritBond[2])) / 10)
            'THEN' - Actions
                Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 100.00)
            'ELSE' - Actions

This works so far, but i noticed that the healing-part has its errors. When the unit would be more than full healed with the hit, it does nothing. I could create a dummy with a healing ability, but that seems a bit circuitous to me. Is there another way to solve this?
Thanks for the help so far.

Greets Bonzo
 

Chocobo

White-Flower
Reaction score
409
Useless to do what you did to register units, you may register multiple times the same unit..

UnitGroup = unitgroup variable

Code:
Register PrePlaced Units
  Events
    Game - Time Elasped 0.00 seconds of game-time
  Conditions
  Actions
    Custom Script : set bj_wantDestroyGroup = true
    Unit Group - Pick every units in (Units in (Playable map area)) and do actions
      Loop - Actions
        Unit - Add (Picked unit) to UnitGroup
        Trigger - Add to Spirit Bond <gen> the event (Unit - (Picked unit) takes damage)

Code:
Detect Unit
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        (Triggering unit) Is not in UnitGroup Equal to True
    Actions
        Unit - Add (Picked unit) to UnitGroup
        Trigger - Add to Spirit Bond <gen> the event (Unit - (Triggering unit) Takes damage)

Code:
Spirit Bond
    Events
    Conditions
        ((Triggering unit) has buff Spirit Bond ) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            'If'- Conditions
                (Damage taken) Greater Than or Equal to ((Max Life of (Triggering unit)) x 0.10)
            'Then' - Actions
                Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 100.00)
            'Else' - Actions

>@Chocobo: I think you didnt get what my problem was, but thanks too.
If you check what you said in your code, it's the same thing as I've said (using a detection system and 2 conditions)

> When the unit would be more than full healed with the hit, it does nothing.
Then increase the maximal damage limit and/or reduce the healed amount of hit points.

>I could create a dummy with a healing ability, but that seems a bit circuitous to me. Is there another way to solve this?
Dummy units.
http://www.thehelper.net/forums/showthread.php?t=26751
 

Bonzo

New Member
Reaction score
4
The 'Detect Unit' and the 'Spirit Bond' triggers are the same that I postet with some little differences. But I dont get what the customscript line of your 'Register PrePlaced Units' trigger does exactly. If that line wouldnt be there it would do same as the 2nd trigger I think. Could you explain it to me?

And I dont think that I register the same unit more than one time:
Code:
Conditions
        (Ability being cast) Equal to Spirit Bond 
        ((Target unit of ability being cast) is in SB_Group) Equal to False


I'm sorry. You're right that you said the same thing as linamus. I didnt notice that you refer to a special damage detection system.

Just decreasing the amount of healing doesnt solve the problem.

I know what a dummy unit is and how to use it, but i thought there would be an easier way than creating a unit and make it cast a spell everytime the buffed unit takes damage.

Greets Bonzo
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • 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