NPC - character functions
NPC related functions.
Functions
CreateInvItem
CreateInvItem
Adds the item to the NPC's inventory
Parameters
var C_NPC npc
- instance of the NPCvar int itm
- instance name of the item
Globals
item
- set to the created item
CreateInvItems
CreateInvItems
Adds the specified number of items to the NPC's inventory
Parameters
var C_NPC npc
- instance of the NPCvar int itm
- instance name of the itemvar int ammount
- number of items to create
EquipItem
EquipItem
Creates and equips the item to the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int itm
- instance name of the item
Npc_CanSeeItem
Npc_CanSeeItem
Checks if NPC can see item, includes angle check
Parameters
var C_NPC npc
- instance of the NPCvar C_ITEM itm
- instance of the item
Return value
The function returns TRUE if can see, FALSE otherwise
Npc_CanSeeNpc
Npc_CanSeeNpc
Checks if slf
can see oth
, includes angle check
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns TRUE if can see, FALSE otherwise
Npc_CanSeeNpcFreeLOS
Npc_CanSeeNpcFreeLOS
Checks if slf
can see oth
without considering angle (line of sight check)
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns TRUE if can see, FALSE otherwise
Npc_CanSeeSource
Npc_CanSeeSource
Checks if NPC can see the source of a sound, includes angle check
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if can see, FALSE otherwise
Npc_ChangeAttribute
Npc_ChangeAttribute
Changes the value of an attribute for the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int attribute
- attribute to change (ATR_
constants)var int value
- value to change by
Npc_KnowsPlayer
Npc_KnowsPlayer
Checks if the NPC knows the player (must be set by Npc_SetKnowsPlayer
)
Parameters
var C_NPC npc
- instance of the NPCvar C_NPC player
- instance of the player
Return value
The function returns TRUE if the NPC knows the player, FALSE otherwise
Npc_SetKnowsPlayer
Npc_SetKnowsPlayer
Sets the NPC to know the player
Parameters
var C_NPC npc
- instance of the NPCvar C_NPC player
- instance of the player
Npc_CheckInfo
Npc_CheckInfo
Checks if the NPC has valid information (C_INFO) for the player
Parameters
var C_NPC npc
- instance of the NPCvar int important
- 1 to check for important information, 0 for unimportant
Return value
The function returns TRUE if the NPC has information, FALSE otherwise
NPC_GiveInfo
NPC_GiveInfo
Checks if the NPC has valid information (C_INFO) for the player, and if so, plays them
Parameters
var C_NPC npc
- instance of the NPCvar int important
- 1 to check for important information, 0 for unimportant
Return value
The function returns TRUE if the NPC has information, FALSE otherwise
Npc_KnowsInfo
Npc_KnowsInfo
Checks if the NPC knows the specified C_INFO
Parameters
var C_NPC npc
- instance of the NPCvar int infoinstance
- C_INFO instance name
Return value
The function returns TRUE if the NPC knows the info, FALSE otherwise
Npc_ClearAIQueue
Npc_ClearAIQueue
Clears the AI queue of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Npc_ClearInventory
Npc_ClearInventory
Clears the NPC's inventory, leaves only equipped and mission items
Parameters
var C_NPC npc
- instance of the NPC
Warning
This function is only available in Gothic 2
Npc_HasSpell
Npc_HasSpell
Checks if the NPC has a specified spell in inventory
Parameters
var C_NPC npc
- instance of the NPCvar int spellid
- ID of the spell
Return value
The function returns TRUE if the NPC has the spell, FALSE otherwise
Npc_ExchangeRoutine
Npc_ExchangeRoutine
Exchanges the NPC's daily routine
Parameters
var C_NPC npc
- instance of the NPCvar string routine
- name of the new routine
Npc_GetActiveSpell
Npc_GetActiveSpell
Returns the active spell for the NPC (self or other)
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns spell ID, -1 if no active spell
Npc_GetActiveSpellCat
Npc_GetActiveSpellCat
Gets the category/type of the spell that the NPC currently has active
Parameters
var C_NPC npc
- instance of the NPC to check
Return value
The function returns category ID of the currently active spell
Npc_GetActiveSpellIsScroll
Npc_GetActiveSpellIsScroll
Checks if the spell currently active on the NPC's hand is from a scroll
Parameters
var C_NPC npc
- instance of the NPC to check
Return value
The function returns TRUE if active spell is from a scroll, FALSE otherwise
Warning
This function is only available in Gothic 2
Npc_SetActiveSpellInfo
Npc_SetActiveSpellInfo
Sets the instance to which the NPC transforms into, durring the transformation spell
Parameters
var C_NPC npc
- instance of the NPCvar int instancename
- name of the instance the NPC transforms into
Return value
The function returns nothing, external is wrongly defined as int
Npc_GetAttitude
Npc_GetAttitude
Gets the attitude of the slf
towards the oth
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns attitude value (ATT_
constants)
Npc_GetPermAttitude
Npc_GetPermAttitude
Gets the permanent attitude of the slf
towards the oth
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns permanent attitude value (ATT_
constants)
Npc_GetBodyState
Npc_GetBodyState
Gets the body state of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns current body state (BS_
constants)
Npc_GetComrades
Npc_GetComrades
Gets the number of NPCs with the same guild as npc
within PERC_ASSESSENEMY
range
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns number of NPCs with the same guild within range
Npc_GetDetectedMob
Npc_GetDetectedMob
Gets the schema name of the MOB used by the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns schema name of the MOB (e.g. BEDHIGH
)
Npc_IsDetectedMobOwnedByNpc
Npc_IsDetectedMobOwnedByNpc
Checks if MOB used by slf
is owned by oth
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns TRUE if the MOB is owned by the other NPC, FALSE otherwise
Npc_IsDetectedMobOwnedByGuild
Npc_IsDetectedMobOwnedByGuild
Checks if MOB used by npc
is owned by the guild
Parameters
var C_NPC npc
- instance of the NPCvar int guild
- guild ID
Return value
The function returns TRUE if the MOB is owned by the guild, FALSE otherwise
Npc_GetDistToItem
Npc_GetDistToItem
Gets the distance between the NPC and an item (in cm)
Parameters
var C_NPC npc
- instance of the NPCvar C_ITEM itm
- instance of the item
Return value
The function returns distance between NPC and item in cm
Npc_GetDistToNpc
Npc_GetDistToNpc
Gets the distance between two NPCs (in cm)
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns distance between NPCs in cm
Npc_GetDistToPlayer
Npc_GetDistToPlayer
Gets the distance between the NPC and the player (in cm)
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns distance between NPC and player in cm
Npc_GetDistToWP
Npc_GetDistToWP
Gets the distance between the NPC and a waypoint (in cm)
Parameters
var C_NPC npc
- instance of the NPCvar string wpname
- name of the waypoint
Return value
The function returns distance between NPC and waypoint in cm
Npc_GetEquippedArmor
Npc_GetEquippedArmor
Gets the equipped armor of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns C_ITEM instance of the equipped armor, NULL if no armor
Npc_GetEquippedMeleeWeapon
Npc_GetEquippedMeleeWeapon
Gets the equipped melee weapon of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns C_ITEM instance of the equipped melee weapon, NULL if no weapon
Npc_GetEquippedRangedWeapon
Npc_GetEquippedRangedWeapon
Gets the equipped ranged weapon of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns C_ITEM instance of the equipped ranged weapon, NULL if no weapon
Npc_GetGuildAttitude
Npc_GetGuildAttitude
Gets the guild-based attitude between two NPCs based on their guild memberships.
This represents how members of different guilds feel about each other.
Parameters
var C_NPC slf
- instance of the NPC whose guild attitude should be checkedvar C_NPC oth
- second NPC to check attitude against
Return value
The function returns attitude value between the guilds of the two NPCs
Npc_GetHeightToItem
Npc_GetHeightToItem
Gets the height difference between the NPC and an item (in cm)
Parameters
var C_NCP npc
- instance of the NPCvar C_ITEM itm
- instance of the item
Return value
The function returns height difference between NPC and item in cm
Warning
This function is only available in Gothic 2
Npc_GetHeightToNpc
Npc_GetHeightToNpc
Gets the height difference between two NPCs (in cm)
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns height difference between NPCs in cm
Warning
This function is only available in Gothic 2
Npc_GetInvItem
Npc_GetInvItem
Checks if the NPC has an item in its inventory
Parameters
var C_NPC npc
- instance of the NPCvar int iteminstance
- instance name of the item
Globals
item
- set to the item if found
Return value
The function returns TRUE if the NPC has the item, FALSE otherwise
Npc_GetInvItemBySlot
Npc_GetInvItemBySlot
Checks if the NPC has an item in slot
Parameters
var C_NPC npc
- instance of the NPCvar int category
- category of the itemvar int slotnr
- slot number
Globals
item
- set to the item if found
Return value
The function returns TRUE if the NPC has the item, FALSE otherwise
Npc_RemoveInvItem
Npc_RemoveInvItem
Removes the item from the NPC's inventory
Parameters
var C_NPC npc
- instance of the NPCvar int iteminstance
- instance name of the item
Return value
The function returns TRUE if the item was removed, FALSE otherwise
Npc_RemoveInvItems
Npc_RemoveInvItems
Removes the specified number of items from the NPC's inventory
Parameters
var C_NPC npc
- instance of the NPCvar int iteminstance
- instance name of the itemvar int ammount
- number of items to remove
Return value
The function returns TRUE if the items were removed, FALSE otherwise
Npc_GetLastHitSpellCat
Npc_GetLastHitSpellCat
Gets the category of the last spell that hit/affected this NPC.
Parameters
var C_NPC npc
- instance of the NPC to check spell category for
Return value
The function returns category ID of the last spell that hit the NPC
Warning
This function is only available in Gothic 2
Npc_GetLastHitSpellID
Npc_GetLastHitSpellID
Gets the ID of the last spell that hit/affected this NPC.
Parameters
var C_NPC npc
- instance of the NPC to check spell hits for
Return value
The function returns ID of the last spell that hit the NPC, returns spell number that can be matched against spell definitions
Warning
This function is only available in Gothic 2
Npc_GetLookAtTarget
Npc_GetLookAtTarget
Gets the NPC the npc
is looking at
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns NPC the npc
is looking at
Warning
This function is only available in Gothic 2
Npc_GetNearestWP
Npc_GetNearestWP
Gets the nearest waypoint to the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns name of the nearest waypoint
Npc_GetNextWP
Npc_GetNextWP
Gets the second nearest waypoint to the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns name of the second nearest waypoint
Npc_GetPortalGuild
Npc_GetPortalGuild
Gets the guild assigned to the room (portal) the NPC is in
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns guild assigned to the portal, -1 if no guild
Warning
This function is only available in Gothic 2
Npc_GetPortalOwner
Npc_GetPortalOwner
Gets the owner of the room (portal) the NPC is in
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns instance of the owner NPC, NULL if no owner
Warning
This function is only available in Gothic 2
Npc_GetReadiedWeapon
Npc_GetReadiedWeapon
Gets the readied weapon of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns C_ITEM instance of the readied weapon, NULL if no weapon
Npc_GetStateTime
Npc_GetStateTime
Gets the state time of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns state time in seconds
Npc_SetStateTime
Npc_SetStateTime
Sets the state time of the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int timesec
- new state time in seconds
Npc_GetTalentSkill
Npc_GetTalentSkill
Gets the talent skill of the NPC (major talent value)
Parameters
var C_NPC npc
- instance of the NPCvar int talent
- talent ID (NPC_TALENT_
constants)
Return value
The function returns skill value
Npc_GetTalentValue
Npc_GetTalentValue
Gets the talent value of the NPC (additional talent value)
Parameters
var C_NPC npc
- instance of the NPCvar int talent
- talent ID (NPC_TALENT_
constants)
Return value
The function returns talent value
Npc_SetTalentSkill
Npc_SetTalentSkill
Sets the talent skill of the NPC (major talent value)
Parameters
var C_NPC npc
- instance of the NPCvar int talent
- talent ID (NPC_TALENT_
constants)var int value
- new skill value
Npc_SetTalentValue
Npc_SetTalentValue
Sets the talent value of the NPC (additional talent value)
Parameters
var C_NPC npc
- instance of the NPCvar int talent
- talent ID (NPC_TALENT_
constants)var int value
- new talent value
Npc_HasRangedWeaponWithAmmo
Npc_HasRangedWeaponWithAmmo
Checks if the NPC has equiped ranged weapon and ammo to use it
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has ranged weapon with ammo, FALSE otherwise
Npc_HasEquippedWeapon
Npc_HasEquippedWeapon
Checks if the NPC has equiped any weapon
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has equiped any weapon, FALSE otherwise
Npc_HasEquippedMeleeWeapon
Npc_HasEquippedMeleeWeapon
Checks if the NPC has equiped melee weapon
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has equiped melee weapon, FALSE otherwise
Npc_HasEquippedRangedWeapon
Npc_HasEquippedRangedWeapon
Checks if the NPC has equiped ranged weapon
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has equiped ranged weapon, FALSE otherwise
Npc_HasEquippedArmor
Npc_HasEquippedArmor
Checks if the NPC has equiped armor
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has equiped armor, FALSE otherwise
Npc_HasReadiedWeapon
Npc_HasReadiedWeapon
Checks if the NPC has readied weapon
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has readied weapon, FALSE otherwise
Npc_HasReadiedMeleeWeapon
Npc_HasReadiedMeleeWeapon
Checks if the NPC has readied melee weapon
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has readied melee weapon, FALSE otherwise
Npc_HasReadiedRangedWeapon
Npc_HasReadiedRangedWeapon
Checks if the NPC has readied ranged weapon
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC has readied ranged weapon, FALSE otherwise
Npc_IsWayBlocked
Npc_IsWayBlocked
Checks if NPCs way is blocked (has enough space to move forward)
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the way is blocked, FALSE otherwise
Npc_IsAiming
Npc_IsAiming
Checks if slf
is aiming at oth
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns TRUE if the NPC is aiming, FALSE otherwise
Npc_IsInFightMode
Npc_IsInFightMode
Cheks if NPC is in specified fight mode
Parameters
var C_NPC npc
- instance of the NPCvar int mode
- fight mode (FMODE_
constants)
Return value
The function returns TRUE if the NPC is in the fight mode, FALSE otherwise
Npc_SetAttitude
Npc_SetAttitude
Sets the attitude of the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int attitude
- attitude value (ATT_
constants)
Npc_SetTempAttitude
Npc_SetTempAttitude
Sets the temporary attitude of the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int attitude
- attitude value (ATT_
constants)
Npc_SetToFightMode
Npc_SetToFightMode
Sets the NPC to fight mode with the specified weapon (weapon is created)
Parameters
var C_NPC npc
- instance of the NPCvar int weapon
- instance name of the weapon
Npc_SetToFistMode
Npc_SetToFistMode
Sets the NPC to fist fight mode (no weapon) e.g. for monsters
Parameters
var C_NPC npc
- instance of the NPC
Npc_AreWeStronger
Npc_AreWeStronger
Checks if slf
and friends (we) are stronger than oth
and friends (enemy)
Calculeted based on the following formula: enemiesLevel >= 2*weLevel
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns TRUE if we are stronger, FALSE otherwise
Npc_IsVoiceActive
Npc_IsVoiceActive
Checks if the NPC is currently talking
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC is talking, FALSE otherwise
Npc_HasBodyFlag
Npc_HasBodyFlag
Checks if the NPC has a specified body flag
Parameters
var C_NPC npc
- instance of the NPCvar int flag
- body flag (BS_FLAG_
constants)
Return value
The function returns TRUE if the NPC has the flag, FALSE otherwise
Npc_SetTarget
Npc_SetTarget
Sets the current target for the NPC
Parameters
var C_NPC npc
- instance of the NPCvar C_NPC target
- instance of the new target
Npc_GetTarget
Npc_GetTarget
Gets the target of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Globals
other
- set to the target of the NPC
Return value
The function returns TRUE if the target is set successfully, FALSE otherwise
Npc_GetNextTarget
Npc_GetNextTarget
Searches for a target for the NPC.
Parameters
var C_NPC npc
- instance of the NPC
Globals
other
- set to the target of the NPC if found
Return value
The function returns TRUE if the target is found, FALSE otherwise
Npc_IsNextTargetAvailable
Npc_IsNextTargetAvailable
Checks if target is available for the NPC, if so, it is adopted as the internal target.
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the target is available, FALSE otherwise
Npc_SetTrueGuild
Npc_SetTrueGuild
Sets the true guild of the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int guild
- guild ID
Return value
The function returns nothing, external is wrongly defined as int
Npc_GetTrueGuild
Npc_GetTrueGuild
Gets the true guild of the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns true guild ID
Npc_IsOnFP
Npc_IsOnFP
Checks if the NPC is on the specified freepoint
Parameters
var C_NPC npc
- instance of the NPCvar string fpname
- name of the freepoint (could be only the middle part of the name:FP_
+fpname
+_01
)
Npc_PlayAni
Npc_PlayAni
Makes the NPC play the specified animation
Parameters
var C_NPC npc
- instance of the NPCvar string aniname
- name of the animation UPPERCASE
Npc_StopAni
Npc_StopAni
Makes the NPC stop the specified animation
Parameters
var C_NPC npc
- instance of the NPCvar string aniname
- name of the animation UPPERCASE
Warning
This function is only available in Gothic 2
Npc_IsNear
Npc_IsNear
Checks if oth
is within 5 meters from slf
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns TRUE if the NPC is near, FALSE otherwise
Npc_IsPlayer
Npc_IsPlayer
Checks if the NPC is a player
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC is a player, FALSE otherwise
Npc_IsInState
Npc_IsInState
Checks if the NPC is in the specified ZS state
Parameters
var C_NPC npc
- instance of the NPCvar func state
- ZS state function
Return value
The function returns TRUE if the NPC is in the state, FALSE otherwise
Npc_WasInState
Npc_WasInState
Checks if the NPC was in the specified ZS state
Parameters
var C_NPC npc
- instance of the NPCvar func state
- ZS state function
Return value
The function returns TRUE if the NPC was in the state, FALSE otherwise
Npc_IsInRoutine
Npc_IsInRoutine
Checks if the NPC is in the specified routine ZS state
Parameters
var C_NPC npc
- instance of the NPCvar func state
- routine ZS state function
Return value
The function returns TRUE if the NPC is in the state, FALSE otherwise
Npc_HasDetectedNpc
Npc_HasDetectedNpc
Checks if slf
has detected oth
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC
Return value
The function returns TRUE if the NPC has detected the other NPC, FALSE otherwise
Npc_WasPlayerInMyRoom
Npc_WasPlayerInMyRoom
Checks if the player was in the room (portal) of the NPC before the last room change
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the player was in the room assigned to the NPC, FALSE otherwise
Npc_IsInPlayersRoom
Npc_IsInPlayersRoom
Checks if the NPC is in the room (portal) assigned to the player
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC is in the room assigned to the player, FALSE otherwise
Warning
This function is only available in Gothic 2
Npc_IsPlayerInMyRoom
Npc_IsPlayerInMyRoom
Checks if the Player is in the room (portal) assigned to the NPC
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the player is in the room assigned to the NPC, FALSE otherwise
Npc_IsDrawingWeapon
Npc_IsDrawingWeapon
Checks if the NPC is drawing a weapon or spell, but by the oCMsgWeapon
and oCMsgMagic
events. Not sure if it works
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC is drawing a weapon, FALSE otherwise
Warning
This function is only available in Gothic 2
Npc_IsDrawingSpell
Npc_IsDrawingSpell
Checks if the NPC is drawing a spell, but by the oCMsgMagic
events. Not sure if it works
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns spell ID if the NPC is drawing a spell, -1 otherwise
Warning
This function is only available in Gothic 2
Npc_RefuseTalk
Npc_RefuseTalk
Checks if the NPC refuses to talk
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC refuses to talk, FALSE otherwise
Npc_SetRefuseTalk
Npc_SetRefuseTalk
Sets the NPC to refuse to talk for a specified time
Parameters
var C_NPC npc
- instance of the NPCvar int timesec
- time in seconds
Npc_HasItems
Npc_HasItems
Checks if the NPC has a specified item in inventory
Parameters
var C_NPC npc
- instance of the NPCvar int iteminstance
- instance of the item
Return value
The function returns amount of the item in inventory, 0 if not found
Npc_OwnedByNpc
Npc_OwnedByNpc
Checks if itm
is owned by the NPC
Parameters
var C_ITEM itm
- instance of the itemvar C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the item is owned by the NPC, FALSE otherwise
Npc_OwnedByGuild
Npc_OwnedByGuild
Checks if itm
is owned by the guild
Parameters
var C_ITEM itm
- instance of the itemvar int guild
- int guild ID
Return value
The function returns TRUE if the item is owned by the guild, FALSE otherwise
Npc_PerceiveAll
Npc_PerceiveAll
Makes the NPC perceive all objects in the sense range
Parameters
var C_NPC npc
- instance of the NPC
Npc_SetPercTime
Npc_SetPercTime
Sets the perception time of the NPC
Parameters
var C_NPC npc
- instance of the NPCvar float time
- float time in seconds
Npc_PercEnable
Npc_PercEnable
Enables the perception of the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int percid
- perception IDvar func function
- function associated with the perception
Npc_PercDisable
Npc_PercDisable
Disables the perception of the NPC
Parameters
var C_NPC npc
- instance of the NPCvar int percid
- perception ID
Npc_SendPassivePerc
Npc_SendPassivePerc
Sends a passive perception to the slf
Parameters
var C_NPC slf
- instance of the NPCvar int percid
- perception IDvar C_NPC oth
- instance of the other NPCvar C_NPC vic
- instance of the victim NPC
Npc_SendSinglePerc
Npc_SendSinglePerc
Sends a single perception to the target
(executes the perception function)
Parameters
var C_NPC sender
- instance of the other NPCvar C_NPC target
- instance of the NPCvar int percid
- perception ID
Npc_IsDead
Npc_IsDead
Checks if the NPC is dead
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC is dead, FALSE otherwise
Npc_GiveItem
Npc_GiveItem
Takes the item from the giver
inventory and gives it to the taker
Parameters
var C_NPC giver
- instance of the giver NPCvar int iteminstance
- instance name of the itemvar C_NPC taker
- instance of the taker NPC
Rtn_Exchange
Rtn_Exchange
Changes the current daily routine of the self
to the specified new routine
Parameters
var string oldroutine
- name of the old routine (have to be active)var string newroutine
- name of the new routine
Deprecated
Npc_CheckAvailableMission
Npc_CheckAvailableMission
Relic of the old mission system
Npc_CheckOfferMission
Npc_CheckOfferMission
Relic of the old mission system
Npc_CheckRunningMission
Npc_CheckRunningMission
Relic of the old mission system
Npc_CreateSpell
Npc_CreateSpell
Supposed to add spell the mag book
Parameters
self
- instance of the NPCvar int spellnr
- spell number
Npc_LearnSpell
Npc_LearnSpell
Supposed to add spell to the mag book if NPC doesn't know it
Parameters
var C_NPC npc
- instance of the NPCvar int spellnr
- spell number
Npc_GetActiveSpellLevel
Npc_GetActiveSpellLevel
Not used in the original scripts, gets the level of the spell currently active on the NPC's hand, although it is unknown what 'level' means
Parameters
var C_NPC npc
- instance of the NPC to check
Return value
The function returns level of the active spell
Npc_IsInCutscene
Npc_IsInCutscene
Relic of the cutscene system
Checks if the NPC is in a cutscene
Parameters
var C_NPC npc
- instance of the NPC
Return value
The function returns TRUE if the NPC is in a cutscene, FALSE otherwise
Npc_StartItemReactModules
Npc_StartItemReactModules
Relic of the old trade system
Checks slf
itemreact modules of the itm
form oth
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPCvar C_ITEM itm
- instance of the item
Return value
The function returns TRUE if the itemreact modules are found, FALSE otherwise
Npc_HasOffered
Npc_HasOffered
Relic of the old trade system
Checks slf
offered oth
the item
Parameters
var C_NPC slf
- instance of the NPCvar C_NPC oth
- instance of the other NPC (player)var int iteminstance
- instance name of the item
Return value
The function returns TRUE if the itemreact modules are found, FALSE otherwise
Npc_MemoryEntry
Npc_MemoryEntry
Not used in the original scripts, the idea was that it created a news/memory entry that allows NPCs to track and react to witnessed events.
Parameters
var C_NPC witness
- instance of the NPC who will receive this memoryvar int source
- type of the news/eventvar C_NPC offender
- instance of the NPC who performed the actionvar int newsid
- ID of the event typevar C_NPC vic
- instance of the NPC affected by the action (victim)
Npc_MemoryEntryGuild
Npc_MemoryEntryGuild
Not used in the original scripts, creates a guild-related news/memory entry that allows NPCs to track and react to witnessed events.
Similar to Npc_MemoryEntry() but marks the news as guild-related, meaning it affects guild attitudes and reactions rather than just individual NPCs.
Parameters
var C_NPC witness
- instance of the NPC who will receive this memoryvar int source
- type of the news/eventvar C_NPC offender
- instance of the NPC who performed the actionvar int newsid
- ID of the event typevar C_NPC vic
- instance of the NPC affected by the action (victim)
Npc_HasNews
Npc_HasNews
Not used in the original scripts, checks if NPC has a specific news entry in their memory
Parameters
var C_NPC slf
- instance of the NPC to checkvar int newsID
- ID of the news to findvar C_NPC offender
- optional (can be NULL) offender to matchvar C_NPC vic
- optional (can be NULL) victim to match
Return value
The function returns news number >0 if found, 0 if not found
Npc_IsNewsGossip
Npc_IsNewsGossip
Not used in the original scripts, checks if a specific news entry is gossip (heard from others) vs witnessed
Parameters
var C_NPC npc
- NPC owning the newsvar int newsNumber
- ID number of the news entry to check
Return value The function returns >0 if news is gossip, 0 if directly witnessed
Npc_GetNewsWitness
Npc_GetNewsWitness
Not used in the original scripts, gets the NPC who witnessed the specified news event
Parameters
var C_NPC npc
- NPC owning the newsvar int newsNumber
- ID number of the news entry
Return value
The function returns C_NPC instance of the witness
Npc_GetNewsVictim
Npc_GetNewsVictim
Not used in the original scripts, gets the victim of the specified news event
Parameters
var C_NPC npc
- NPC owning the newsvar int newsNumber
- ID number of the news entry
Return value
The function returns C_NPC instance of the victim
/// [deprecated] Not used in the original scripts, gets the victim of the specified news event. /// @param npc NPC owning the news /// @param newsNumber ID number of the news entry /// @return C_NPC instance of the victim func C_NPC Npc_GetNewsVictim(var C_NPC npc, var int newsNumber) {};
Npc_GetNewsOffender
Npc_GetNewsOffender
Not used in the original scripts, gets the offender of the specified news event
Parameters - var C_NPC npc
- NPC owning the news - var int newsNumber
- ID number of the news entry
Return value The function returns C_NPC instance of the offender
Npc_DeleteNews
Npc_DeleteNews
Not used in the original scripts, deletes a specific news entry from an NPC's memory
Parameters
var C_NPC npc
- NPC whose news entry should be deletedvar int newsNumber
- ID number of the news entry to delete
Return value
The function returns TRUE if the news was successfully deleted, FALSE otherwise
zParserExtender
zParserExtender implements quite a few new NPC external functions.