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

What can remove your location without you even knowing of it?

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
Okay, there's a very weird problem I have in my triggers which is frustrating me cause I have no idea what's causing it.
There's two triggers that are involved, the first one determines a point and stores it into an indexed variable. The second trigger happens after 0.01 second and uses that point, but the location is lost and the point appears to be near the center of the map (where usually removed points appear). I made a 'Ping minimap on both triggers, and the first trigger shows the point exactly where I want it to be, but the second one shows it near he center of the map. I guarantee you that I'm not removing the location at the end of trigger 1 and there's only one other trigger that removes it for which I've set a debug message to appear just to be sure it works properly, and it's NOT the source of the problem. Also note that the point variables and indexes used in both triggers are THE SAME, I already tested that out.
I'd show you a trigger but trust me it will just confuse you and nothing else...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Okay I've found what the problem is, it's another point variable in trigger 2 that is set to be equal to the variable in trigger 1.. Pretty weird why that caused the point to appear near the center of the map.
Well we cannot tell you why without seeing the triggers.

Points, or more correctly location objects, represent an X and Y point on the playfield. Since they are objects, null is a valid value and will be returned by many natives when a reasonable location is not possible (eg the position of a null unit). For robustness most natives treat null as a location of (0,0) which is usually the middle of the playfield.

There are three possible reasons a location variable may evaluate to null. First is that you never initialize it (only applies to arrays as non-array variables cause a thread crash in this case). Second is that you explicitly set it to null, either directly as a constant or indirectly as the return value from a function (eg the position of a null unit). Finally is if the location the variable referenced is removed (RemoveLocation native) yet the variable still holds its reference. All these cases will evaluate to null so be treated as the map origin when passed to most natives.
 
Status
Not open for further replies.
Top