Skip to content

class Npc extends Vob (client-side)

Available since version: 0.3.7.5

This class represents Npc.

Constructor

Npc(userpointer ptr)

Parameters:

  • userpointer ptr: the pointer to the object from the game.

Properties

int idx

Available since version: 0.3.8.0

Represents the current NPC parser idx that is being used by the routine.


string slot

Available since version: 0.3.8.0

Represents the current NPC slot (unused by the game).


string effect (read-only)

Available since version: 0.3.8.0

Represents the current NPC visual effect from Daedalus that is being applied to it's body, example: DRAGON_UNDEAD


int npcType

Available since version: 0.3.8.0

Represents the current NPC type used by the game AI.


int variousFlags

Available since version: 0.3.8.0

Represents the current NPC flags. For more information see NpcFlags.


int damagetype

Available since version: 0.3.8.0

Represents the current NPC damage type.


int guild

Available since version: 0.3.8.0

Represents the current NPC guild.


int level

Available since version: 0.3.8.0

Represents the current NPC level.


int fighttactic

Available since version: 0.3.8.0

Represents the current NPC fight tactic used by the game AI.


int fmode

Available since version: 0.3.8.0

Represents the current NPC fight mode.


int voice

Available since version: 0.3.8.0

Represents the current NPC voice.


int voicePitch

Available since version: 0.3.8.0

Represents the current NPC voice pitch.


int mass

Available since version: 0.3.8.0

Represents the current NPC mass.


int daily_routine

Available since version: 0.3.8.0

Represents the current NPC daily routine daedalus function parser index used by game AI.


int startAIState

Available since version: 0.3.8.0

Represents the current NPC start state used by game AI.


string spawnPoint

Available since version: 0.3.8.0

Represents the current NPC spawn point.


int spawnDelay

Available since version: 0.3.8.0

Represents the current NPC spawn delay.


int senses

Available since version: 0.3.8.0

Represents the current NPC senses used by game AI.


int sensesRange

Available since version: 0.3.8.0

Represents the current NPC senses range used by game AI.


string wpname (read-only)

Available since version: 0.3.8.0

Represents the current NPC waypoint name.


int exp

Available since version: 0.3.8.0

Represents the current NPC experience points.


int expNextLevel

Available since version: 0.3.8.0

Represents the current NPC experience points required for next level.


int learnPoints

Available since version: 0.3.8.0

Represents the current NPC learn points.


int bodyStateInterruptableOverride

Available since version: 0.3.8.0

Represents the current NPC body state interruptable override.


bool noFocus

Available since version: 0.3.8.0

Note

Setting this to true will hide name & health bar when focusing.

Represents the current NPC no focus feature.


int parserEnd

Available since version: 0.3.8.0

Represents the daedalus parser end field (unused by the game).


zlist& timedOverlays (read-only)

Available since version: 0.3.8.0

Represents the list containing all mds overlays applied for given duration.


zarray& talents (read-only)

Available since version: 0.3.8.0

Note

This zarray might contain null entries, if specific talent isn't learned for the npc!

Represents the array containing all npc learned talents.


int spellMana

Available since version: 0.3.8.0

Note

The value of this field is being set via daedalus function AI_ReadySpell.

Represents the initial spell mana for the npc set while spell ready.


Npc& tradeNpc (read-only)

Available since version: 0.3.8.0

Represents the trader npc.


float rangeToPlayer

Available since version: 0.3.8.0

Represents the cutscene range to player (unused by the game).


zarray& listOfVoiceHandles (read-only)

Available since version: 0.3.8.0

Represents the array containing currently played sound ids for the npc.


int voiceIndex (read-only)

Available since version: 0.3.8.0

Represents the currently used voice index by the npc.


zarray& effectList (read-only)

Available since version: 0.3.8.0

Represents the array containing actively processed visual effects on the npc.


bool showAIDebug

Available since version: 0.3.8.0

Represents true if the zspy debug ai messages for AI actions should be displayed, otherwise false.


bool showNews

Available since version: 0.3.8.0

Represents true if the debug AI news messages should be displayed on the screen, otherwise false.


bool csAllowedAsRole

Available since version: 0.3.8.0

Represents true if cutscene processing is enabled for npc, otherwise false.


bool isSummoned

Available since version: 0.3.8.0

Represents if the NPC was summoned (e.g: by the spell).


bool respawnOn

Available since version: 0.3.8.0

Represents if the NPC can respawn after death by the game spawn manager.


bool movementLocked

Available since version: 0.3.8.0

Represents if the NPC is locked in place e.g: cannot move.


bool drunk

Available since version: 0.3.8.0

Represents if the NPC is in drunk state (unused by the game).


bool mad

Available since version: 0.3.8.0

Represents if the NPC is in mad state (unused by the game).


bool overlayWounded (read-only)

Available since version: 0.3.8.0

Represents if the NPC has wounded overlay applied.


bool inOnDamage

Available since version: 0.3.8.0

Represents if the NPC is receiving damage (unused by the game).


bool autoRemoveWeapon

Available since version: 0.3.8.0

Represents if the NPC should automtically remove the weapon (unused by the game).


bool openInventory

Available since version: 0.3.8.0

Represents if the NPC should open it's inventory (unused by the game).


bool askRoutine

Available since version: 0.3.8.0

Represents if the NPC is in ask routine (unused by the game).


bool spawnInRange

Available since version: 0.3.8.0

Represents if the NPC should be spawned when player is getting closer to it by the game spawn manager.


int bodyTexColorNr

Available since version: 0.3.8.0

Note

value can only set in range of [0, 65535]

Represents the NPC body texture variation id.


int bodyTexColorNr

Available since version: 0.3.8.0

Note

value can only set in range of [0, 65535]

Represents the NPC body texture color variation id.


int headTexVarNr

Available since version: 0.3.8.0

Note

value can only set in range of [0, 65535]

Represents the NPC head texture variation id.


int teethTexVarNr

Available since version: 0.3.8.0

Note

value can only set in range of [0, 65535]

Represents the NPC teeth texture variation id.


int guildTrue

Available since version: 0.3.8.0

Note

value can only set in range of [0, 255]

Represents the true guild that NPC belongs to.


int drunkTime

Available since version: 0.3.8.0

Note

value can only set in range of [0, 255]

Represents the time in miliseconds how long the NPC will be in drunk state (cut feature from the game, unused).


int madTime

Available since version: 0.3.8.0

Represents the time in miliseconds how long the NPC will be in mad state (cut feature from the game, unused).


int spells

Available since version: 0.3.8.0

Note

value can only set in range of [0, 255]

Represents the number of spells npc has learned (cut feature from the game, unused).


int bodyState

Available since version: 0.3.8.0

Represents currently used bodystate flags by the NPC.


bool aniMessageRunning (read-only)

Available since version: 0.3.8.0

Represents if the NPC plays animation by game event system.


int instance

Available since version: 0.3.8.0

Represents the currently daedalus instance by the NPC (e.g: PC_HERO).


string mdsName

Available since version: 0.3.8.0

Represents the currently used model script by the NPC (e.g: Humans.mds).


string bodyModel

Available since version: 0.3.8.0

Represents the currently used body model by the NPC (e.g: Hum_Body_Naked0.asc).


string headModel

Available since version: 0.3.8.0

Represents the currently used head model by the NPC (e.g: Hum_Head_Pony.mms).


Vec3& modelScale

Available since version: 0.3.8.0

Represents the current NPC model scale.


float modelFatness

Available since version: 0.3.8.0

Represents the current NPC model fatness.


int namenr

Available since version: 0.3.8.0

Represents a field unused by the game.


float hpHeal

Available since version: 0.3.8.0

Represents a field that tracks the time remaining until the next health point is restored.


float manaHeal

Available since version: 0.3.8.0

Represents a field that tracks the time remaining until the next mana point is restored.


float divetime

Available since version: 0.3.8.0

Represents the maximum duration (in seconds) an NPC can stay underwater before their oxygen supply is depleted.


float swimtime

Available since version: 0.3.8.0

Represents a field that determines if the NPC can swim;


float divectr

Available since version: 0.3.8.0

Represents a countdown timer that tracks remaining oxygen while diving.


Vob fireVob

Available since version: 0.3.8.0

Represents temporary vob attached to the NPC while they are in the "burning" state.


float fireDamage

Available since version: 0.3.8.0

Represents the amount of damage-per-tick applied to the NPC when they are affected by a fire-based effect.


float fireDamageTimer

Available since version: 0.3.8.0

Represents a countdown timer that controls the frequency and duration of recurring damage dealt to the NPC while they are on fire.


int attitude

Available since version: 0.3.8.0

Represents permanent or current baseline attitude towards the player or other guilds.


int tmp_attitude

Available since version: 0.3.8.0

Represents a temporary attitude towards the player or another NPC.


float attTimer

Available since version: 0.3.8.0

Represents a field that determines temporary attitude changes.


int knowsPlayer

Available since version: 0.3.8.0

Represents a field that determines if the NPC has already met or "knows" the player character.


int percActive

Available since version: 0.3.8.0

Represents a field that indicates whether the NPC's active perception system is currently enabled and processing nearby events.


float percActiveTime

Available since version: 0.3.8.0

Represents the total duration for which the NPC's perception system remains active.


float percActiveDelta

Available since version: 0.3.8.0

Represents elapsed time since the last update of the NPC's active perception system.


bool overrideFallDownHeight

Available since version: 0.3.8.0

Represents a boolean flag that, when set to true, allows custom or scripted logic to override the engine's default fall distance and damage calculations.


float fallDownHeight

Available since version: 0.3.8.0

Represents the vertical distance the NPC has fallen, used to calculate damage and determine the landing animation.


int fallDownDamage

Available since version: 0.3.8.0

Represents the amount of damage calculated and applied to the NPC after falling from a height.


zCList& activeSpells

Available since version: 0.3.8.0

Represents list of nearby Vob objects.


int lastHitSpellID

Available since version: 0.3.8.0

Represents unique ID of the last spell that struck the NPC.


int lastHitSpellCat

Available since version: 0.3.8.0

Represents a category of the last spell that struck the NPC.


zCArray& activeOverlays

Available since version: 0.3.8.0

Represents list of nearby Vob objects.


int askNo

Available since version: 0.3.8.0

Unused by the game.


int askYes

Available since version: 0.3.8.0

Unused by the game.


float canTalk

Available since version: 0.3.8.0

Represents A field indicating whether the NPC is currently able to start or continue a dialogue with others.


Npc talkOther (read-only)

Available since version: 0.3.8.0

Represents Npc that this character is currently engaged in a conversation with.


MobInter carry_vob (read-only)

Available since version: 0.3.8.0

Represents Vob object that the NPC is currently carrying or holding in their hands.


MobInter interactMob (read-only)

Available since version: 0.3.8.0

Represents MobInter object that the NPC is currently interacting with.


Item interactItem (read-only)

Available since version: 0.3.8.0

Represents Item object that the NPC is currently using or interacting with.


int interactItemCurrentState

Available since version: 0.3.8.0

Tracks the NPC's current state index during an item or MOB interaction sequence.


int interactItemTargetState

Available since version: 0.3.8.0

Represents final state index an NPC aims to reach when interacting with a MOB or an item.


int script_aiprio

Available since version: 0.3.8.0

Unused by the game.


int old_script_state

Available since version: 0.3.8.0

Represents the previous AI script state ID.


float damageMul

Available since version: 0.3.8.0

Represents a global scaling factor applied to all damage dealt by the NPC.


zCArray& vobList

Available since version: 0.3.8.0

Represents list of nearby Vob objects.


float vobcheck_time

Available since version: 0.3.8.0

Is set to random value upon inicialization, later unused by the game.


float pickvobdelay

Available since version: 0.3.8.0

Throttles focus/object detection frequency for performance.


zCVob& focus_vob

Available since version: 0.3.8.0

Represents currently focused vob.


float fadeAwayTime

Available since version: 0.3.8.0

Represents a countdown timer (in milliseconds) used to calculate the visual transparency (alpha) of an NPC during the fade-out process before being deleted from the world.


float respawnTime

Available since version: 0.3.8.0

Is used to store spawnDelay field value by the game.


int fightRangeBase

Available since version: 0.3.8.0

Represents base fight range.


int fightRangeFist

Available since version: 0.3.8.0

Represents fists fight range.


int fightRangeG

Available since version: 0.3.8.0

Is set by the game upon inicialization, later unused.


float fight_waitTime (read-only)

Available since version: 0.3.8.0

Represents wait time for next action in fight.


float fight_lastStrafeFrame (read-only)

Available since version: 0.3.8.0

Represents last strafe frame.


int soundType

Available since version: 0.3.8.0

Represents the sound type, game sets it to 0 when setting new sound source.


zCVob soundVob

Available since version: 0.3.8.0

Represents the sound vob object.


zVEC3 soundPosition

Available since version: 0.3.8.0

Represents the position of sound source.


static int enabledDialogCamStop

Available since version: 0.3.8.0

Represents dialog cam stop override.


static int targetLocked

Available since version: 0.3.8.0

Represents true if the player is currently locked the focus (by pressing LMB or CTRL), otherwise false.


static Npc& player

Available since version: 0.3.8.0

Represents player object reference.


static int godMode

Available since version: 0.3.8.0

Represents true if god mode is enabled, otherwise false.


static int angleNear

Available since version: 0.3.8.0

Represents angle for auto heading in melee combat.


static int angleFarUp

Available since version: 0.3.8.0

Represents elevation angle for auto heading in range combat.


static int angleFarSide

Available since version: 0.3.8.0

Represents side angle for auto heading in range combat.


static int gameMode

Available since version: 0.3.8.0

Represents the game mode used by the player npc, possible values are: 0 - normal 1 - plunder 2 - steal


static Npc& dontArchiveThisNpc

Available since version: 0.3.8.0

Represents the npc that won't be archived by the game (saved/loaded, mostly used by singleplayer).


static Mat4& playerPositionMatrix

Available since version: 0.3.8.0

Represents player position matrix (unused by the game).


static int aiDisabled

Available since version: 0.3.8.0

Represents true if npc ai is disabled, otherwise false.


Methods

getName

Available since version: 0.3.8.0

Note

NPC name could be written in multiple lines

This function gets NPC name by it's index.

string getName(int index)

Parameters:

  • int index: index of line name

Returns string:

NPC name


setName

Available since version: 0.3.8.0

Note

NPC name could be written in multiple lines

This function sets NPC name by it's index.

void setName(int index, string name)

Parameters:

  • int index: index of line name
  • string name: NPC name

getAttribute

Available since version: 0.3.8.0

This function gets NPC attribute by it's index (from 0 to 7).

int getAttribute(int index)

Parameters:

  • int index: index of attribute

Returns int:

NPC attribute


setAttribute

Available since version: 0.3.8.0

This function sets NPC attribute by it's index (from 0 to 7).

void setAttribute(int index, int attribute)

Parameters:

  • int index: index of attribute
  • int attribute: NPC attribute

getHitChance

Available since version: 0.3.8.0

This function gets NPC hit chance by it's index (from 0 to 4).

int getHitChance(int index)

Parameters:

  • int index: index of hit chance

Returns int:

NPC hit chance


setHitChance

Available since version: 0.3.8.0

This function sets NPC hit chance by it's index (from 0 to 4).

void setHitChance(int index, int hitChance)

Parameters:

  • int index: index of hit chance
  • int hitChance: NPC hit chance

getProtection

Available since version: 0.3.8.0

This function gets NPC protection by it's index (from 0 to 7).

int getProtection(int index)

Parameters:

  • int index: index of protection

Returns int:

NPC protection


setProtection

Available since version: 0.3.8.0

This function sets NPC protection by it's index (from 0 to 7).

void setProtection(int index, int protection)

Parameters:

  • int index: index of protection
  • int protection: NPC protection

getDamage

Available since version: 0.3.8.0

This function gets NPC damage by it's index (from 0 to 7).

int getDamage(int index)

Parameters:

  • int index: index of damage

Returns int:

NPC damage


setDamage

Available since version: 0.3.8.0

This function sets NPC damage by it's index (from 0 to 7).

void setDamage(int index, int damage)

Parameters:

  • int index: index of damage
  • int damage: NPC damage

getMission

Available since version: 0.3.8.0

This function gets NPC mission by it's index (from 0 to 4).

int getMission(int index)

Parameters:

  • int index: index of mission

Returns int:

NPC mission


setMission

Available since version: 0.3.8.0

This function sets NPC mission by it's index (from 0 to 4).

void setMission(int index, int mission)

Parameters:

  • int index: index of mission
  • int mission: NPC mission

getAIScriptVars

Available since version: 0.3.8.0

This function gets NPC AI script variables by it's index.

int getAIScriptVars(int index)

Parameters:

  • int index: index of AI script variable

Returns int:

NPC AI script variable


setAIScriptVars

Available since version: 0.3.8.0

This function sets NPC mission by it's index.

void setAIScriptVars(int index, int value)

Parameters:

  • int index: index of AI script variable
  • int value: NPC AI script variable

setVisual

Available since version: 0.3.8.0

Sets the visual of the NPC.

void setVisual(Visual visual)

Parameters:

  • Visual visual: the visual to set

shrink

Available since version: 0.3.8.0

Shrinks the NPC and removes its model and AI.

void shrink()

unShrink

Available since version: 0.3.8.0

Restores a previously shrunk NPC.

void unShrink()

avoidShrink

Available since version: 0.3.8.0

Prevents the NPC from shrinking for the specified timeout.

void avoidShrink(int timeout = 1000)

Parameters:

  • int timeout: timeout in milliseconds

cleanUp

Available since version: 0.3.8.0

Cleans up the NPC.

void cleanUp()

applyOverlay

Available since version: 0.3.8.0

Applies an animation overlay to the NPC.

bool applyOverlay(string overlay)

Parameters:

  • string overlay: overlay name

Returns bool:

true on success; otherwise, false


removeOverlay

Available since version: 0.3.8.0

Removes an animation overlay from the NPC.

void removeOverlay(string overlay)

Parameters:

  • string overlay: overlay name

initByScript

Available since version: 0.3.8.0

Initializes the NPC from a Daedalus script instance.

void initByScript(int instanceIndex, bool reload = false)

Parameters:

  • int instanceIndex: script instance index
  • bool reload: reload the instance

getInstanceName

Available since version: 0.3.8.0

Gets the NPC instance name.

string getInstanceName()

Returns string:

instance name


getScriptInstance

Available since version: 0.3.8.0

Gets the NPC script instance name and index.

[(string|null getScriptInstance()

Returns [(string|null:

, int]) script instance name and index in a single array


setByScriptInstance

Available since version: 0.3.8.0

Sets the NPC script instance by name.

bool setByScriptInstance(string instanceName)

Parameters:

  • string instanceName: script instance name

Returns bool:

true on success, otherwise false


setByScriptInstance

Available since version: 0.3.8.0

Sets the NPC script instance by index.

bool setByScriptInstance(int instanceIndex)

Parameters:

  • int instanceIndex: script instance index

Returns bool:

true on success, otherwise false


getOverlay

Available since version: 0.3.8.0

Gets the current NPC animation overlay name.

string|null getOverlay()

Returns string|null:

overlay name, or an empty string when none is active


setHead

Available since version: 0.3.8.0

Sets the NPC head visual.

void setHead()

setAdditionalVisuals

Available since version: 0.3.8.0

Sets the additional body, head and armor visuals of the NPC.

void setAdditionalVisuals(string bodyVisual, int bodyTexNr, int bodyColor, string headVisual, int headTexNr, int teethTexNr, int armorInstance = -1)

Parameters:

  • string bodyVisual: body visual name
  • int bodyTexNr: body texture variation
  • int bodyColor: body color variation
  • string headVisual: head visual name
  • int headTexNr: head texture variation
  • int teethTexNr: teeth texture variation
  • int armorInstance: armor instance

initModel

Available since version: 0.3.8.0

Initializes the NPC model.

void initModel()

checkModelOverlays

Available since version: 0.3.8.0

Checks and applies the NPC model overlays.

void checkModelOverlays()

deleteHumanAI

Available since version: 0.3.8.0

Deletes the NPC human AI.

void deleteHumanAI()

clearEM

Available since version: 0.3.8.0

Clears the NPC event messages.

void clearEM()

startStdFaceAni

Available since version: 0.3.8.0

Starts the standard face animation for the specified attitude.

bool startStdFaceAni(int attitude)

Parameters:

  • int attitude: NPC attitude

Returns bool:

true on success; otherwise, false


startFaceAni

Available since version: 0.3.8.0

Starts a face animation on the NPC.

bool startFaceAni(string name, float intensity = 1.0, float holdtime = -2.0)

Parameters:

  • string name: animation name
  • float intensity: animation intensity
  • float holdtime: animation hold time

Returns bool:

true on success, otherwise false


stopFaceAni

Available since version: 0.3.8.0

Stops a face animation on the NPC.

bool stopFaceAni(string name)

Parameters:

  • string name: animation name

Returns bool:

true on success; otherwise, false


disable

Available since version: 0.3.8.0

Disables the NPC and removes it from the world.

void disable()

enable

Available since version: 0.3.8.0

Enables the NPC and moves it to its current daily-routine position.

void enable(Vec3 position)

Parameters:

  • Vec3 position: enable position

getProtectionByMode

Available since version: 0.3.8.0

This function will get the player protection.

int getProtectionByMode(int damageType)

Parameters:

Returns int:

the protection value for specific damageType.


getWaterLevel

Available since version: 0.3.8.0

This function will get player water level.

int getWaterLevel()

Returns int:

current water level; 0 = outside water, 1 = walking in water, 2 = swimming.


setToMad

Available since version: 0.3.8.0

Sets the NPC to mad state.

void setToMad(float ms)

Parameters:

  • float ms: time in milliseconds

healFromMad

Available since version: 0.3.8.0

Heals the NPC from mad state.

void healFromMad()

refreshNpc

Available since version: 0.3.8.0

Refreshes the NPC.

void refreshNpc()

readySpell

Available since version: 0.3.8.0

Readies a spell.

bool readySpell(int nSpell, int nMana)

Parameters:

  • int nSpell: spell id
  • int nMana: mana amount

Returns bool:

true on success; otherwise, false


unreadySpell

Available since version: 0.3.8.0

Unreadies current spell.

bool unreadySpell()

Returns bool:

true on success; otherwise, false


getSpellItem

Available since version: 0.3.8.0

Gets the item associated with a spell.

Item getSpellItem(int nSpell)

Parameters:

  • int nSpell: spell id

Returns Item:

the spell item, or null


getActiveSpellNr

Available since version: 0.3.8.0

Gets active spell number.

int getActiveSpellNr()

Returns int:

spell number


getActiveSpellCategory

Available since version: 0.3.8.0

Gets active spell category.

int getActiveSpellCategory()

Returns int:

spell category


getActiveSpellLevel

Available since version: 0.3.8.0

Gets active spell level.

int getActiveSpellLevel()

Returns int:

spell level


getActiveSpellIsScroll

Available since version: 0.3.8.0

Checks if active spell is a scroll.

int getActiveSpellIsScroll()

Returns int:

1 if scroll, else 0


setActiveSpellInfo

Available since version: 0.3.8.0

Sets active spell info.

void setActiveSpellInfo(int nr)

Parameters:

  • int nr: spell number

insertActiveSpell

Available since version: 0.3.8.0

Inserts active spell.

void insertActiveSpell(Spell spell)

Parameters:

  • Spell spell: the spell to insert

removeActiveSpell

Available since version: 0.3.8.0

Removes active spell.

void removeActiveSpell(Spell spell)

Parameters:

  • Spell spell: spell object

removeActiveSpell

Available since version: 0.3.8.0

Removes active spell.

void removeActiveSpell(int spellNr)

Parameters:

  • int spellNr: spell number

doActiveSpells

Available since version: 0.3.8.0

Processes active spells.

bool doActiveSpells()

Returns bool:

true on success; otherwise, false


killActiveSpells

Available since version: 0.3.8.0

Kills active spells.

void killActiveSpells()

isSpellActive

Available since version: 0.3.8.0

Checks if specific spell is active.

Spell isSpellActive(int nr)

Parameters:

  • int nr: spell number

Returns Spell:

spell object, or null


hasMagic

Available since version: 0.3.8.0

Checks if NPC has magic.

bool hasMagic()

Returns bool:

true if has magic; otherwise, false


getNumberOfSpells

Available since version: 0.3.8.0

Gets the number of spells.

int getNumberOfSpells()

Returns int:

number of spells


openSpellBook

Available since version: 0.3.8.0

Opens the spellbook.

void openSpellBook(bool showMagicCircle = true)

Parameters:

  • bool showMagicCircle: optional show magic circle

closeSpellBook

Available since version: 0.3.8.0

Closes the spellbook.

void closeSpellBook(bool removeall)

Parameters:

  • bool removeall: remove all flag

makeSpellBook

Available since version: 0.3.8.0

Creates the spellbook.

void makeSpellBook()

destroySpellBook

Available since version: 0.3.8.0

Destroys the spellbook.

void destroySpellBook()

activateDialogCam

Available since version: 0.3.8.0

Activates dialog camera.

bool activateDialogCam(float timems)

Parameters:

  • float timems: time in milliseconds

Returns bool:

true on success; otherwise, false


deactivateDialogCam

Available since version: 0.3.8.0

Deactivates dialog camera.

bool deactivateDialogCam()

Returns bool:

true on success; otherwise, false


startFadeAway

Available since version: 0.3.8.0

Starts fade away.

void startFadeAway()

isFadingAway

Available since version: 0.3.8.0

Checks if NPC is fading away.

bool isFadingAway()

Returns bool:

true if fading away; otherwise, false


fadeAway

Available since version: 0.3.8.0

Triggers fade away.

bool fadeAway()

Returns bool:

true on success; otherwise, false


detectItem

Available since version: 0.3.8.0

Detects item around NPC.

Item& detectItem(int flag, bool best = false)

Parameters:

  • int flag: the flag
  • bool best: optional search for best item

Returns Item&:

the detected item, or null


findMobInter

Available since version: 0.3.8.0

Finds interact mob by name.

MobInter findMobInter(string name)

Parameters:

  • string name: the name

Returns MobInter:

the mob, or null if not found


isInFightMode_S

Available since version: 0.3.8.0

Checks if in specific fight mode.

bool isInFightMode_S(int id)

Parameters:

  • int id: fight mode id

Returns bool:

true if in fight mode; otherwise, false


isAiming_S

Available since version: 0.3.8.0

Checks if aiming at specific target.

bool isAiming_S(Npc target)

Parameters:

  • Npc target: the target

Returns bool:

true if aiming; otherwise, false


setCarryVob

Available since version: 0.3.8.0

Sets the carry vob.

void setCarryVob(Vob v)

Parameters:

  • Vob v: the vob

setInteractMob

Available since version: 0.3.8.0

Sets the interact mob.

void setInteractMob(MobInter mob)

Parameters:

  • MobInter mob: the mob

setInteractItem

Available since version: 0.3.8.0

Sets the interacted item.

void setInteractItem(Item item)

Parameters:

  • Item item: the item

getInteractItemMaxState

Available since version: 0.3.8.0

Gets the maximum state for the interacted item sceme.

int getInteractItemMaxState(string sceme)

Parameters:

  • string sceme: the item sceme

Returns int:

the maximum state


interactItemIsInState

Available since version: 0.3.8.0

Checks if the interacted item is in the specified state.

bool interactItemIsInState(string sceme, int state)

Parameters:

  • string sceme: the item sceme
  • int state: the state to check

Returns bool:

true if in state; otherwise, false


canUse

Available since version: 0.3.8.0

Checks if the NPC can use the specified item.

bool canUse(Item item)

Parameters:

  • Item item: the item to check

Returns bool:

true if can use; otherwise, false


equip

Available since version: 0.3.8.0

Equips the specified item.

void equip(Item item)

Parameters:

  • Item item: the item to equip

equipItem

Available since version: 0.3.8.0

Equips the specified item.

void equipItem(Item item)

Parameters:

  • Item item: the item to equip

useItem

Available since version: 0.3.8.0

Uses the specified item.

bool useItem(Item item)

Parameters:

  • Item item: the item to use

Returns bool:

true if used; otherwise, false


interrupt

Available since version: 0.3.8.0

Interrupts the current action of the NPC.

void interrupt(bool checkBodyState = false, bool stopWeaponChoose = true)

Parameters:

  • bool checkBodyState: optional check body state
  • bool stopWeaponChoose: optional stop weapon choose

getBodyStateModifierNames

Available since version: 0.3.8.0

Gets the current body state modifier names.

string getBodyStateModifierNames()

Returns string:

The body state modifier names.


isBodyStateInterruptable

Available since version: 0.3.8.0

Checks if the body state is interruptable.

bool isBodyStateInterruptable()

Returns bool:

true if interruptable; otherwise, false


hasBodyStateFreeHands

Available since version: 0.3.8.0

Checks if hands are free in current body state.

bool hasBodyStateFreeHands()

Returns bool:

true if hands are free; otherwise, false


onTouch

Available since version: 0.3.8.0

Called when touched by another vob.

void onTouch(Vob otherVob)

Parameters:

  • Vob otherVob: the other vob

doDoAniEvents

Available since version: 0.3.8.0

Executes animation events.

bool doDoAniEvents()

Returns bool:

true on success; otherwise, false


doModelSwapMesh

Available since version: 0.3.8.0

Swaps the model mesh.

bool doModelSwapMesh(string n1, string n2)

Parameters:

  • string n1: old mesh name
  • string n2: new mesh name

Returns bool:

true on success; otherwise, false


doTakeVob

Available since version: 0.3.8.0

Takes the specified vob.

bool doTakeVob(Vob vob)

Parameters:

  • Vob vob: the vob to take

Returns bool:

true on success; otherwise, false


doDropVob

Available since version: 0.3.8.0

Drops the specified vob.

bool doDropVob(Vob vob)

Parameters:

  • Vob vob: the vob to drop

Returns bool:

true on success; otherwise, false


doThrowVob

Available since version: 0.3.8.0

Throws the specified vob at the given distance.

bool doThrowVob(Vob vob, float dist)

Parameters:

  • Vob vob: the vob to throw
  • float dist: the throwing distance

Returns bool:

true on success; otherwise, false


doExchangeTorch

Available since version: 0.3.8.0

Exchanges torch.

bool doExchangeTorch()

Returns bool:

true on success; otherwise, false


hasTorch

Available since version: 0.3.8.0

Checks if the NPC currently has a torch.

bool hasTorch()

Returns bool:

true if NPC has torch; otherwise, false


setTorchAni

Available since version: 0.3.8.0

Sets the torch animation state.

void setTorchAni(bool f, bool now = true)

Parameters:

  • bool f: torch animation state
  • bool now: optional whether to apply immediately

checkSetTorchAni

Available since version: 0.3.8.0

Checks whether the NPC needs to set torch animation.

void checkSetTorchAni()

checkPutbackTorch

Available since version: 0.3.8.0

Checks whether the NPC needs to put back the torch.

void checkPutbackTorch()

getFromInv

Available since version: 0.3.8.0

Gets an item from the inventory.

Item getFromInv(int instance, int amount)

Parameters:

  • int instance: the item instance id
  • int amount: the amount to get

Returns Item:

the item, or null if not found


isInInv

Available since version: 0.3.8.0

Checks if an item is in the inventory.

Item isInInv(Item item, int num = 1)

Parameters:

  • Item item: item objec
  • int num: optional amount

Returns Item:

the item if found, otherwise null


isInInv

Available since version: 0.3.8.0

Checks if an item is in the inventory.

Item isInInv(int instanceId, int num = 1)

Parameters:

  • int instanceId: instance id
  • int num: optional amount

Returns Item:

the item if found, otherwise null


isInInv

Available since version: 0.3.8.0

Checks if an item is in the inventory.

Item isInInv(string instanceName, int num = 1)

Parameters:

  • string instanceName: instance name
  • int num: optional amount

Returns Item:

the item if found, otherwise null


canCarry

Available since version: 0.3.8.0

Checks if the NPC can carry a specific item.

bool canCarry(Item item)

Parameters:

  • Item item: the item to check

Returns bool:

true if the NPC can carry the item; otherwise, false


putInInv

Available since version: 0.3.8.0

Puts an item into the inventory.

Item putInInv(Item|int|string itemOrInstance, int num = 1)

Parameters:

  • Item|int|string itemOrInstance: item object, instance id or instance name
  • int num: optional amount

Returns Item:

the inserted item


removeFromInv

Available since version: 0.3.8.0

Removes an item from the inventory.

Item removeFromInv(Item item, int num = 1)

Parameters:

  • Item item: item object
  • int num: optional amount

Returns Item:

the removed item


removeFromInv

Available since version: 0.3.8.0

Removes an item from the inventory.

Item removeFromInv(int instanceId, int num = 1)

Parameters:

  • int instanceId: instance id
  • int num: optional amount

Returns Item:

the removed item


removeFromInv

Available since version: 0.3.8.0

Removes an item from the inventory.

Item removeFromInv(string instanceName, int num = 1)

Parameters:

  • string instanceName: instance name
  • int num: optional amount

Returns Item:

the removed item


dropInventory

Available since version: 0.3.8.0

Drops the entire inventory.

void dropInventory()

putInSlot

Available since version: 0.3.8.0

Puts the specified vob into the NPC's slot.

void putInSlot(string slotName, Vob vob, bool inInv = false)

Parameters:

  • string slotName:
  • Vob vob:
  • bool inInv:

removeFromSlot

Available since version: 0.3.8.0

Removes the item/vob from the specified slot.

Vob removeFromSlot(string slotName, bool dropIt = true, bool killEffect = true)

Parameters:

  • string slotName:
  • bool dropIt:
  • bool killEffect:

Returns Vob:

the removed vob or null.


removeFromAllSlots

Available since version: 0.3.8.0

Removes the NPC's items from all slots on their body.

void removeFromAllSlots(bool dropIt = true)

Parameters:

  • bool dropIt: true if removed items should be dropped, otherwise false.

dropFromSlot

Available since version: 0.3.8.0

Drops the item/vob from the specified slot onto the ground.

Vob dropFromSlot(string slotName)

Parameters:

  • string slotName:

Returns Vob:

the dropped vob or null.


setItemEffectControledByModel

Available since version: 0.3.8.0

Controls the effect of an item based on a model node.

void setItemEffectControledByModel(Item item, ModelNodeInst node, bool modelControl, bool forceInvisible = false, bool itemEffectCleanUp = false)

Parameters:

  • Item item: the item whose effect is controlled
  • ModelNodeInst node: the model node
  • bool modelControl: whether the model controls the effect
  • bool forceInvisible: optional force invisible flag
  • bool itemEffectCleanUp: optional cleanup flag

setToSlotPosition

Available since version: 0.3.8.0

Sets the vob to the specified slot position on the NPC.

void setToSlotPosition(Vob vob, string slotName)

Parameters:

  • Vob vob:
  • string slotName:

isInvSlotAvailable

Available since version: 0.3.8.0

Checks if the inventory slot is available.

bool isInvSlotAvailable(string name)

Parameters:

  • string name:

Returns bool:


createInvSlot

Available since version: 0.3.8.0

Creates a custom inventory slot.

void createInvSlot(string name)

Parameters:

  • string name:

deleteInvSlot

Available since version: 0.3.8.0

Deletes a custom inventory slot.

void deleteInvSlot(string name)

Parameters:

  • string name:

isSlotFree

Available since version: 0.3.8.0

Checks if the specified slot is free.

bool isSlotFree(string name)

Parameters:

  • string name:

Returns bool:


getSlotVob

Available since version: 0.3.8.0

Gets the vob attached to the specified slot.

Vob getSlotVob(string name)

Parameters:

  • string name:

Returns Vob:


getSlotItem

Available since version: 0.3.8.0

Gets the item attached to the specified slot.

Item getSlotItem(string name)

Parameters:

  • string name:

Returns Item:


getSlotNpc

Available since version: 0.3.8.0

Gets the NPC attached to the specified slot.

Npc getSlotNpc(string name)

Parameters:

  • string name:

Returns Npc:


getItem

Available since version: 0.3.8.0

Gets an item from the specified NPC inventory category and slot.

Item getItem(int category, int slot)

Parameters:

  • int category: inventory category
  • int slot: inventory slot

Returns Item:

the item, or null if not found


dropAllInHand

Available since version: 0.3.8.0

Drops all items/vobs currently held in both hands.

void dropAllInHand()

setRightHand

Available since version: 0.3.8.0

Sets the vob in the NPC's right hand.

void setRightHand(Vob vob)

Parameters:

  • Vob vob:

getRightHand

Available since version: 0.3.8.0

Gets the vob in the NPC's right hand.

Vob getRightHand()

Returns Vob:


setLeftHand

Available since version: 0.3.8.0

Sets the vob in the NPC's left hand.

void setLeftHand(Vob vob)

Parameters:

  • Vob vob:

getLeftHand

Available since version: 0.3.8.0

Gets the vob in the NPC's left hand.

Vob getLeftHand()

Returns Vob:


hasInHand

Available since version: 0.3.8.0

Checks if the NPC has the specified item instance in their hands.

bool hasInHand(int instanceId)

Parameters:

  • int instanceId: the item instance id

Returns bool:


hasInHand

Available since version: 0.3.8.0

Checks if the NPC has the specified vob in their hands.

bool hasInHand(Vob vob)

Parameters:

  • Vob vob: the item vob

Returns bool:


dropVob

Available since version: 0.3.8.0

Drops the specified vob at the given position.

void dropVob(Vob vob, Vec3 pos)

Parameters:

  • Vob vob:
  • Vec3 pos:

createItems

Available since version: 0.3.8.0

Creates items in the NPC inventory.

void createItems(int instance, int amount)

Parameters:

  • int instance: item instance id
  • int amount: number of items to create

openScreenStatus

Available since version: 0.3.8.0

Open status screen.

void openScreenStatus()

openScreenLog

Available since version: 0.3.8.0

Open log screen.

void openScreenLog()

openScreenMap

Available since version: 0.3.8.0

Open map screen.

void openScreenMap(int mapInst)

Parameters:

  • int mapInst:

isAPlayer

Available since version: 0.3.8.0

Checks if the NPC is a player character.

bool isAPlayer()

Returns bool:


isSelfPlayer

Available since version: 0.3.8.0

Checks if this NPC is the local player character.

bool isSelfPlayer()

Returns bool:


setAsPlayer

Available since version: 0.3.8.0

Sets this NPC as the active player character.

void setAsPlayer()

isMonster

Available since version: 0.3.8.0

Checks if the NPC is a monster.

bool isMonster()

Returns bool:


isHuman

Available since version: 0.3.8.0

Checks if the NPC is human.

bool isHuman()

Returns bool:


isGoblin

Available since version: 0.3.8.0

Checks if the NPC is a goblin.

bool isGoblin()

Returns bool:


isOrc

Available since version: 0.3.8.0

Checks if the NPC is an orc.

bool isOrc()

Returns bool:


isSkeleton

Available since version: 0.3.8.0

Checks if the NPC is a skeleton.

bool isSkeleton()

Returns bool:


showDebugInfo

Available since version: 0.3.8.0

Shows debug information of the NPC on the active camera.

void showDebugInfo()

useStandAI

Available since version: 0.3.8.0

Activates the NPC stand AI.

void useStandAI()

burn

Available since version: 0.3.8.0

Sets the NPC on fire with specified damage and duration.

void burn(int damage, float timeMs)

Parameters:

  • int damage:
  • float timeMs: (unused by the game)

stopBurn

Available since version: 0.3.8.0

Stops the NPC from burning.

void stopBurn()

updateNextVoice

Available since version: 0.3.8.0

This function will update the next voice of the NPC.

int updateNextVoice()

Returns int:


Callbacks

No callbacks.