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.

      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