Page MenuHomeFeedback Tracker

setVariable does not work on Locations.
New, WishlistPublic


Whenever I use setVariable on a location, it does not work. It does work on other objects though.


Legacy ID
Steps To Reproduce

_loc = nearestLocation [[0,0,0], _type];
_loc setVariable ["WepObAr", "Value"];
hint format["%1", _loc getVariable "WepObAr"];

returns null

Additional Information

I need to have variables for each town to contain an array of objects that has to spawn there.

Event Timeline

Ed edited Steps To Reproduce. (Show Details)Jul 1 2013, 12:17 AM
Ed edited Additional Information. (Show Details)
Ed set Category to Scripting.
Ed set Reproducibility to Always.
Ed set Severity to None.
Ed set Resolution to Open.
Ed set Legacy ID to 3001373828.May 7 2016, 3:11 PM
ceeeb added a comment.Jul 1 2013, 12:02 PM

setVariable does work with mission created locations, but (like almost all of the other set* location commands) does not work on locations that are part of the current terrain definition - consider them read only

As far as I know, setSide is the only one that does modify these locations

Ed added a subscriber: Ed.May 7 2016, 3:11 PM
Ed added a comment.Jul 1 2013, 7:41 PM

Thank you for the info ceeeb. What would you suggest I do to keep information per location? Maybe an array that I need to spam with publicVariable?

To go around you could always create a game logic at the coordinates of the location (can be read from config). Since the setVariable command works on game logics you could store your variables there.

no need to read config. location position can be be found with both locationPosition and position commands.