JASS beginning, doublecheck code.

Effane

Save/Load Code Tutorial
Reaction score
51
Code:
WolvesDenExit
    Events
        Unit - A unit enters WolvesDenExit <gen>
    Conditions
        ((Owner of (Triggering unit)) controller) Equal to User
    Actions
        Set TempPoint = (Center of WolvesDenEntranceSpawn <gen>)
        Camera - Pan camera for (Owner of (Triggering unit)) to TempPoint over 3.00 seconds
        Wait 3.00 game-time seconds
        Unit - Move (Triggering unit) instantly to TempPoint
        Custom script:   Custom Script: call RemoveLocation(udg_TempPoint)

Just to get this straight, the custom script executed just removes the referenced variable (Unnamed point from the function call), but leaves the global variable called TempPoint to be used again?

Also, I suspect I have a 3 second window of trigger leakage with the wait time and a possible destruction of something else temporary I might just need (Such as some other player using the same trigger within 3 secs). I am thinking about removing that even though I would like a better effect for entering zones.
 

Chocobo

White-Flower
Reaction score
409
WolvesDenExit
Events
Unit - A unit enters WolvesDenExit <gen>
Conditions
((Owner of (Triggering unit)) controller) Equal to User
Actions
Custom Script : local location udg_TempPoint
Set TempPoint = (Center of WolvesDenEntranceSpawn <gen>)
Camera - Pan camera for (Owner of (Triggering unit)) to TempPoint over 3.00 seconds
Wait 3.00 game-time seconds
Unit - Move (Triggering unit) instantly to TempPoint
Custom script: Custom Script: call RemoveLocation(udg_TempPoint)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Custom script: Custom Script: call RemoveLocation(udg_TempPoint)

Didn't you get an error when you saved the map?
Custom Script: call RemoveLocation(udg_TempPoint)

And, when working with locals, you should also add
custom script: set udg_TempPoint = null
as very last action.
 

Effane

Save/Load Code Tutorial
Reaction score
51
Yeah I did get that error and fixed it, but I didnt fix the post, sorry about that.

Really the intent of the post was to find out more specific info. I am just coming into JASS with a background in Java/C/C++ and I was curious how the Functions cleared the variables. I guess I could swing everything over to locals and that would be fine for handling almost all of my leak fixing needs.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Well, "center of" creates a location.
Which is stored in your variable.
"RemoveLocation" removes the content of the variable.
You also set the variable to null after that, to tell the game you're sure to never need that value again.

set variable = center of ...
variable -> handle to location -> location

RemoveLocation
variable -> handle to location

set variable = null
variable

Then you leave the function, and the variable, being local, is destroyed.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top