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

[General] Problem with RemoveLocation()

Status
Not open for further replies.
Level 4
Joined
Dec 30, 2019
Messages
55
I found that deleting a location also deletes the value that was copied from them.
In this case, double ping is expected at a random point. But this does not happen; one ping occurs at a random point and the second in the center of the map.

  • Ping
    • Events
    • Conditions
    • Actions
      • Set VariableSet Temp_loc = (Random point in (Entire map))
      • Set VariableSet PingPoint1[1] = Temp_loc
      • Cinematic - Ping minimap for (Player group(Player 1 (Red))) at PingPoint1[1] for 3.00 seconds
      • Custom script: call RemoveLocation(udg_Temp_loc)
      • Cinematic - Ping minimap for (Player group(Player 1 (Red))) at PingPoint1[1] for 3.00 seconds
Function RemoveLocation() erase not only Temp_loc and PingPoint1[1] also. Its really wiered.
Explain please how to avoid it and why it happends.
PS Im using common Warcraft 3 Reforged WE.
 
Level 39
Joined
Feb 27, 2007
Messages
5,008
To expand upon what Rheiko said, a location variable is a handle and actually points to an object rather than just being a value (like an integer or a real). Imagine the scenario above but with unit variables: if you set 2 unit variables equal to each other, removing one of those units means that they're 'both' removed. It wouldn't make sense for only one of those units to be removed because they were the same unit! Same logic applies with locations. You need to remove the actual object so if you do it while other variables are referencing that object it will no longer exist for those other variables to refer to.
 
Status
Not open for further replies.
Top