Usage

Syntax: function onPlayerTouchsMe() { }

Explanation

The onPlayerTouchsMe event behaves two different ways, depending on if it clientside or serverside. When it is clientside, onPlayerTouchsMe is called when the player object touches the NPC (based on the x,y coordinates and setshape) on the client. If it is serverside, it is called when any TServerPlayer touches the NPC (based on the x,y coordinates and setshape). In other words, use onPlayerTouchsMe serverside if you want it to be based off of the shape and position of the NPC on the server, or clientside whenever you want it to be based off of the shape and position of the NPC on the client.

Example

//#CLIENTSIDE
function onPlayerTouchsMe()
{
  this.number = this.number + 1;
}

... sets the variable number on the NPC to itself plus one only on the client that touched the npc.

On the other hand...
function onPlayerTouchsMe()
{
  this.number = this.number + 1;
}

... sets the variable number on the NPC to itself plus one, which all players effect. For example, if player1 touches the NPC once, then player2 touches the NPC once, number would be 2.

Categories

CategoryFunctionEvent
Comments [Hide comments/form]
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki