How do I get an Area Variable?

I can right click an area, and go to properties, then go to the advanced tab, click the … for variables and I can create variables. If I create a variable type int called “LEVEL”, and set equal to 1, how can I grab that in a script?

I know how to grab things like the player with functions like “GetLastPlayerUsed()”, but I don’t see how I can retrieve a variable that an AREA holds. I’ve looked with google but haven’t been able to find an example of someone using an Area variable.

If oArea is the area object, then presumably:

int nLevel = GetLocalInt( oArea, "LEVEL" );

You can get the area object with calls like GetArea or GetAreaFromLocation. I’m not sure whether GetObjectByTag would work, but you could experiment.

1 Like

Thanks!

GetObjectByTag() will work on areas, you just need to specify the area’s tag.

2 Likes