• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Does this trigger have any leaks?

Status
Not open for further replies.
Level 8
Joined
Jul 17, 2004
Messages
283
Is this knockback trigger leak free?

  • Dash Knockback
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dash
    • Actions
      • Set Dash_Caster = (Triggering unit)
      • Set Dash_Target = (Target unit of ability being cast)
      • Set Dash_Location = (Position of Dash_Caster)
      • Trigger - Turn on Dash Push <gen>
      • Wait 1.00 game-time seconds
      • Trigger - Turn off Dash Push <gen>
      • Custom script: call RemoveLocation(udg_Dash_Location)
  • Dash Push
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit - Move Dash_Target instantly to (Dash_Location offset by ((Distance between Dash_Location and (Position of Dash_Target)) + 5.00) towards (Angle from Dash_Location to (Position of Dash_Target)) degrees)
 
Level 8
Joined
Jul 17, 2004
Messages
283
How would I go about removing that leak? And what would the custom script for removing it be?
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Translating DIMF's idea :
  • Set Dash = (Position Of Caster)
  • Set TempPoint = (Distance between Dash_Location and Dash) + 5.00) towards (Angle from Dash_Location to Dash) degrees)
  • Unit - Move Dash_Target instantly to TempPoint
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Custom script: call RemoveLocation(udg_Dash)
. That's if you didn't understand .
 
Are you going to want to use this on more than one unit in the map at once. Cause if two units within that wait use it the spell will bug.

Edit: If you use this.
Translating DIMF's idea :
  • Set Dash = (Position Of Caster)
  • Set TempPoint = (Distance between Dash_Location and Dash) + 5.00) towards (Angle from Dash_Location to Dash) degrees)
  • Unit - Move Dash_Target instantly to TempPoint
  • Custom script: call RemoveLocation(udg_TempPoint)
  • Custom script: call RemoveLocation(udg_Dash)
. That's if you didn't understand .

With this solution it won't bug as much although your trigger will still suffer being turned off if another unit uses the same spell at once at the wrong point.
 
Level 8
Joined
Jul 17, 2004
Messages
283
ooo wow i didnt even notice that this wasnt an instant spell.

@X-death
this needs to be indexed to work for more than one unit.
If u dont know how to do that look at my tutorial things a GUIer should know.

@poke
yes it is RemoveLocation()
sry about that

@jonhysone
just use tempPoint1 and tempPoint2

I need help making my trigger(s) indexed/MUI. How would I set it up?
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
I need help making my trigger(s) indexed/MUI. How would I set it up?

If you want your spell MUI . You need to create a hashtable and saving variables in the hashtable for each player . Or , Using Death's idea which is indexing , You need you variables arrayed but you need to recreate your triggers because they will be off after adding arrays . For Example :
  • Set Player_Number = (Player Number of (Owner of(Triggering Unit)))
  • Set Caster[Player_Number] = (Triggering Unit)
 
Level 8
Joined
Jul 17, 2004
Messages
283
Is there a tutorial or something? I don't quite understand how to apply this to my ability.

I don't think using Hashtables for players will work, because each player could possibly own up to 3 of the same unit.
 
If you want your spell MUI . You need to create a hashtable and saving variables in the hashtable for each player . Or , Using Death's idea which is indexing , You need you variables arrayed but you need to recreate your triggers because they will be off after adding arrays . For Example :
  • Set Player_Number = (Player Number of (Owner of(Triggering Unit)))
  • Set Caster[Player_Number] = (Triggering Unit)

using hashtables is slower than indexing.

the blood linked the chapter in my tutorial that will teach u how to index and make things mui

edit:

the chapter how to index is a template thats how u should structure it to make it MUI.
the variables can be changed. Just follow the structure
 
Level 8
Joined
Jul 17, 2004
Messages
283
using hashtables is slower than indexing.

the blood linked the chapter in my tutorial that will teach u how to index and make things mui

edit:

the chapter how to index is a template thats how u should structure it to make it MUI.
the variables can be changed. Just follow the structure

I'll give it a shot. Sec, then.
 
Level 8
Joined
Jul 17, 2004
Messages
283
temp variables like tempInt are standard temporary variables that can be used in all triggers.

just create a tempInt variable with no initialization.

Wow, I think I got it working. Is this correct? The only thing I haven't done is remove any leaks.

Deathismyfriend, you're a very good teacher/tutorial writer/code mentor.

What's leaking, and how do I remove them?

  • Dash Knockback
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dash
    • Actions
      • Set maxIndexDash = (maxIndexDash + 1)
      • Set casterUnitsIndexDash[maxIndexDash] = (Triggering unit)
      • Set targetUnitsIndexDash[maxIndexDash] = (Target unit of ability being cast)
      • Set locationUnitsIndexDash[maxIndexDash] = (Position of casterUnitsIndexDash[maxIndexDash])
      • Set timeLeftDash[maxIndexDash] = 23
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • maxIndexDash Equal to 1
        • Then - Actions
          • Trigger - Turn on Dash Push <gen>
        • Else - Actions
  • Dash Push
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • For each (Integer tempInt) from 1 to maxIndexDash, do (Actions)
        • Loop - Actions
          • Unit - Move targetUnitsIndexDash[tempInt] instantly to (locationUnitsIndexDash[tempInt] offset by ((Distance between locationUnitsIndexDash[tempInt] and (Position of targetUnitsIndexDash[tempInt])) + 5.00) towards (Angle from locationUnitsIndexDash[tempInt] to (Position of targetUnitsIndexDash[tempInt])) degrees)
          • Set timeLeftDash[tempInt] = (timeLeftDash[tempInt] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • timeLeftDash[tempInt] Equal to 0
            • Then - Actions
              • Set casterUnitsIndexDash[tempInt] = casterUnitsIndexDash[maxIndexDash]
              • Set casterUnitsIndexDash[tempInt] = No unit
              • Set targetUnitsIndexDash[tempInt] = targetUnitsIndexDash[maxIndexDash]
              • Set targetUnitsIndexDash[maxIndexDash] = No unit
              • Set maxIndexDash = (maxIndexDash - 1)
              • Set tempInt = (tempInt - 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • maxIndexDash Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 8
Joined
Jul 17, 2004
Messages
283
look at the things that leak tutorial there is a link to it at the bottom of my tutorial.

u need to first store the locations into a variable then use the variable in the gui actions then use the custom script: call RemoveLocation( udg_tempPoint)

Deathismyfriend, I found an error of inefficiency in your tutorial for indexing.

  • Set maxIndexDash = (maxIndexDash - 1)
Apparently there is a more efficient way for checking the Maximum? My knockback ability is breaking with your tutorial applied.





Deathismyfriend, this is what's happening.

Player 1 and Player 2 use the knockback ability close to the same time.

Player 1 uses the knockback ability, the Maximum gets set to 1.
Player 2 uses the knockback ability, the Maximum gets set to 2.
Ability for Player 1 finishes, Maximum gets set back to 1, but the ability is still in motion for Player 2 using the angle from 1.

THIS is why it's breaking. How can I resolve this issue?
 
Level 8
Joined
Jul 17, 2004
Messages
283
Deathismyfriend, how do I prevent this issue from happening?

Here are my triggers:

  • Dash Initialize
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dash
    • Actions
      • Set maxIndexDash = (maxIndexDash + 1)
      • Set casterUnitsIndexDash[maxIndexDash] = (Triggering unit)
      • Set targetUnitsIndexDash[maxIndexDash] = (Target unit of ability being cast)
      • Set locationUnitsIndexDash[maxIndexDash] = (Position of casterUnitsIndexDash[maxIndexDash])
      • Set timeLeftDash[maxIndexDash] = 22
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • maxIndexDash Equal to 1
        • Then - Actions
          • Trigger - Turn on Dash Knockback <gen>
        • Else - Actions
(Initially Off)
  • Dash Knockback
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • For each (Integer tempInt) from 1 to maxIndexDash, do (Actions)
        • Loop - Actions
          • Unit - Move targetUnitsIndexDash[tempInt] instantly to (locationUnitsIndexDash[tempInt] offset by ((Distance between locationUnitsIndexDash[tempInt] and (Position of targetUnitsIndexDash[tempInt])) + 5.00) towards (Angle from locationUnitsIndexDash[tempInt] to (Position of targetUnitsIndexDash[tempInt])) degrees)
          • Set timeLeftDash[tempInt] = (timeLeftDash[tempInt] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • timeLeftDash[tempInt] Equal to 0
            • Then - Actions
              • Set casterUnitsIndexDash[tempInt] = casterUnitsIndexDash[maxIndexDash]
              • Set casterUnitsIndexDash[tempInt] = No unit
              • Set targetUnitsIndexDash[tempInt] = targetUnitsIndexDash[maxIndexDash]
              • Set targetUnitsIndexDash[maxIndexDash] = No unit
              • Set maxIndexDash = (maxIndexDash - 1)
              • Set tempInt = (tempInt - 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • maxIndexDash Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Set casterUnitsIndexDash[tempInt] = casterUnitsIndexDash[maxIndexDash]
  • Set casterUnitsIndexDash[tempInt] = No unit
  • Set targetUnitsIndexDash[tempInt] = targetUnitsIndexDash[maxIndexDash]
  • Set targetUnitsIndexDash[maxIndexDash] = No unit
  • Set maxIndexDash = (maxIndexDash - 1)
  • Set tempInt = (tempInt - 1)

First you correctly reindex the last to replace the expiring one, but then you set the variables to No unit for some reason. Don't do that.
 
Level 8
Joined
Jul 17, 2004
Messages
283
Maker, I was just following deathismyfriend's tutorial. He does that in his tutorial.







Deathismyfriend,

So, in the second trigger, change this variable:

  • timeLeftDash[tempInt] Equal to 0
to

  • timeLeftDash[maxIndexDash] Equal to 0
???




I made this change, but the issue is still occurring. And I will take care of leaks last. I want to make it work first of all.
 
u need to de-index all counters here also.
  • Set casterUnitsIndexDash[tempInt] = casterUnitsIndexDash[maxIndexDash]
  • Set casterUnitsIndexDash[tempInt] = No unit
  • Set targetUnitsIndexDash[tempInt] = targetUnitsIndexDash[maxIndexDash]
  • Set targetUnitsIndexDash[maxIndexDash] = No unit
  • Set maxIndexDash = (maxIndexDash - 1)
  • Set tempInt = (tempInt - 1)
like this
  • Set casterUnitsIndexDash[tempInt] = casterUnitsIndexDash[maxIndexDash]
  • Set casterUnitsIndexDash[tempInt] = No unit
  • Set targetUnitsIndexDash[tempInt] = targetUnitsIndexDash[maxIndexDash]
  • Set targetUnitsIndexDash[maxIndexDash] = No unit
  • Set timeLeftDash[tempInt] = Set timeLeftDash[maxIndexDash]
  • Set timeLeftDash[maxIndexDash] = 0
  • Set maxIndexDash = (maxIndexDash - 1)
  • Set tempInt = (tempInt - 1)
@Maker
i always say to null the objects when they arent used. In spells who know when that index will be used again it might not be for a long time so its better to null them IMO.
 
Level 8
Joined
Jul 17, 2004
Messages
283
deathismyfriend, it appears to be working now.

It bugs if I have 'timeLeftDash[tempInt] Equal to 0' set to 'timeLeftDash[maxIndexDash] Equal to 0' like you suggested though. Is it okay if I leave the array as 'tempInt'?

Here are my triggers.

  • Dash Knockback
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dash
    • Actions
      • Set maxIndexDash = (maxIndexDash + 1)
      • Set casterUnitsIndexDash[maxIndexDash] = (Triggering unit)
      • Set targetUnitsIndexDash[maxIndexDash] = (Target unit of ability being cast)
      • Set locationUnitsIndexDash[maxIndexDash] = (Position of casterUnitsIndexDash[maxIndexDash])
      • Set timeLeftDash[maxIndexDash] = 23
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • maxIndexDash Equal to 1
        • Then - Actions
          • Trigger - Turn on Dash Push <gen>
        • Else - Actions
  • Dash Push
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • For each (Integer tempInt) from 1 to maxIndexDash, do (Actions)
        • Loop - Actions
          • Unit - Move targetUnitsIndexDash[tempInt] instantly to (locationUnitsIndexDash[tempInt] offset by ((Distance between locationUnitsIndexDash[tempInt] and (Position of targetUnitsIndexDash[tempInt])) + 5.00) towards (Angle from locationUnitsIndexDash[tempInt] to (Position of targetUnitsIndexDash[tempInt])) degrees)
          • Set timeLeftDash[tempInt] = (timeLeftDash[tempInt] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • timeLeftDash[tempInt] Equal to 0
            • Then - Actions
              • Set casterUnitsIndexDash[tempInt] = casterUnitsIndexDash[maxIndexDash]
              • Set casterUnitsIndexDash[tempInt] = No unit
              • Set targetUnitsIndexDash[tempInt] = targetUnitsIndexDash[maxIndexDash]
              • Set targetUnitsIndexDash[maxIndexDash] = No unit
              • Set timeLeftDash[tempInt] = timeLeftDash[maxIndexDash]
              • Set timeLeftDash[maxIndexDash] = 0
              • Set maxIndexDash = (maxIndexDash - 1)
              • Set tempInt = (tempInt - 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • maxIndexDash Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 8
Joined
Jul 17, 2004
Messages
283
Okay.

Hmm, actually there is still one slight issue.

For some reason, if two units use it both close to the same time, one of the targeted units will not go the correct angle all the way. It will be pushed back a bit, but then move to the right or left. Does this have something to do with the offset?
 
Level 8
Joined
Jul 17, 2004
Messages
283
Ah, I didn't even need to do that. I changed the function a bit. This works flawlessly.

  • Unit - Move targetUnitsIndexDash[tempInt] instantly to ((Position of targetUnitsIndexDash[tempInt]) offset by 8.00 towards (Facing of casterUnitsIndexDash[tempInt]) degrees)
 
If you want your spell MUI . You need to create a hashtable and saving variables in the hashtable for each player . Or , Using Death's idea which is indexing , You need you variables arrayed but you need to recreate your triggers because they will be off after adding arrays . For Example :
  • Set Player_Number = (Player Number of (Owner of(Triggering Unit)))
  • Set Caster[Player_Number] = (Triggering Unit)

Ahem. Speaking of MUI.

Oops I was late. It was already page 3.
 
Change this
  • Unit - Move targetUnitsIndexDash[tempInt] instantly to ((Position of targetUnitsIndexDash[tempInt]) offset by 8.00 towards (Facing of casterUnitsIndexDash[tempInt]) degrees)
To this.
  • Set tmpPointA = (Position of targetUnitsIndexDash[tempInt])
  • Set tmpPointB = (tmpPointA offset by 8.00 towards (Facing of casterUnitsIndexDash[tempInt]) degrees))
  • Custom script: call RemoveLocation(tmpPointA)
  • Unit - Move (Triggering unit) instantly to tmpPointB
  • Custom script: call RemoveLocation(tmpPointB)
Trust me, especialy because it is run periodically this much it will be noticed when the game goes on by someone playing it if used enough times without removing the leak.

Edit: Oh wait you've made a completely new thread that already solved this...
 
Last edited:
Status
Not open for further replies.
Top