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

[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 45
Joined
Feb 27, 2007
Messages
5,578
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