Help

JS-OBJ-INVOKE-EXAMPLES

Also: JS-RANDOM-ITEM-EXAMPLE

The following bit of JavaScript invokes object 23142, equips it to the actor, and then adds a random +1d2 to a random ability score aura to it.

var obj = Obj.invoke( 23142, actor, 'equip' );
if ( !types ) types = new Array(
   'str', 'int', 'wis', 'dex', 'con', 'cha' );
obj.addAura( 'stat', types[ Mud.dice( 6 )-1 ], Mud.dice( 2 ) );

The following loads an item and equips it as long as there isn't already one in the game (including offline players inventories).

var obj = Obj.invoke( 30000, actor, 'equip', 'limit', 'saved', 1 );

The following works like the previous code except for the item is not equipped:

var obj = Obj.invoke( 30000, actor, 'limit', 'saved', 1 );

Last edited by Engada in October 2005.