Difference between revisions of "GameObj"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
Line 1: Line 1:
Game Object ([http://shardsonline.com/lN2rwhz4jSVambqesEBZ/lua-reference/gameobj.html 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 [[Module | Modules]] attached to them.
+
Game Object ([http://shardsonline.com/lN2rwhz4jSVambqesEBZ/lua-reference/gameobj.html 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 [[ObjVar | Variables]] and/or [[Module | Modules]] attached to them.
  
 
A potion, a monster, a door, and a sword are all examples of GameObjs.
 
A potion, a monster, a door, and a sword are all examples of GameObjs.

Revision as of 22:28, 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.
  • GameObj can communicate between each other using SendMessage just like Modules.