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)
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
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?
 

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
well if you dont feel like trying forever to get ur trigger to work ...
heres a map that uses a shield
Shield Map
 

Gotham

New Member
Reaction score
7
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
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
>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.
 

Gotham

New Member
Reaction score
7
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.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
>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. :(
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
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.
 

eliw00d

New Member
Reaction score
3
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.
  • Ghan Ghan:
    Howdy
  • 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 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