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

[Trigger] Checking for leaks...

Status
Not open for further replies.
Level 6
Joined
May 13, 2013
Messages
111
Guys I'm making a system that when a player types -s he will be teleported to the shop. And if he presses `esc` he will go back to his last position. Can you check the leaks for me? I'm not 100% sure it's leakless.
  • Enter Shop
    • Events
      • Player - Player 2 (Blue) types a chat message containing -s as An exact match
      • Player - Player 3 (Teal) types a chat message containing -s as An exact match
      • Player - Player 4 (Purple) types a chat message containing -s as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -s as An exact match
      • Player - Player 6 (Orange) types a chat message containing -s as An exact match
      • Player - Player 8 (Pink) types a chat message containing -s as An exact match
      • Player - Player 9 (Gray) types a chat message containing -s as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -s as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -s as An exact match
      • Player - Player 12 (Brown) types a chat message containing -s as An exact match
    • Conditions
      • In_Shop Equal to False
    • Actions
      • Set In_Shop = True
      • Set Player_UNITS_GLOBAL = (Units in (Playable map area) owned by (Triggering player))
      • Trigger - Run ShopEnterMessage <gen> (ignoring conditions)
      • Unit Group - Pick every unit in Player_UNITS_GLOBAL and do (Actions)
        • Loop - Actions
          • Set LastPosition[(Player number of (Triggering player))] = (Position of (Picked unit))
          • Unit - Move (Picked unit) instantly to (Center of Shop <gen>)
      • Custom script: call DestroyGroup(udg_Player_UNITS_GLOBAL)
  • LeaveShop
    • Events
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
      • Player - Player 11 (Dark Green) skips a cinematic sequence
      • Player - Player 12 (Brown) skips a cinematic sequence
    • Conditions
    • Actions
      • Set In_Shop = False
      • Set Player_UNITS_GLOBAL = (Units in (Playable map area) owned by (Triggering player))
      • Cinematic - Clear the screen of text messages for (Player group((Triggering player)))
      • Unit Group - Pick every unit in Player_UNITS_GLOBAL and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to LastPosition[(Player number of (Owner of (Picked unit)))]
      • Custom script: call DestroyGroup(udg_Player_UNITS_GLOBAL)
 
After he leaves the shop you have to remove the location that is stored in the array.

Also anything used twice or more should be stored in a variable and the variable should be used. Example Store this in a variable before the loop. (Player number of (Owner of (Picked unit)))
You should also change (Owner of (Picked unit)) to triggering player.

Since using this in a loop it gets overwritten every time the loop runs. So it leaks all of them except the last one.
  • Set LastPosition[(Player number of (Triggering player))] = (Position of (Picked unit))
Use a unit indexer and store the units locations in the array index based on the units custom value to make it not leak.

This is also not MPI. So it can only be used by one player at any given time. So if I was player one I could use it once at beginning and stop all other players from ever using it again.
 
Level 6
Joined
May 13, 2013
Messages
111
After he leaves the shop you have to remove the location that is stored in the array.

Also anything used twice or more should be stored in a variable and the variable should be used. Example Store this in a variable before the loop. (Player number of (Owner of (Picked unit)))
You should also change (Owner of (Picked unit)) to triggering player.

Since using this in a loop it gets overwritten every time the loop runs. So it leaks all of them except the last one.
  • Set LastPosition[(Player number of (Triggering player))] = (Position of (Picked unit))
Use a unit indexer and store the units locations in the array index based on the units custom value to make it not leak.

This is also not MPI. So it can only be used by one player at any given time. So if I was player one I could use it once at beginning and stop all other players from ever using it again.

Can you show me an example? And what's a Unit Indexer and MPI? I'm unfamiliar with this.
 
Unit indexer is found on here. It is a system made by bribe.

MPI means multiple player instanceable.
That means that each player can use the same spell / system / triggers at the same time.

MUI means multiple unit instanceable.
That means that each and every unit can use the same spell / system / triggers at the same time.

Check out my tutorial things you should know when using triggers / gui. The chapter how to index shows you how to make MUI spells.
This would only need to be MPI.
So everything needs to be an array.
You need a unit group array, and a boolean array to tell if the player has teleported already.
You also need a location array. This however will store the units based on the units custom value. Since this cannot be MPI it needs to be MUI.

If you need a better explanation it will take me a little bit. But I can show you how you should do this.
 
Level 6
Joined
May 13, 2013
Messages
111
Unit indexer is found on here. It is a system made by bribe.

MPI means multiple player instanceable.
That means that each player can use the same spell / system / triggers at the same time.

MUI means multiple unit instanceable.
That means that each and every unit can use the same spell / system / triggers at the same time.

Check out my tutorial things you should know when using triggers / gui. The chapter how to index shows you how to make MUI spells.
This would only need to be MPI.
So everything needs to be an array.
You need a unit group array, and a boolean array to tell if the player has teleported already.
You also need a location array. This however will store the units based on the units custom value. Since this cannot be MPI it needs to be MUI.

If you need a better explanation it will take me a little bit. But I can show you how you should do this.

Ok, well that reveals everything I don't know... I will show you the triggers later. Thanks Deathismyfriend..:ogre_hurrhurr:
 
Level 6
Joined
May 13, 2013
Messages
111
Here you go I made the triggers for you. With all leaks cleared.

I don't know the reason why I can only enter the shop but can't leave. Here's the triggers:
  • Enter Shop
    • Events
      • Player - Player 2 (Blue) types a chat message containing -s as An exact match
      • Player - Player 3 (Teal) types a chat message containing -s as An exact match
      • Player - Player 4 (Purple) types a chat message containing -s as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -s as An exact match
      • Player - Player 6 (Orange) types a chat message containing -s as An exact match
      • Player - Player 8 (Pink) types a chat message containing -s as An exact match
      • Player - Player 9 (Gray) types a chat message containing -s as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -s as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -s as An exact match
      • Player - Player 12 (Brown) types a chat message containing -s as An exact match
    • Conditions
      • Already_In_Shop[(Player number of (Triggering player))] Equal to False
    • Actions
      • Set TempPlayer = (Triggering player)
      • Set TempInt = (Player number of TempPlayer)
      • Set Already_In_Shop[TempInt] = True
      • Unit Group - Pick every unit in PlayerUnits and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of TempUnit) Equal to TempPlayer
            • Then - Actions
              • Unit Group - Add TempUnit to UnitGroupToShop[TempInt]
              • Set TempInt2 = (Custom value of TempUnit)
              • Set LastPosition[TempInt2] = (Position of TempUnit)
              • Unit - Move TempUnit instantly to (Center of Shop <gen>)
              • Trigger - Run ShopEnterMessage <gen> (ignoring conditions)
            • Else - Actions
  • LeaveShop
    • Events
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
      • Player - Player 11 (Dark Green) skips a cinematic sequence
      • Player - Player 12 (Brown) skips a cinematic sequence
    • Conditions
      • Already_In_Shop[(Player number of (Triggering player))] Equal to True
    • Actions
      • Set TempPlayer = (Triggering player)
      • Set TempInt = (Player number of TempPlayer)
      • Set Already_In_Shop[TempInt] = False
      • Unit Group - Pick every unit in UnitGroupToShop[TempInt] and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Unit Group - Remove TempUnit from UnitGroupToShop[TempInt]
          • Set TempInt2 = (Custom value of TempUnit)
          • Unit - Move TempUnit instantly to LastPosition[TempInt2]
          • Custom script: call RemoveLocation(udg_LastPosition[udg_TempInt2])
 
Level 6
Joined
May 13, 2013
Messages
111
This leaks.
  • Unit - Move TempUnit instantly to (Center of Shop <gen>)
This should only be run once. Trigger - Run ShopEnterMessage <gen> (ignoring conditions)
Not one time for every unit.

What did you set this variable to in the variable editor ? UnitGroupToShop

The
  • Trigger - Run SHopEnterMessage <gen> (ignoring conditions)
will only show to the player who accessed the shop. So what should i do to fix this?
 
Remove the trigger and do this.

  • Teleport To Shop
    • Events
      • Player - Player 1 (Red) types a chat message containing -S as An exact match
      • Player - Player 2 (Blue) types a chat message containing -S as An exact match
      • Player - Player 3 (Teal) types a chat message containing -S as An exact match
      • Player - Player 4 (Purple) types a chat message containing -S as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -S as An exact match
      • Player - Player 6 (Orange) types a chat message containing -S as An exact match
      • Player - Player 7 (Green) types a chat message containing -S as An exact match
      • Player - Player 8 (Pink) types a chat message containing -S as An exact match
      • Player - Player 9 (Gray) types a chat message containing -S as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -S as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -S as An exact match
      • Player - Player 12 (Brown) types a chat message containing -S as An exact match
    • Conditions
      • TeleToShopBool[(Player number of (Triggering player))] Equal to True
    • Actions
      • Set tempPlayer = (Triggering player)
      • Set tempInteger = (Player number of tempPlayer)
      • Set TeleToShopBool[tempInteger] = False
      • Unit Group - Pick every unit in AllUnitsInMapUnitGroup and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of tempUnit) Equal to tempPlayer
            • Then - Actions
              • Unit Group - Add tempUnit to TeleToShopPlayerUnitGroups[tempInteger]
              • Set tempInteger2 = (Custom value of tempUnit)
              • Set TeleToShopOriginalLocations[tempInteger2] = (Position of tempUnit)
              • Unit - Move tempUnit instantly to ShopLocation
              • Set tempPlayerGroup = (Player group(tempPlayer))
              • Game - Display to tempPlayerGroup the text: You have entered th...
              • Custom script: call DestroyForce(udg_tempPlayerGroup)
            • Else - Actions
Also create a ShopLocation point and store the location at 0.00 elapsed game time. Never delete or set the point again.
 
Level 6
Joined
May 13, 2013
Messages
111
Remove the trigger and do this.

  • Teleport To Shop
    • Events
      • Player - Player 1 (Red) types a chat message containing -S as An exact match
      • Player - Player 2 (Blue) types a chat message containing -S as An exact match
      • Player - Player 3 (Teal) types a chat message containing -S as An exact match
      • Player - Player 4 (Purple) types a chat message containing -S as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -S as An exact match
      • Player - Player 6 (Orange) types a chat message containing -S as An exact match
      • Player - Player 7 (Green) types a chat message containing -S as An exact match
      • Player - Player 8 (Pink) types a chat message containing -S as An exact match
      • Player - Player 9 (Gray) types a chat message containing -S as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -S as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -S as An exact match
      • Player - Player 12 (Brown) types a chat message containing -S as An exact match
    • Conditions
      • TeleToShopBool[(Player number of (Triggering player))] Equal to True
    • Actions
      • Set tempPlayer = (Triggering player)
      • Set tempInteger = (Player number of tempPlayer)
      • Set TeleToShopBool[tempInteger] = False
      • Unit Group - Pick every unit in AllUnitsInMapUnitGroup and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of tempUnit) Equal to tempPlayer
            • Then - Actions
              • Unit Group - Add tempUnit to TeleToShopPlayerUnitGroups[tempInteger]
              • Set tempInteger2 = (Custom value of tempUnit)
              • Set TeleToShopOriginalLocations[tempInteger2] = (Position of tempUnit)
              • Unit - Move tempUnit instantly to ShopLocation
              • Set tempPlayerGroup = (Player group(tempPlayer))
              • Game - Display to tempPlayerGroup the text: You have entered th...
              • Custom script: call DestroyForce(udg_tempPlayerGroup)
            • Else - Actions
Also create a ShopLocation point and store the location at 0.00 elapsed game time. Never delete or set the point again.

Did this but I can't still leave the shop.
 
Level 6
Joined
May 13, 2013
Messages
111
Can you show me your new triggers also put some game messages to display values. That way you can see what is and is not running.

Also what number did you set the unit group array to in the variable editor ?
In the unit group array it is 1.

Here is the triggers:
  • Enter Shop
    • Events
      • Player - Player 2 (Blue) types a chat message containing -s as An exact match
      • Player - Player 3 (Teal) types a chat message containing -s as An exact match
      • Player - Player 4 (Purple) types a chat message containing -s as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -s as An exact match
      • Player - Player 6 (Orange) types a chat message containing -s as An exact match
      • Player - Player 8 (Pink) types a chat message containing -s as An exact match
      • Player - Player 9 (Gray) types a chat message containing -s as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -s as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -s as An exact match
      • Player - Player 12 (Brown) types a chat message containing -s as An exact match
    • Conditions
      • In_Shop[(Player number of (Triggering player))] Equal to False
    • Actions
      • Set TempPlayer = (Triggering player)
      • Set TempInt = (Player number of TempPlayer)
      • Set In_Shop[TempInt] = True
      • Unit Group - Pick every unit in PlayerUnits and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of TempUnit) Equal to TempPlayer
            • Then - Actions
              • Unit Group - Add TempUnit to ToShopUnitGroup[TempInt]
              • Set TempInt2 = (Custom value of TempUnit)
              • Set LastPosition[TempInt2] = (Position of TempUnit)
              • Unit - Move TempUnit instantly to ShopLocation
              • Set TempPlayerGroup = (Player group(TempPlayer))
              • Set TempString = You have entered the Shop. PVP is not allowed in area. Press 'Esc' to go back to your last position.
              • Game - Display to TempPlayerGroup for 99999.00 seconds the text: (|cffffcc00 + (TempString + |r))
              • Custom script: call DestroyForce(udg_TempPlayerGroup)
            • Else - Actions
  • LeaveShop
    • Events
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
      • Player - Player 11 (Dark Green) skips a cinematic sequence
      • Player - Player 12 (Brown) skips a cinematic sequence
    • Conditions
      • In_Shop[(Player number of (Triggering player))] Equal to True
    • Actions
      • Set TempPlayer = (Triggering player)
      • Set TempInt = (Player number of TempPlayer)
      • Set In_Shop[TempInt] = False
      • Cinematic - Clear the screen of text messages for (Player group(TempPlayer))
      • Unit Group - Pick every unit in ToShopUnitGroup[TempInt] and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Unit Group - Remove TempUnit from ToShopUnitGroup[TempInt]
          • Set TempInt2 = (Custom value of TempUnit)
          • Unit - Move TempUnit instantly to LastPosition[TempInt2]
          • Custom script: call RemoveLocation(udg_LastPosition[udg_TempInt2])
EDIT: NVM, I fixed it. Just changed the array of the unit group to 12. Thanks a lot deathismyfriend. :D
 
Status
Not open for further replies.
Top