• 🏆 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!

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

Status
Not open for further replies.
Level 8
Joined
Dec 1, 2010
Messages
316
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
 

Attachments

  • mymap.w3x
    51.7 KB · Views: 63
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
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.

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
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.

JASS:
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
 
Level 8
Joined
Dec 1, 2010
Messages
316
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.

JASS:
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

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.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
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
as far as i know the last created floating text changes when a new one is created.
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.
 
Level 8
Joined
Dec 1, 2010
Messages
316
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 .
 
Level 8
Joined
Dec 1, 2010
Messages
316
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.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
so i have to keep the wait and then destroy it?
No you don't need the wait. Destroying the floating text doesn't mean it will go away immediately.

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.
Well of course it will. You have two same events that are going to run immediately after one another.
 
Level 8
Joined
Dec 1, 2010
Messages
316
No you don't need the wait. Destroying the floating text doesn't mean it will go away immediately.
okay, I get it now. Thank you!


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

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.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
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
 
Level 8
Joined
Dec 1, 2010
Messages
316
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
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!
 
Status
Not open for further replies.
Top