Object.VirtualWorld
From Liberty Unleashed Wiki
This Object class member returns or sets the virtual world for the object.
Syntax
You can either return or set a new value using this member:
int Object.VirtualWorld
Object.VirtualWorld = int world
Arguments
- world - This is the new virtual world of the object.
Example 1. Returning
This example will message the player with the virtual world for an object with an ID of 0.
function onPlayerCommand( player, cmd, text ) { if ( cmd == "objectworld" ) { local object = FindObject( 0 ); if(obj) MessagePlayer( "Object 0's virtual world is " + object.VirtualWorld + ".", player ); return 1; } }
Notes
The function FindObject and event onPlayerCommand were used in this example. More info about them in the corresponding pages.
Example 2. Setting
This example will change the virtual world of object 0 to ID 2 when a player uses the command '/setworld'.
function onPlayerCommand( player, cmd, text ) { if(cmd == "setworld") { local object = FindObject( 0 ); if(object) { object.VirtualWorld = 2; MessagePlayer("Object 0's virtual world changed to world 2.", player); } return 1; } }
Notes
The function FindObject and event onPlayerCommand was used in this example. More info about it in the corresponding page.