Damage Buff, each time unit attacks, issues

Kelv

TH.net Regular
Reaction score
7
When the trigger goes off for the first time, it freezes the game for a half a second or something. Also, I have some floating text, it is always showing the damage doing 10 less then what I wanted it to do.

The abilities are based off of Beserk for buff, and the item ability damage bonus.

Code:
Sharpen Blades
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Savage
        (Level of Berserk for (Attacking unit)) Greater than 0
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Attacking unit) has buff Barbarian ) Equal to True
            Then - Actions
                Set SW_Lvl = (Level of Berserk for (Attacking unit))
                Set SW_DB_Lvl = (Level of Barbarian Damage Bonus  for (Attacking unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Barbarian Damage Bonus  for (Attacking unit)) Greater than 0
                    Then - Actions
                        Wait 0.25 seconds
                        Unit - Set level of Barbarian Damage Bonus  for (Attacking unit) to (SW_DB_Lvl + SW_Lvl)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Barbarian Damage Bonus  for (Attacking unit)) Equal to 0
                            Then - Actions
                                Wait 0.25 seconds
                                Unit - Add Barbarian Damage Bonus  to (Attacking unit)
                                Set SW_DB_Lvl = (Level of Barbarian Damage Bonus  for (Attacking unit))
                                Unit - Set level of Barbarian Damage Bonus  for (Attacking unit) to SW_Lvl
                            Else - Actions
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Barbarian Damage Bonus  for (Attacking unit)) Greater than 0
                    Then - Actions
                        Unit - Cause (Attacking unit) to damage (Attacked unit), dealing ((Real(SW_DB_Lvl)) x 10.00) damage of attack type Spells and damage type Normal
                        Floating Text - Create floating text that reads (+ + (String((SW_DB_Lvl x 10)))) above (Attacked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                        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 0.00 seconds
                        Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
                        Unit - Remove Barbarian Damage Bonus  from (Attacking unit)
                    Else - Actions

Can someone help me with what is wrong, and also, how to fix the lag problem?

It should be adding (whatever the level of the spell is) damage to the hero everytime he attacks a unit, and once he looses the buff, which is after 30 seconds, the next unit he attacks, he will do bonus damage of 10 x however much damage he added.

So if his ability level is 2, and he attacks a unit 5 times, the next unit he hits should do his normal damage, plus 100. My spell makes him do 80 damage, I could try and counter the problem but I'd rather just eliminate it. What I mean by that is that I could just add 1 to SW_DB_Level, at the end, but id rather just figure out why its not working from the start.
 
O

OneEight7eve

Guest
Conditions
(Level of Berserk for (Attacking unit)) Greater than 0

maybe that messes it up , if the unit attacks and has no beserk.
 

Kelv

TH.net Regular
Reaction score
7
no, beserk is the hero ability, if the hero hasn't learned the ability (beserk) I don't want the spell to go off.
 

vypur85

Hibernate
Reaction score
803
I'm not sure if there is anything wrong or not. The trigger seems ok except this (i think):
Code:
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Barbarian Damage Bonus  for (Attacking unit)) Greater than 0
                    Then - Actions
                        Wait 0.25 seconds
                        [B]Unit - Set level of Barbarian Damage Bonus  for (Attacking unit) to (SW_DB_Lvl + SW_Lvl)[/B]
                    Else - Actions
To set ability level, i think you'd need to remove it first then add it again. But im not sure whether if that is the cause of the problem. And have you checked that your Attack Damage Bonus has increased properly? What is the indicator that shows you that it indeed leveled up? And why the waits? Just remove them and see whether it works or not.
 

Kelv

TH.net Regular
Reaction score
7
I can tell what lvl the damage bonus is at because my stats will say something like 33-55 + 11 (that means its at lvl 11) I have 30 levels, each adds the damage up from one, starting with 1. The waits are because attacks seem to register about .25 seconds (im not sure what the exact time is, im sure someone has measured it) otherwise, the hero will actually get the damage bonus before the damage is done, and the attack-animation is finished.
 

vypur85

Hibernate
Reaction score
803
Sorry. Misunderstood your question. I didn't realised that you only want to reduce the lag. To reduce it, add this:

Code:
Untitled Trigger 002
    Events
        Map initialization
    Conditions
    Actions
        Set Temp_Point = (Random point in (Playable map area))
        Unit - Create 1 Footman for Neutral Passive at Temp_Point facing Default building facing degrees
        Unit - Add Barbarian Damage Bonus  to (Last created unit)
        Unit - Remove (Last created unit) from the game
        Custom script:   call RemoveLocation (udg_Temp_Point)

This will take off the lag. Actually the lag occur because the ability (Barb Damage Bonus) is first loaded to the unit. By adding this trigger, the ability is preloaded before the game starts.
 

Metov

New Member
Reaction score
4
if i understand this correctly, i think it could be done easier with 2 triggers. first one being the attack buff, second one for casting the final attack buff.

second one is quickest...
Unit uses ability
Ability equal to Berserk

Wait 1 seconds
Wait for condition (Casting unit has Buff Barbarian = False)
Create Unit dummy at position of Casting unit
Order Last Created Unit to Human Priest - Inner Fire Casting unit

(Inner Fire is the base for a dummy ability that adds the second buff)


now the first (main) one

Unit is Attacked

(no condition) or use attacking unit = savage

If (attacking unit has buff Berserk)
Order Attacking Unit to Damage Attacked Unit for (SW_DB_Lvl + (Level of Berserk for attacking Unit), damage type normal.. (not sure of the exact arguments here)
set SW_DB_Lvl = Sw_DB_Lvl +(Level of berserk for attacking unit)

If (attacking unit has buff inner fire)
order attacking unit to damage attacked unit for (sw_db_lvl *10)
(floating text here)
set dw_db_lvl = 0

that should work, unless i missed something


EDIT: i didnt see you wanted only to reduce the lag, but this shouldnt lag it at all.
 

Somatic

You can change this now in User CP.
Reaction score
84
Can i ask how many levels is that Damage bonus ability?
And yes, vypur85 has answered the problem for the lag.
Another idea of not removing the ability from the unit is by "player - Disable Spell for player" and the "Player - Enable Spell for Player" That works too and does not need any waits
 

The Undaddy

Creating with the power of rage
Reaction score
55
I'm not 100% sure,but I think it's impossible to level an item ability,like with Item life bonus,level one gives 50,level two gives 100.*If you level the ability it will still add 50.But when you remove the ability it will remove 100,leaving the unit with 50 hitpoints less than it had initially.Weird :nuts:

*Not rly,just an ex.
 

vypur85

Hibernate
Reaction score
803
>Can i ask how many levels is that Damage bonus ability?
I can tell what lvl the damage bonus is at because my stats will say something like 33-55 + 11 (that means its at lvl 11) I have 30 levels, each adds the damage up from one, starting with 1.

I'm not 100% sure,but I think it's impossible to level an item ability,like with Item life bonus,level one gives 50,level two gives 100.*If you level the ability it will still add 50.But when you remove the ability it will remove 100,leaving the unit with 50 hitpoints less than it had initially.Weird
Happened to me before as well :p. But in this case, the ability worked fine. I've tested it :). The ability leveled up according to trigger. (But i'm not sure what will happen if the attack proceeds to more than 30 times as there is no level 31. Maybe should add another condition in the trigger).

Edit:
Actually the problem is still not really solved:
Also, I have some floating text, it is always showing the damage doing 10 less then what I wanted it to do.

So if his ability level is 2, and he attacks a unit 5 times, the next unit he hits should do his normal damage, plus 100. My spell makes him do 80 damage, I could try and counter the problem but I'd rather just eliminate it. What I mean by that is that I could just add 1 to SW_DB_Level, at the end, but id rather just figure out why its not working from the start.

Actually i'm still confused with the question :p. Maybe just add the 1 and let that be? As far as i know, the trigger runs right after the hero starts swinging its weapon (not after the weapon hits the target). So, maybe you've miscalculated the amount of attacks it made? It should be correct i guess.
 

vypur85

Hibernate
Reaction score
803
Err... Up to you? If you want to avoid that 0.5 second lag on first cast? (The lag only occurs with abilities which are added through triggers. Existing abilities on units don't lag it).
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top