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

[Trigger] Confusing Triggering

Status
Not open for further replies.
Level 1
Joined
Dec 5, 2011
Messages
2
Hi, so maybe i'm asking easy things, but for me i'm not so sure hehe. Firstly is this kind of triggering necessary?
  • Call for help Queue
    • Events
    • Conditions
      • GAMEOVER Equal to False
    • Actions
      • Set TempPoint = (Position of AmbushTarget)
      • Visibility - Create an initially Enabled visibility modifier for Player 2 (Blue) emitting Visibility from TempPoint to a radius of 256.00
      • Set VisibilityBenedict = (Last created visibility modifier)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Set TempPoint = (Position of AmbushTarget)
      • Visibility - Create an initially Enabled visibility modifier for Player 9 (Gray) emitting Visibility from TempPoint to a radius of 256.00
      • Set VisibilityBenedict2 = (Last created visibility modifier) Custom script: call RemoveLocation (udg_TempPoint)
      • Set TempPoint = (Center of Surprise Attack Center <gen>)
      • Camera - Set a spacebar-point for Player 2 (Blue) at TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Set TempPoint = (Center of Surprise Attack Center <gen>)
      • Camera - Set a spacebar-point for Player 9 (Gray) at TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Set TempPoint = (Center of Surprise Attack Center <gen>)
      • Cinematic - Ping minimap for (All players controlled by a User player) at TempPoint for 7.00 seconds
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Sound - Setup all volume channels for speech
      • Cinematic - Send transmission to (All players controlled by a User player) from AmbushTarget named Benedict: Play H03VillagerM50 <gen> and display Save us!. Modify duration: Add 0.00 seconds and Wait
      • Sound - Reset all volume channels to 100%
      • Trigger - Remove Call for help Queue <gen> from the trigger queue
to set every time new TempPoint? i guess not right?

Then how about the sounds? i did researches, but they were quite confusing, so is it good to use TempSound system and then remove them? I can't remove them coz don't know the remove command kek.
  • Sleeping Gnoll 1
    • Events
      • Unit - Gnoll 0124 <gen> Takes damage
      • Unit - Gnoll Hut 0072 <gen> Takes damage
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Percentage life of Gnoll 0124 <gen>) Less than 95.00
          • (Percentage life of Gnoll Hut 0072 <gen>) Less than 95.00
    • Actions
      • Trigger - Turn off (This trigger)
      • Set TempSound = GnollPissed2 <gen>
      • Sound - Attach TempSound to (Damage source)
      • Sound - Play TempSound
      • Custom script: call RemoveSound (udg_TempSound)
      • Wait 0.50 seconds
      • Set TempSound = GnollPissed1 <gen>
      • Sound - Attach TempSound to (Damage source)
      • Sound - Play TempSound
      • Custom script: call RemoveSound (udg_TempSound)
      • Wait 1.00 seconds
      • Unit - Remove Dummy (Sleep) 0142 <gen> from the game
      • Wait 1.00 seconds
      • Set TempPoint = (Center of Gnoll Pre Spawn <gen>)
      • Unit - Create 1 Gnoll for Neutral Hostile at TempPoint facing 225.00 degrees
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Set SleepingGnoll1 = (Last created unit)
      • Unit - Make SleepingGnoll1 Remain awake when unprovoked at night
      • Unit - Set SleepingGnoll1 acquisition range to 200.00
      • Unit - Turn collision for SleepingGnoll1 Off
      • Set TempPoint = (Center of Sleeping Gnoll 1 <gen>)
      • Unit - Move SleepingGnoll1 instantly to TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Wait 0.00 seconds
      • Set TempPoint = (Center of Gnoll Alarm 1 <gen>)
      • Unit - Order SleepingGnoll1 to Move To TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Trigger - Turn on Sleeping Gnoll 1 off <gen>
thx in advance for now..

Here is another one. Can't find that does apply camera leak if variable is not used example:
  • Camera - Apply Victory01 <gen> for Player 2 (Blue) over 0.00 seconds
The next problem i have found was that i was not able to play my map anymore the game just ignored it, i think because i put this magic line: Custom script: set bj_wantDestroyGroup = true , to every unitgroup things which says "pick every" command was that wisely done (tried to eliminate leaks) i done it like this:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Make (Picked unit) Invulnerable)
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Order (Picked unit) to Stop)
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Hide (Picked unit))
is there possibly something wrong? except i put that custom script into every unitgroup which used unitgroup variables is that ok?
 
Last edited:
For TempPoints, yes you have to remove them after each location setting. Why? Because think of it this way:

When you set TempPoint to a location, it creates a new location, and that location uses memory. For example:
  • Set TempPoint = (Center of Gnoll Alarm 1 <gen>)
When you get that location, it creates a new location each time. So, for example, these two would not be considered the same handle:
  • Set TempPoint = (Center of Gnoll Alarm 1 <gen>)
  • Set TempPoint2 = (Center of Gnoll Alarm 1 <gen>)
Same location, yet they are two new location handles. So in order to clear the memory associated with those locations, we use call RemoveLocation(udg_TempPoint). If we were to simply set TempPoint to something else, then that location (Center of Gnoll Alarm 1 <gen>) would still be in memory. Since you don't need it in memory anymore, you should remove it before reassigning the variable.

Remember that variables do not necessarily "contain" the data. When you set one to a value, it will only "point" to that value. Therefore, setting it to another value would leave the previous value left in memory. (this does not apply to non-handles, such as booleans, integers, reals, strings, and code variables, however)

-------

For your second trigger, you can generally keep sounds. All the sounds that are added in the sound editor are created upon initialization. When you refer to them, they just point to the global that they were assigned to on initialization. (they don't create a new sound variable) Therefore, you don't have to destroy it. If you do, then if you try to play that sound later on, it won't play. ;)

-----

For the last question, cameras behave the same way.

To ease up the process, you just need to think, "am I creating something each time I call this function?" Usually if it is strictly "Name <gen>" format, then you aren't creating it. For locations, it is not strictly "Name <gen>", it is "Center of Name <gen>" or "Position of Name <gen>", so that means that you must remove it when you are done using it.

However, self-determination of what does create and what does not is a bit harder without knowledge of JASS. For more information, you can just read a leak tutorial as they will give a more thorough explanation of what to watch out for. (there are many tutorials on leaks around this site and others) Good luck. =)
 
Level 11
Joined
Nov 15, 2007
Messages
781
You don't have to do it every time, only when you're setting it to a new point.

For example, you have

  • Set TempPoint = (Position of AmbushTarget)
  • Custom script: call RemoveLocation (udg_TempPoint)
  • Set TempPoint = (Position of AmbushTarget)
Since you're setting the same point twice (Position of AmbushTarget), you don't have to remove the location. You can re-use the variable until you set it to something else, which would be when you do

  • Set TempPoint = (Center of Surprise Attack Center <gen>)
 
Level 1
Joined
Dec 5, 2011
Messages
2
Hi again and thx for helping me! Now i found a very interesting bug, here it is:
  • Set TempPoint = (Center of UnitDelete <gen>)
  • Unit - Order Paladin to Move To TempPoint
  • Wait 1.00 seconds
  • If (IntroSkipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
  • Unit - Order Horse02 to Move To TempPoint
  • Unit - Order Horse02 to Move To TempPoint
  • Unit - Order Horse03 to Move To TempPoint
  • Unit Group - Pick every unit in PaladinsForces and do (Unit - Order (Picked unit) to Move To TempPoint)
  • Custom script: call RemoveLocation (udg_TempPoint)
here is only 1 thing which works and its the when paladin moves to TempPoint and the other guys just idles? :D :O

So i did some changes and this worked fine:
  • Set TempPoint = (Center of UnitDelete <gen>)
  • Unit - Order Paladin to Move To TempPoint
  • Wait 1.00 seconds
  • Custom script: call RemoveLocation (udg_TempPoint)
  • If (IntroSkipped Equal to True) then do (Skip remaining actions) else do (Do nothing)
  • Set TempPoint = (Center of UnitDelete <gen>)
  • Unit - Order Horse02 to Move To TempPoint
  • Unit - Order Horse02 to Move To TempPoint
  • Unit - Order Horse03 to Move To TempPoint
  • Unit Group - Pick every unit in PaladinsForces and do (Unit - Order (Picked unit) to Move To TempPoint)
  • Custom script: call RemoveLocation (udg_TempPoint)
so im wondering what is causing this kind of bug?

The next problem i have found was that i was not able to play my map anymore the game just ignored it, i think because i put this magic line: Cust0m script: set bj_wantDestroyGroup = true , to every unitgroup things which says "pick every" command was that wisely done (tried to eliminate leaks) i done it like this:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Make (Picked unit) Invulnerable)
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Order (Picked unit) to Stop)
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Unit - Hide (Picked unit))
is there possibly something wrong? except i put that custom script into every unitgroup which used unitgroup variables is that ok?
 
Last edited:
Level 29
Joined
Mar 10, 2009
Messages
5,016
- the wait is the problem and it's really bad when using locations coz it usually leaks...
maybe you removed your TempPoint in another trigger during the wait...


- Do not use single lined Picked units but...
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Invulnerable
          • Unit - Order (Picked unit) to Stop
          • Unit - Hide (Picked unit)
 
Status
Not open for further replies.
Top