Damage Absorbing Shield not working

Gotham

New Member
Reaction score
7
I created a passive ability that has 12% chance of creating a shield that absorbs X damage everytime the hero is attacked.

In other words:
The hero has 12% chance of creating the Elemental Shield everytime is attacked.

The elemental shield lasts 8 seconds, and can absorb up to 225 damage in level 4.

The ability is not multi instanceable, but I really don't care about that.

These are my triggers (probably having a lot of leaks, I'll fix that when I obtain they to work at least):

Code:
ShieldLearns
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Elemental Shield 
    Actions
        Set ShieldUnit = (Learning Hero)
        Trigger - Add to ShieldUnitTakesDamage <gen> the event (Unit - ShieldUnit Takes damage)

Code:
ShieldCasting
    Events
        Unit - A unit Is attacked
    Conditions
        (Level of Elemental Shield  for (Attacked unit)) Not equal to 0
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (ShieldUnitTakesDamage <gen> is on) Equal to False
            Then - Actions
                Set Random = (Random integer number between 1 and 100)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Less than or equal to 12
                    Then - Actions
                        Set L = (Position of (Attacked unit))
                        Unit - Create 1 Dummycaster for (Owner of (Attacked unit)) at L facing Default building facing degrees
                        Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                        Custom script:   call RemoveLocation(udg_L)
                        Unit - Order (Last created unit) to Human Priest - Inner Fire (Attacked unit)
                        Set ShieldHP = (25.00 + ((Real((Level of Elemental Shield  for (Attacked unit)))) x 50.00))
                        Trigger - Turn on ShieldUnitTakesDamage <gen>
                        Trigger - Turn off (This trigger)
                        Wait until (((Attacked unit) has buff Elemental Shield ) Equal to False), checking every 0.25 seconds
                        Trigger - Turn on (This trigger)
                        Trigger - Turn off ShieldUnitTakesDamage <gen>
                    Else - Actions
                        Do nothing
            Else - Actions
                Do nothing

Code:
ShieldUnitTakesDamage [U][B](initially off)[/B][/U]
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Damage taken) Greater than ShieldHP
            Then - Actions
                Unit - Set life of ShieldUnit to (((Life of ShieldUnit) + (Damage taken)) - ((Damage taken) - ShieldHP))
                Unit - Remove Elemental Shield  buff from ShieldUnit
            Else - Actions
                Set ShieldHP = (ShieldHP - (Damage taken))
                Unit - Set life of ShieldUnit to ((Life of ShieldUnit) + (Damage taken))

Variables:
Random: integer variable, self explanatory
ShieldUnit: unit variable, it purpose is for keeping the unit for the third trigger.
ShieldHP: the hit points that the elemental shield can absorb.

Notes:
It can't retrigger itself when active, has a 8 seconds cooldown and 8 seconds duration.
The inner fire thing is for showing the buff in the status bar, and taking care of the duration of the shield throug this.

Well... the problem is that this does not work. It doesn't absorb the damage, and sometimes even heals the hero when it's damaged :nuts:

Any help will be highly appreciated


(sorry for the grammatical errors, I'm not from a english-speaking country)
 
Gotham said:
Code:
ShieldUnitTakesDamage [U][B](initially off)[/B][/U]
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Damage taken) Greater than ShieldHP
            Then - Actions
                Unit - Set life of ShieldUnit to (((Life of ShieldUnit) [B]+ (Damage taken)[/B]) - ((Damage taken) - ShieldHP))
                Unit - Remove Elemental Shield  buff from ShieldUnit
            Else - Actions
                Set ShieldHP = (ShieldHP - (Damage taken))
                Unit - Set life of ShieldUnit to ((Life of ShieldUnit) + (Damage taken))

When the damage is greater than the shields HP, the shield's hp should be reset to 0.

That's the only thing I can think of to be missing. Also, what happens if the hero dies with a shield?
 
well if you dont feel like trying forever to get ur trigger to work ...
heres a map that uses a shield
Shield Map
 
Darthfett said:
When the damage is greater than the shields HP, the shield's hp should be reset to 0.

That's the only thing I can think of to be missing. Also, what happens if the hero dies with a shield?
When the shield is created ("ShieldCasting" trigger) the damage that the shield can absorb is recalculated.

If the hero dies, nothing happens. The shield is automatically turned off after the buff disappears anyway.

w00t22 said:
well if you dont feel like trying forever to get ur trigger to work ...
heres a map that uses a shield
Shield Map
I know that map, but I want to create it myself :)
If nothing works, well... I'll use that map
 
>When the shield is created ("ShieldCasting" trigger) the damage that the shield can absorb is recalculated.

That's not what I meant. In your trigger, if your shield has 5 hp, and all of your units deal more than 5 hp, they will always deal 5 less damage, since the shield is never reset to 0 again.

>If the hero dies, nothing happens. The shield is automatically turned off after the buff disappears anyway.

I meant if the hero dies, and the trigger has not yet checked to see if the shield has any hp left. For example,

The hero has 5 hp left, and the shield has 100. A unit attacks the hero, and kills it, but the shield still has that 100 hp left. The 100 hp of the shield was wasted, and not even used.
 
Darthfett said:
That's not what I meant. In your trigger, if your shield has 5 hp, and all of your units deal more than 5 hp, they will always deal 5 less damage, since the shield is never reset to 0 again.
But if the damage is greater than the shield HP, the shield is turned off (because the buff is removed). If the buff is removed, then the condition in the "ShieldCasting" 'wait for condition' function is activated thus turning off the shield.

I meant if the hero dies, and the trigger has not yet checked to see if the shield has any hp left. For example,

The hero has 5 hp left, and the shield has 100. A unit attacks the hero, and kills it, but the shield still has that 100 hp left. The 100 hp of the shield was wasted, and not even used.
The shield does not reduce lethal damage.
 
>But if the damage is greater than the shield HP, the shield is turned off (because the buff is removed). If the buff is removed, then the condition in the "ShieldCasting" 'wait for condition' function is activated thus turning off the shield.

Ah, I guess I didn't see this part:
Code:
                        Trigger - Turn on ShieldUnitTakesDamage <gen>
                        Trigger - Turn off (This trigger)
                        Wait until (((Attacked unit) has buff Elemental Shield ) Equal to False), checking every 0.25 seconds
                        Trigger - Turn on (This trigger)
                        Trigger - Turn off ShieldUnitTakesDamage <gen>

>The shield does not reduce lethal damage.

Oh. I thought it was supposed to. :p

Sorry, but I don't know the answer to your question. :(
 
Maybe you could try an alternate way to making the shield?

Have a dummy unit that isn't able to be seen by anyone, and constantly move it next to the hero. Then, whenever the hero is attacked, or targetted, order the unit to attack the dummy unit. Then, when the dummy unit dies, remove the hero's buff.
 
i was able to get a shield spell working, however, sometimes even with the shield it still takes damage on the first hit. but after that it works beautifully, so i almost don't care. any ideas? [edit:] actually, i put the wait 0.1 seconds before adding the life back and it works great. use as you need it.

Code:
Casting Power Word Shield
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Power Word: Shield 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Power Word: Shield  for (Casting unit)) Equal to 5
            Then - Actions
                Set ShieldValue = 1600.00
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Power Word: Shield  for (Casting unit)) Equal to 4
                    Then - Actions
                        Set ShieldValue = 800.00
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Power Word: Shield  for (Casting unit)) Equal to 3
                            Then - Actions
                                Set ShieldValue = 400.00
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Level of Power Word: Shield  for (Casting unit)) Equal to 2
                                    Then - Actions
                                        Set ShieldValue = 200.00
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Level of Power Word: Shield  for (Casting unit)) Equal to 1
                                            Then - Actions
                                                Set ShieldValue = 100.00
                                            Else - Actions

Code:
Power Word Shield Effect
    Events
        Unit - Elven Archer (Hero) 0028 <gen> Takes damage
        Unit - Elven Priest (Hero) 0029 <gen> Takes damage
        Unit - Footman (Hero) 0027 <gen> Takes damage
        Unit - Peasant (Hero) 0026 <gen> Takes damage
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) has buff Power Word: Shield (Extra)) Equal to True
                (Damage taken) Greater than or equal to ShieldValue
                ShieldValue Greater than 0.00
            Then - Actions
                Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ShieldValue)
                Unit - Remove Power Word: Shield (Extra) buff from (Triggering unit)
                Wait 0.10 seconds
                Set ShieldValue = 0.00
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Triggering unit) has buff Power Word: Shield (Extra)) Equal to True
                        (Damage taken) Less than ShieldValue
                        ShieldValue Greater than 0.00
                    Then - Actions
                        Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
                        Wait 0.10 seconds
                        Set ShieldValue = (ShieldValue - (Damage taken))
                    Else - Actions
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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