Properties

new MMOItem()

Developers never istantiate the MMOItem class: this is done internally by the SmartFoxServer 2X API.

MMOItems can be used to represent bonuses, triggers, bullets, etc, or any other non-player entity that will be handled using the MMORoom's rules of visibility. This means that whenever one or more MMOItems fall within the Area of Interest of a user, their presence will be notified to that user by means of the proximityListUpdate event.

MMOItems are identified by a unique ID and can have one or more MMOItem Variables associated to store custom data.

See also
MMORoom
MMOItemVariable

Properties

read-only

aoiEntryPoint  Vec3D

Returns the entry point of this item in the current user's AoI.

The returned coordinates are those that the item had when its presence in the current user's Area of Interest was last notified by a proximityListUpdate event. This field is populated only if the MMORoom in which the item exists is configured to receive such data.

See also
MMORoomSettings#sendAOIEntryPoint
SFSEvent.PROXIMITY_LIST_UPDATE
read-only

id  number

Indicates the id of this item. The id is unique and it is generated by the server when the MMOItem is created.

Methods

containsVariable(varName) → boolean

Indicates whether this item has the specified MMOItem Variable set or not.

Parameter

Name Type Optional Description

varName

string

 

The name of the MMOItem Variable whose existance must be checked.

See also
MMOItemVariable
Returns

boolean true if an MMOItem Variable with the passed name is set for this item.

getVariable(varName) → MMOItemVariable

Retrieves an MMOItem Variable from its name.

Parameter

Name Type Optional Description

varName

string

 

The name of the MMOItem Variable to be retrieved.

See also
MMOItem#getVariables
Returns

MMOItemVariable The MMOItemVariable object, or undefined if no MMOItem Variable with the passed name is associated to this item.

getVariables() → Array of MMOItemVariable

Retrieves all the MMOItem Variables of this item.

See also
MMOItem#getVariable
Returns

Array of MMOItemVariable The list of MMOItemVariable objects associated to this item.

toString() → string

Returns a string that contains the item id.

Returns

string The string representation of the MMOItem object.