• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Damage Event not working properly

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Currently using Bribe's GUI Damage Detection (should seriously switch to jass -_-) but heres my current trigger.

  • Set Damage
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: local unit u = udg_DamageEventSource
      • Custom script: call print("fried")
      • Set DamageEventAmountDummy = DamageEventAmount
      • Set Temp_Integer = (Player number of (Owner of DamageEventSource))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Magical Bolt for DamageEventSource) Not equal to 0
          • (DamageEventTarget has buff MagicBolt) Equal to True
        • Then - Actions
          • Set DamageEventAmount = (DamageEventAmount + ((Real((Intelligence of DamageEventSource (Include bonuses)))) x 3.00))
          • Unit - Remove MagicBolt buff from DamageEventTarget
          • Custom script: call print("fried1")
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DamageEventTarget has buff ElectricMarker) Equal to True
          • (Level of Electricity for DamageEventSource) Not equal to 0
        • Then - Actions
          • Custom script: call print("fried4")
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ElectricityLastHit[Temp_Integer] Less than (CurrentGameTime + 3.00)
            • Then - Actions
              • Set ElectrictyHitCount[Temp_Integer] = 0.00
            • Else - Actions
          • Set ElectrictyHitCount[Temp_Integer] = (ElectrictyHitCount[Temp_Integer] + 1.00)
          • Set ElectricityLastHit[Temp_Integer] = CurrentGameTime
          • Set DamageEventAmount = (DamageEventAmount + ((Real((Intelligence of DamageEventSource (Include bonuses)))) x (3.00 x (Power(0.85, (ElectrictyHitCount[Temp_Integer] - 1.00))))))
          • Custom script: call print(R2S(udg_DamageEventAmount))
          • Unit - Remove ElectricMarker buff from DamageEventTarget
        • Else - Actions
      • -------- Show Critical Text --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ShowCriticalText Equal to True
        • Then - Actions
          • Set ShowCriticalText = False
          • Floating Text - Create floating text that reads ((String((Integer(DamageEventAmount)))) + !) above DamageEventTarget with Z offset 50.00, using font size 13.00, color (100.00%, 5.00%, 10.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 75.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 1.40 seconds
        • Else - Actions
Neither of the MagicBolt or ElectricMarker buff checks work. Is there a way to fix this trigger (i have no idea what I'm doing wrong, the Magic Bolt ability is based off of storm bolt and has 9sec duration, electric is just chain lightning with a 1sec duration) or do it in a different manner?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well, you're never using the "u" local, neither nullying it at the end, but it has nothing to do with your problem.

If the checks aren't working, it's probably something in the conditions. Try disabling one of them and test, then disable the other and test.

And, yes, switch to jass xD

Are you sure that you added the right buffs to your abiltiies? I ussualy make the ability, and the buff, and never configure the ability to apply the buff i just created
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
you should just use buff comparisons

JASS:
if UnitHasBuffBJ(udg_DamageEventTarget, buffid) then 
set udg_DamageEventAmount = something 
endif
you can use the stunned buff for this comparison btw this system is very nice if you convert it and add a few optimizations here and there
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
buff generation takes time to be 'true', while your Game - DamageModifierEvent becomes Equal to 1.00 is instant, so it doesnt work well, put a timer or wait in between checking the level of the spell, then check the buff...

This might be true (seeming like one of the only current only explanations) but this will cause major delay in real time combat

Well, you're never using the "u" local, neither nullying it at the end, but it has nothing to do with your problem.

If the checks aren't working, it's probably something in the conditions. Try disabling one of them and test, then disable the other and test.

And, yes, switch to jass xD

Are you sure that you added the right buffs to your abiltiies? I ussualy make the ability, and the buff, and never configure the ability to apply the buff i just created

Oops :\ used u for a timed attack on my other funtime map that i stole the system from and forgot to delete it.

Yes im sure that i added the buffs.

Stats - Buffs (abuf) ElectricMarker
Stats - Duration (ahdu)(ahdr) 15.00
Stats - Buffs (abuf) MagicBolt
Stats - Duration (ahdu)(ahdr) 15.00

you should just use buff comparisons

JASS:
if UnitHasBuffBJ(udg_DamageEventTarget, buffid) then 
set udg_DamageEventAmount = something 
endif
you can use the stunned buff for this comparison btw this system is very nice if you convert it and add a few optimizations here and there


This wont really help... you just converted the condition to JASS :\ (you even used the BJ)

Also, i split it up, and its the (DamageEventTarget has buff MagicBolt) thats causing the problem

E/ Rewriting the code in JASS and i accidently hit a hotkey and when i type text it will delete and replace the text ahead of it, is there a way to remove? didnt see it in options


2E/ still didnt work

JASS:
function Trig_Set_Damage_Copy_Actions takes nothing returns nothing
    local unit s = udg_DamageEventSource
    local unit t = udg_DamageEventTarget
    set udg_DamageEventAmountDummy = udg_DamageEventAmount
    set udg_Temp_Integer = GetConvertedPlayerId(GetOwningPlayer(s))
    if GetUnitAbilityLevel(t, 'B001') > 0 and  GetUnitAbilityLevel( s, 'A00D') != 0   then
        set udg_DamageEventAmount = ( udg_DamageEventAmount + ( I2R(GetHeroInt(s, true)) * 3.00 ) )
        call UnitRemoveAbility(t,'B001')
        call print("fried1")
    endif
    set s = null
    set t = null
endfunction
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Try starting a 0.001 timer and checking the buff and stuff when it expires. I don't think it will be even noticeable.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
JASS:
function timerEnd takes nothing returns nothing          
    local string s
    if GetUnitAbilityLevel(unitt, 'B001') then 
        set s = "true" 
    else
        set s = "false"
    endif
    call print(s)
    set s = null
endfunction

why is the endif in this statement returning "Cannot convert integer to boolean"
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
if GetUnitAbilityLevel(unitt, 'B001') then you're not comparing the integer with anything.

if GetUnitAbilityLevel(unitt, 'B001') > 0 then
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
if GetUnitAbilityLevel(unitt, 'B001') then you're not comparing the integer with anything.

if GetUnitAbilityLevel(unitt, 'B001') > 0 then

Oops! Ill test it in a moment

e/

JASS:
    if GetUnitAbilityLevel(t, 'B001') > 0 and  GetUnitAbilityLevel( s, 'A00D') != 0   then
        set udg_DamageEventAmount = ( udg_DamageEventAmount + ( I2R(GetHeroInt(s, true)) * 3.00 ) )
        call UnitRemoveAbility(t,'B001')
        call print(R2S(udg_DamageEventAmount))
    endif

this worked. thanks.

On another side, does anyone know how to disable the previously mentioed problem? (when i type, it erases the text in front of it rather than placing it behind. This is fixed on word by clicking the little button on the bottom but cant press it here)

2e/ well aite i gtg bed but a problem with my 2nd part

JASS:
if ( GetUnitAbilityLevel(udg_DamageEventSource, 'B003')  > 0 and GetUnitAbilityLevel( udg_DamageEventSource,'A00L') != 0 ) then
        call print("fried4")
        if ( udg_ElectricityLastHit[i] < ( udg_CurrentGameTime + 3.00 ) ) then
            set udg_ElectrictyHitCount[i] = 0.00
        else
        endif
        set udg_ElectrictyHitCount[i] = ( udg_ElectrictyHitCount[i] + 1 )
        set udg_ElectricityLastHit[i] = udg_CurrentGameTime
        set udg_DamageEventAmount = ( udg_DamageEventAmount + ( I2R(GetHeroInt(udg_DamageEventSource, true)) * ( 3.00 * Pow(0.85, ( udg_ElectrictyHitCount[i] - 1 )) ) ) )
        call print(R2S(udg_DamageEventAmount))
        call UnitRemoveAbility(udg_DamageEventTarget , 'B003' )
    endif

Doesnt print fried4. What i also noticed is that chain lightning does not apply the buff. Can anyone else test this for me and see if they get the same results (attack enemy with chain lightning modified for 15sec duration and with storm bult buff and see if you can see the whirlwind, i cant.)
 
Last edited:
Level 29
Joined
Mar 10, 2009
Messages
5,016
This might be true (seeming like one of the only current only explanations) but this will cause major delay in real time combat
if you dont want the delay, just remove the buff and put a false buff via triggers, like:
- Hero cast storm bolt to target
- Put the target in the group
Then when checking:
if IsUnitInGroup(udg_DamageEventTarget, udg_BuffGrp) and (GetUnitAbilityLevel(udg_DamageEventSource,'A00L') > 0) then

remove the target after
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
if you dont want the delay, just remove the buff and put a false buff via triggers, like:
- Hero cast storm bolt to target
- Put the target in the group
Then when checking:
if IsUnitInGroup(udg_DamageEventTarget, udg_BuffGrp) and (GetUnitAbilityLevel(udg_DamageEventSource,'A00L') > 0) then

remove the target after

I fixed it by converting it to JASS. Not sure how, but its fixed. Look at my Chain Lightning issue

About the text being erased, pres insert in your keyboard. Its used to replace text.


THANK YOU, it was driving me crazy
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
JASS:
if ( GetUnitAbilityLevel(udg_DamageEventSource, 'B003')  > 0 and GetUnitAbilityLevel( udg_DamageEventSource,'A00L') != 0 ) then
        call print("fried4")

If doesn't print "fried4" then, for sure, one of the conditions is avoiding it. Try disabling one, then the other.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
JASS:
if ( GetUnitAbilityLevel(udg_DamageEventSource, 'B003')  > 0 and GetUnitAbilityLevel( udg_DamageEventSource,'A00L') != 0 ) then
        call print("fried4")

If doesn't print "fried4" then, for sure, one of the conditions is avoiding it. Try disabling one, then the other.

-_-

The condition is the one that checks the buff.

I made the buff easily visible in-game and it didnt show up. period.

so my current thought is that chain lightning does not apply buffs
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Chain Lightning doesn't apply buffs xD Only abilities that already apply a buff applies buffs (as far as I know). You could test with...

Taken from Wc3 Ability Guide
Aasl (Tornado Slow Aura): This aura is perfect to add buffs to units that have no effects at all. Just set the targets allowed to self and the effect of the aura to zero. The ability doesn't have an icon. The best thing is that you can have more than one on a unit and the different buff icons will stack. Because 'Aasl' is normally a harming aura the buff tooltip will always be red, but you can change that by using color codes in the buff's name. For example |cffff0000Badass Red Buff|r and |cff00ff00Beneficial Green Buff|r. If you ever find a limit for 'Aasl' you can also use other auras and hide them in a disabled spellbook.

ANab, AEsh (Acid Bomb, Shadow Strike): Acid bomb is very versatile and probably the best base for a direct damage ability. It has many nice features like slowing movement and attack speed, armor reduction, instant damage, damage over time, buffs, projectile art – yet all those effects can easily be removed if required. Also it doesn't have stun or any limitations regarding the allowed targets. Shadow strike offers similar fields except armor reduction. Additionally it displays the initial damage with a green fading text above the target. To get rid of the little dude and the sound, simply replace the default buff with a custom empty buff.

Hope one of these help you.
 
Status
Not open for further replies.
Top