Difference between revisions of "GameObj"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
Line 16: Line 16:
  
 
== Tips ==
 
== Tips ==
Obj variables should only contain data you are meaning to persist to disk, especially since reading from an ObjVar immediately after setting it will not always return the new value.
+
Obj variables should only contain data you are intending to persist to disk, especially since reading from an ObjVar immediately after setting it will not always return the new value.

Revision as of 16:19, 29 October 2016

Game Object (GameObj) is a Dynamic object within the game that can occupy a position of the world, including a container. Game Objects are the most common of all Objects and can have Variables and/or Modules attached to them.

A potion, a monster, a door, and a sword are all examples of GameObjs.


Object Variables

Object Variables are saved when a backup is performed. This means that after a full restart of the server, the GameObj will return to the state it was in during the backup.

gameObj:SetObjVar("Name", "Larry")
name = gameObj:GetObjVar("Name")
gameObj:SetObjVar("SomeObjVarNameIChose", 53.2)
aUserNum = gameObj:GetObjVar("SomeObjVarNameIChose")

You can save Numbers, Strings, Bools, and Tables in an ObjVar and can specify any String name of your choice.

Tips

Obj variables should only contain data you are intending to persist to disk, especially since reading from an ObjVar immediately after setting it will not always return the new value.