NPC (class)

From Moondust Wiki
Revision as of 10:01, 29 October 2014 by Kevsoft (talk | contribs)
Jump to navigation Jump to search

This class provides fields/functions for managing NPCs in the current level.

NPC class
Type Function/Field Return values/Value type Description
Constructor myNPC = NPC(int internalIndex) NPC Construct a new NPC-Object. Only use this constructor with caution. Use npcs() or findnpcs() instead!
function NPC:mem(int offset, int fieldtype, object value) nil Sets a value of the NPC struct at a specific address-offset.
function NPC:mem(int offset, int fieldtype) object Returns a value of the NPC struct at a specific address-offset.
function NPC:kill() nil Kills the npc with the standard kill animation.
function NPC:kill(int killanimation) nil Kills the npc with the kill animation killanimation.
Field NPC.x double The x coordinate of the npc.
Field NPC.y double The y coordinate of the npc.
Field NPC.speedX double The x-speed of the npc.
Field NPC.speedY double The y-speed of the npc.
Field NPC.id int The npc-id of the npc.
Field NPC.direction int The direction of the npc. NOTE: Setting the direction of a npc, resets the monumentum of the npc. You can modify the speedX value if you want to set your own monumentum.
Field (ro) NPC.msg VBStr The message of the npc.
Field (ro) NPC.attachedLayerName VBStr The attached layer.
Field (ro) NPC.activateEventName VBStr The event name of the activate-event.
Field (ro) NPC.deathEventName VBStr The event name of the death-event.
Field (ro) NPC.noMoreObjInLayer VBStr The event name of the "No more objects in layer"-event.
Field (ro) NPC.talkEventName VBStr The event name of the talk-event.