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

Trying a counter helix for any instance of damage

Status
Not open for further replies.
Level 4
Joined
Apr 15, 2016
Messages
61
Recently I asked if it was possible to set a variable into another variable for this reason (World Editor Help Zone)
  • Counter Helix
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Counter Helix for GDD_DamagedUnit) Greater than 0
        • Then - Actions
          • Set HelixStartIndex = (HelixStartIndex + 1)
          • Set HelixUnit[HelixStartIndex] = GDD_DamagedUnit
          • Unit - Pause HelixUnit[HelixStartIndex]
          • Animation - Change HelixUnit[HelixStartIndex]'s animation speed to 250.00% of its original speed
          • Custom script: call SetUnitAnimationByIndex(udg_HelixUnit[udg_HelixStartIndex], 10)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 250.00 of (Position of GDD_DamagedUnit) matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of GDD_DamagedUnit)) Equal to True)) and (((Matching unit) is alive) Equal to True))) and do (Actions)
            • Loop - Actions
              • Unit - Cause GDD_DamagedUnit to damage (Picked unit), dealing 50.00 damage of attack type Hero and damage type Normal
          • Wait 0.30 seconds
          • Set HelixEndIndex = (HelixEndIndex + 1)
          • Animation - Change HelixUnit[HelixEndIndex]'s animation speed to 100.00% of its original speed
          • Unit - Unpause HelixUnit[HelixEndIndex]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HelixEndIndex Equal to HelixStartIndex
            • Then - Actions
              • Set HelixEndIndex = 0
              • Set HelixStartIndex = 0
            • Else - Actions
        • Else - Actions
The spell is working normally. EXCEPT for what I know you're thinking right now. Yes, if there are two (or more) units of the same type (with counter helix) when they spin they cause damage and the damage they cause trigger the other helix, which triggers another helix, another HELIx and the game just closes itself.

Is there anyway I can fix this ? Giving Cooldown ? Making it not active when the damage came from a helix ? These are possible ways, but I don't have an IDEA how to do so.

NOTE: I suck at Jass.
NOTE2: If you find any leak or any variable or action mistake you're free to tell.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Turn the trigger off at the beggining, and then turn it back on at the very end.

This. Also, you leak a location handle when you create the unit group - "(Position of GDD_DamagedUnit)"

On a side note, this spell wouldn't have required any type of indexing if it weren't for that 0.3 second wait. Is it necessary? If you just want to stick with the wait without having to create a second periodic trigger, you will need to use locals.
 
Level 4
Joined
Apr 15, 2016
Messages
61
You need to detect the source to prevent infinite loop.

This was one of the ideas. If the damage you take came from another unit of the same type then it would not trigger. But I didn't want it to be like that. I wanted to EVEN if you take damage from Helix you would spin, (so basically the concept is broken even on my mind). But maybe adding a Cooldown, so when you spin and deal damage, the other one would spin dealing damage to the first one but this wouldn't spin back (it would be in CD). But I have no idea how to trigger a CD.

Turn the trigger off at the beggining, and then turn it back on at the very end.

How ? o_O

On a side note, this spell wouldn't have required any type of indexing if it weren't for that 0.3 second wait. Is it necessary?.

The wait is for the animation. If the hero is playing any animation, like, attacking, this animation will not play (or will play but hardly noticed if he is doing any other animation). So I paused him to play this animation correctly and then unpause him later.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485

  • Counter Helix
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off Counter Helix
      • -------- do stuff --------
      • Trigger - Turn on Counter Helix
With the trigger off, it will prevent the Unit - Damage Target event from firing the trigger again.

The wait is for the animation. If the hero is playing any animation, like, attacking, this animation will not play (or will play but hardly noticed if he is doing any other animation). So I paused him to play this animation correctly and then unpause him later.
You will probably need to use locals then if there can be multiple instances of the passive running at once.

Also, your... indexing seems a little awkward o_O where did you learn that?
 
Level 18
Joined
May 11, 2012
Messages
2,103

Just use actions as KILLCIDE showed you that I was too lazy to do haha.

Also, your... indexing seems a little awkward o_O where did you learn that?

It's an old indexing method...he prolly googled that up.

Edit: Actually no, it is an indexing method by Magtheridon96 that incorporates waits into the trigger, but keeps MUI-ness I think.

You also can move that ITE condition into trigger condition block, and get rid of that ITE as it is very needless to have it there since you have nothing in Else block.
 
Level 4
Joined
Apr 15, 2016
Messages
61
  • Counter Helix
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off Counter Helix
      • -------- do stuff --------
      • Trigger - Turn on Counter Helix

It worked o_O

Wait, WHAT ? HOW THE HELL DID THIS WORK ?

Yes, Maggie way keep this MUI. But I don't know if my copy Maggie way does the same.
 
Level 18
Joined
May 11, 2012
Messages
2,103
It worked o_O

Wait, WHAT ? HOW THE HELL DID THIS WORK ?

You have a trigger with even that fires when somebody gets damaged.

When this trigger fires, you are damaging a unit(s), and since this trigger responds to taking damage, it re-fires again.

With this turn off/on actions, the trigger will fire on damageTaken, and then it will turn off itseld, preventing further executions, but won't interrupt current execution. Now when you damage the unit with action in this trigger, this trigger won't fire since it is turned off. And at the very end, when you already dealt the damage, the trigger will get turned back on.

Hopefully this clears some things up.
 
Level 4
Joined
Apr 15, 2016
Messages
61
Yes I understood, but I didn't know it didn't interrupt the current execution

So I can use that Off and On for any other trigger that may cause infinite loops like this one ?
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Wait, WHAT ? HOW THE HELL DID THIS WORK ?

Imagine it like this:
  1. Damage detected -> fire Counter Helix instance 1
  2. Deal AoE damage for instance 1
    • Damage detected from instance 1 AoE damage -> fire Counter Helix instance 2
    • Deal AoE damage for instance 2
      • Damage detected from instance 2 AoE damage... so on

With the trigger disabled, it basically stops the AoE damage (Unit - Damage Target function) from starting another instance until the current one is done since you re-enable the trigger at the very end.

Yes I understood, but I didn't know it didn't interrupt the current execution
"Trigger - Turn off" just stops the trigger from starting another event. It doesn't disable current actions. You're probably mixing up this function with the "Skip remaining actions" function.
 
Status
Not open for further replies.
Top