1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] 5 basic attacks pasive skill.(use of gui damage detection system)

Discussion in 'Triggers & Scripts' started by vlekje5, Aug 4, 2016.

  1. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    So before i show you the trigger. First let me explain what i was trying to do here. So that you can get an understanding of what is wrong.

    My goal was to create a pasive skill. That slows the target every auto, and on the fifth auto freezes them into an iceberg.

    So in order to do this i have to keep track of the number of attacks done against a target.

    to do so i used weedle's damage detection system.

    right now my goal is to log the number of the attack above a units head whenever it is attacked.

    However with my current scripts it displays both one and two above the units head after the FIRST attack and continiues to do so.

    this is my trigger. If anyone has any idea what i should do to resolve this, i'd Love to hear it. I'm by no stretch of the imagination a skilled triggerer. But i'd love to get better at it, and learn what i'm doing wrong.

    • attack one
      • Events
        • Game - GDD_Event becomes Equal to 0.00
      • Conditions
        • GDD_DamageSource Equal to Protagonist 0000 <gen>
      • Actions
        • Unit - Add custom slow to GDD_DamagedUnit
        • Set slowedunit = GDD_DamagedUnit
        • Floating Text - Create floating text that reads 1 above slowedunit with Z offset 0.00, using font size 15.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Trigger - Turn on attack two <gen>
        • Wait 1.00 seconds
        • Unit - Remove custom slow from slowedunit
        • Floating Text - Destroy (Last created floating text)




    • attack two
      • Events
        • Game - GDD_Event becomes Equal to 0.00
      • Conditions
        • GDD_DamagedUnit Equal to slowedunit
      • Actions
        • Floating Text - Create floating text that reads 2 above slowedunit with Z offset 0.00, using font size 15.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Wait 1.00 seconds
        • Floating Text - Destroy (Last created floating text)



    i also included the map if anyone wants to take a look or test out some minor tweaks.

    Hope you all have a nice evening :p

    [EDIT] ive learnt that the text not removing is caused by the fact that they are created at the same instant. so the removal action that removes the last made floating text can only remove the last one. this means that they are both fired instantly i think
     

    Attached Files:

    Last edited: Aug 4, 2016
  2. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    That wait time is going to screw up a lot of things unless you use locals. If another damage event were to fire, it is possible that slowedunit will not be the same unit you stored on the first attack. Same goes for the floating text.

    Nothing can run simultaneously in WC3, they run in ques. When you create the floating text, (Last created floating text), or
    bj_lastCreatedTextTag
    , is stored into it. That means that
    bj_lastCreatedTextTag
    will be different when you create the second texttag. Since you have that wait time without storing anything into variables or indexing, things will screw up.

    Code (vJASS):
    function CreateTextTagUnitBJ takes string s, unit whichUnit, real zOffset, real size, real red, real green, real blue, real transparency returns texttag
        set bj_lastCreatedTextTag = CreateTextTag()
        call SetTextTagTextBJ(bj_lastCreatedTextTag, s, size)
        call SetTextTagPosUnitBJ(bj_lastCreatedTextTag, whichUnit, zOffset)
        call SetTextTagColorBJ(bj_lastCreatedTextTag, red, green, blue, transparency)

        return bj_lastCreatedTextTag
    endfunction
     
  3. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    that is my goal though.

    i want to set the unit on the first attack. See it as a stacking effect.
    If i attack that same target 4 more times it freezes.
    If i target another target that one becomes the slowedunit. Although it might be better if i resort to doing this using buffs hmm...


    Anyway, i have no idea how JASS works sadly, as far as i know the last created floating text changes when a new one is created.
     
  4. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    You don't need a wait timer to decide when to destroy a floating text. There's a GUI function for it called Floating Text - Change Lifespan:
    • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds


    Lol I don't think you really read my post. It changes because everytime you create a new floating text, (Last created floating text), or
    bj_lastCreatedTextTag
    , as you can see in the jass function I showed you.
     
  5. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    In a normal case both floating texts should be spawned during different auto attacks, The biggest issue is that both spawn upon the first basic attack. and do not go away.

    I changed the code to this now. trying to implement it. At first i did not use the variable in between, but since then both didn't go away i tried it with the variables. However the problem persisted.
    Both do not go away at all with the code being like this.

    • attack one
      • Events
        • Game - GDD_Event becomes Equal to 0.00
      • Conditions
        • GDD_DamageSource Equal to Protagonist 0000 <gen>
      • Actions
        • Unit - Add custom slow to GDD_DamagedUnit
        • Set slowedunit = GDD_DamagedUnit
        • Floating Text - Create floating text that reads 1 above slowedunit with Z offset 0.00, using font size 15.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Set floatingtext1 = (Last created floating text)
        • Floating Text - Change the lifespan of floatingtext1 to 0.50 seconds
        • Trigger - Turn on attack two <gen>
        • Unit - Remove custom slow from slowedunit


    • attack two
      • Events
        • Game - GDD_Event becomes Equal to 0.00
      • Conditions
        • GDD_DamagedUnit Equal to slowedunit
      • Actions
        • Floating Text - Create floating text that reads 2 above slowedunit with Z offset 0.00, using font size 15.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Set floatingtext2 = (Last created floating text)
        • Floating Text - Change the lifespan of floatingtext2 to 0.50 seconds



    on a side note i did read it around 15 times through. That doesn't mean i fully understood it though.
    i tried to understand it as well as i could .
     
  6. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    You still need to destroy the floating text.

    set bj_lastCreatedTextTag = CreateTextTag()
     
  7. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    so i have to keep the wait and then destroy it?

    Does this work in a way that it can only be destroyed via the destroy command if at that point it is at the end of its lifespan?

    Or am i completely retarded yet again? this is exactly what i did. Right now the text 1 and 2 both go away after the set time. However the problem with them being spawned at the same time persists.
     
  8. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    No you don't need the wait. Destroying the floating text doesn't mean it will go away immediately.

    Well of course it will. You have two same events that are going to run immediately after one another.
     
  9. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    okay, I get it now. Thank you!


    Do you have any idea what causes that?

    I thought that the second attack should only be fired if the slowedunit is hit, this is in the conditions. and since i set the slowed unit in my first attack i thought the second one could only fire after the first one.
    The second trigger is also initially not active. It should only be activated when the first trigger has ran.
     
  10. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    What do you mean "what causes that?" You have two of the same events that are going to run immediately after another. Why not just put it in one trigger?
     
  11. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    Both triggers run when a unit takes damage, unlucky for you (or actually lucky because otherwise you wouldnt be here), the first one runs first, setting the attacked unit in the variable and adding the slow debuff.
    The second one runs immediately after that and guess what? the attacked unit is the same as the one on the variable! Wow, it is a miracle!
    Ok, maybe not.

    As Mr. Waddles said, put it in one trigger, check the number of hits the target has taken and increase that/stun the target.
    (I actually have made a very similar spell (Basic attacks slow the target's movement speed by 5% for 4 seconds, stacks up to 5 times. When it reaches maximum stacks, the target is stunned for 2 seconds, this effect cannot occur twice on the same target within 5 seconds.).)
    The concept is simple, just be aware that you have to manage the data of the effect: expiration time of the debuff, possibly the source and ofcourse the number of stacks.

    @KILLCIDE
    Not everyone is a master triggerer... you for example :p
     
  12. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Whaaaaaat.
     
  13. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    You just got triggered... by me :p
     
  14. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    hmm, right now for the slow i use a negative version of endurance aura. Could i maybe count the stacks on a target by leveling the buffs current level + 1 on the target that takes damage for each time it is hit. i could set the levels of the ability to scale harder on each hit. The ability has a built in expiration timer.

    Then i would also have to make a function that checks if the level of the targets slow debuf is 5. If it is 5 the unit should be stunned, If it isn't nothing happens.

    Then i can also add in a sixth level that when reached resets it back to one.

    I'm going to try this out and check if it works if done in the way!
     
  15. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
    You cant check the level of a buff, it just doenst seem to work... yay for Blizzard.
     
  16. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    but i could check the level of the ability no?
     
  17. Wietlol

    Wietlol

    Joined:
    Aug 1, 2013
    Messages:
    4,638
    Resources:
    3
    Spells:
    3
    Resources:
    3
  18. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Yeah it does :p I think the only problem is that buffs can only be level 1. That's how the Unit - Unit Has Specific Buff function works!