Przejdź do treści

NPC - character functions

NPC related functions.

Functions

CreateInvItem

CreateInvItem

Adds the item to the NPC's inventory

func void CreateInvItem(var C_NPC npc, var int itm) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func void CreateInvItems(var C_NPC npc, var int itm, var int ammount) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int itm - instance name of the item
  • var int ammount - number of items to create

EquipItem

EquipItem

Creates and equips the item to the NPC

func void EquipItem(var C_NPC npc, var int itm) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int itm - instance name of the item

Npc_CanSeeItem

Npc_CanSeeItem

Checks if NPC can see item, includes angle check

func int Npc_CanSeeItem(var C_NPC npc, var C_ITEM itm) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_CanSeeNpc(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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)

func int Npc_CanSeeNpcFreeLOS(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_CanSeeSource(var C_NPC npc) 

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

func void Npc_ChangeAttribute(var C_NPC npc, var int attribute, var int value) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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)

func int Npc_KnowsPlayer(var C_NPC npc, var C_NPC player) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func void Npc_SetKnowsPlayer(var C_NPC npc, var C_NPC player) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var C_NPC player - instance of the player

Npc_CheckInfo

Npc_CheckInfo

Checks if the NPC has valid information (C_INFO) for the player

func int Npc_CheckInfo(var C_NPC npc, var int important) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int NPC_GiveInfo(var C_NPC npc, var int important) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_KnowsInfo(var C_NPC npc, var int infoinstance) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func void Npc_ClearAIQueue(var C_NPC 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

func void Npc_ClearInventory(var C_NPC npc) 

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

func int Npc_HasSpell(var C_NPC npc, var int spellid) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func void Npc_ExchangeRoutine(var C_NPC npc, var string routine) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var string routine - name of the new routine

Npc_GetActiveSpell

Npc_GetActiveSpell

Returns the active spell for the NPC (self or other)

func int Npc_GetActiveSpell(var C_NPC npc) 

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

func int Npc_GetActiveSpellCat(var C_NPC npc) 

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

func int Npc_GetActiveSpellIsScroll(var C_NPC npc) 

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

func int Npc_SetActiveSpellInfo(var C_NPC npc, var int instancename) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_GetAttitude(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_GetPermAttitude(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_GetBodyState(var C_NPC 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

func int Npc_GetComrades(var C_NPC npc) 

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

func string Npc_GetDetectedMob(var C_NPC 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

func int Npc_IsDetectedMobOwnedByNpc(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_IsDetectedMobOwnedByGuild(var C_NPC npc, var int guild) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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)

func int Npc_GetDistToItem(var C_NPC npc, var C_ITEM itm) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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)

func int Npc_GetDistToNpc(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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)

func int Npc_GetDistToPlayer(var C_NPC npc) 

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)

func int Npc_GetDistToWP(var C_NPC npc, var string wpname) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func C_ITEM Npc_GetEquippedArmor(var C_NPC 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

func C_ITEM Npc_GetEquippedMeleeWeapon(var C_NPC 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

func C_ITEM Npc_GetEquippedRangedWeapon(var C_NPC 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.

func int Npc_GetGuildAttitude(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC whose guild attitude should be checked
  • var 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)

func int Npc_GetHeightToItem(var C_NCP npc, var C_ITEM itm) 

Parameters

  • var C_NCP npc - instance of the NPC
  • var 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)

func int Npc_GetHeightToNpc(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_GetInvItem(var C_NPC npc, var int iteminstance) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_GetInvItemBySlot(var C_NPC npc, var int category, var int slotnr) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int category - category of the item
  • var 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

func int Npc_RemoveInvItem(var C_NPC npc, var int iteminstance) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_RemoveInvItems(var C_NPC npc, var int iteminstance, var int ammount) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int iteminstance - instance name of the item
  • var 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.

func int Npc_GetLastHitSpellCat(var C_NPC 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.

func int Npc_GetLastHitSpellID(var C_NPC 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

func C_NPC Npc_GetLookAtTarget(var C_NPC npc) 

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

func string Npc_GetNearestWP(var C_NPC 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

func string Npc_GetNextWP(var C_NPC 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

func int Npc_GetPortalGuild(var C_NPC npc) 

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

func C_NPC Npc_GetPortalOwner(var C_NPC npc) 

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

func C_ITEM Npc_GetReadiedWeapon(var C_NPC 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

func int Npc_GetStateTime(var C_NPC 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

func void Npc_SetStateTime(var C_NPC npc, var int timesec) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int timesec - new state time in seconds

Npc_GetTalentSkill

Npc_GetTalentSkill

Gets the talent skill of the NPC (major talent value)

func int Npc_GetTalentSkill(var C_NPC npc, var int talent) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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)

func int Npc_GetTalentValue(var C_NPC npc, var int talent) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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)

func void Npc_SetTalentSkill(var C_NPC npc, var int talent, var int value) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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)

func void Npc_SetTalentValue(var C_NPC npc, var int talent, var int value) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_HasRangedWeaponWithAmmo(var C_NPC npc) 

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

func int Npc_HasEquippedWeapon(var C_NPC npc) 

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

func int Npc_HasEquippedMeleeWeapon(var C_NPC npc) 

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

func int Npc_HasEquippedRangedWeapon(var C_NPC npc) 

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

func int Npc_HasEquippedArmor(var C_NPC npc) 

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

func int Npc_HasReadiedWeapon(var C_NPC npc) 

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

func int Npc_HasReadiedMeleeWeapon(var C_NPC npc) 

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

func int Npc_HasReadiedRangedWeapon(var C_NPC npc) 

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)

func int Npc_IsWayBlocked(var C_NPC npc) 

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

func int Npc_IsAiming(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_IsInFightMode(var C_NPC npc, var int mode) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func void Npc_SetAttitude(var C_NPC npc, var int attitude) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int attitude - attitude value (ATT_ constants)

Npc_SetTempAttitude

Npc_SetTempAttitude

Sets the temporary attitude of the NPC

func void Npc_SetTempAttitude(var C_NPC npc, var int attitude) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int attitude - attitude value (ATT_ constants)

Npc_SetToFightMode

Npc_SetToFightMode

Sets the NPC to fight mode with the specified weapon (weapon is created)

func void Npc_SetToFightMode(var C_NPC npc, var int weapon) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int weapon - instance name of the weapon

Npc_SetToFistMode

Npc_SetToFistMode

Sets the NPC to fist fight mode (no weapon) e.g. for monsters

func void Npc_SetToFistMode(var C_NPC npc) 

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

func int Npc_AreWeStronger(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_IsVoiceActive(var C_NPC npc) 

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

func int Npc_HasBodyFlag(var C_NPC npc, var int flag) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func void Npc_SetTarget(var C_NPC npc, var C_NPC target) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var C_NPC target - instance of the new target

Npc_GetTarget

Npc_GetTarget

Gets the target of the NPC

func int Npc_GetTarget(var C_NPC 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.

func int Npc_GetNextTarget(var C_NPC 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.

func int Npc_IsNextTargetAvailable(var C_NPC npc) 

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

func int Npc_SetTrueGuild(var C_NPC npc, var int guild) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_GetTrueGuild(var C_NPC 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

func int Npc_IsOnFP(var C_NPC npc, var string fpname) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func void Npc_PlayAni(var C_NPC npc, var string aniname) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var string aniname - name of the animation UPPERCASE

Npc_StopAni

Npc_StopAni

Makes the NPC stop the specified animation

func void Npc_StopAni(var C_NPC npc, var string aniname) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_IsNear(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_IsPlayer(var C_NPC npc) 

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

func int Npc_IsInState(var C_NPC npc, var func state) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_WasInState(var C_NPC npc, var func state) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_IsInRoutine(var C_NPC npc, var func state) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_HasDetectedNpc(var C_NPC slf, var C_NPC oth) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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

func int Npc_WasPlayerInMyRoom(var C_NPC npc) 

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

func int Npc_IsInPlayersRoom(var C_NPC npc) 

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

func int Npc_IsPlayerInMyRoom(var C_NPC 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

func int Npc_IsDrawingWeapon(var C_NPC npc) 

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

func int Npc_IsDrawingSpell(var C_NPC npc) 

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

func int Npc_RefuseTalk(var C_NPC npc) 

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

func void Npc_SetRefuseTalk(var C_NPC npc, var int timesec) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int timesec - time in seconds

Npc_HasItems

Npc_HasItems

Checks if the NPC has a specified item in inventory

func int Npc_HasItems(var C_NPC npc, var int iteminstance) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_OwnedByNpc(var C_ITEM itm, var C_NPC npc) 

Parameters

  • var C_ITEM itm - instance of the item
  • var 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

func int Npc_OwnedByGuild(var C_ITEM itm, var int guild) 

Parameters

  • var C_ITEM itm - instance of the item
  • var 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

func void Npc_PerceiveAll(var C_NPC npc) 

Parameters

  • var C_NPC npc - instance of the NPC

Npc_SetPercTime

Npc_SetPercTime

Sets the perception time of the NPC

func void Npc_SetPercTime(var C_NPC npc, var float time) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var float time - float time in seconds

Npc_PercEnable

Npc_PercEnable

Enables the perception of the NPC

func void Npc_PercEnable(var C_NPC npc, var int percid, var func function) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int percid - perception ID
  • var func function - function associated with the perception

Npc_PercDisable

Npc_PercDisable

Disables the perception of the NPC

func void Npc_PercDisable(var C_NPC npc, var int percid) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int percid - perception ID

Npc_SendPassivePerc

Npc_SendPassivePerc

Sends a passive perception to the slf

func void Npc_SendPassivePerc(var C_NPC slf, var int percid, var C_NPC oth, var C_NPC vic) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var int percid - perception ID
  • var C_NPC oth - instance of the other NPC
  • var C_NPC vic - instance of the victim NPC

Npc_SendSinglePerc

Npc_SendSinglePerc

Sends a single perception to the target (executes the perception function)

func void Npc_SendSinglePerc(var C_NPC sender, var C_NPC target, var int percid) 

Parameters

  • var C_NPC sender - instance of the other NPC
  • var C_NPC target - instance of the NPC
  • var int percid - perception ID

Npc_IsDead

Npc_IsDead

Checks if the NPC is dead

func int Npc_IsDead(var C_NPC npc) 

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

func void Npc_GiveItem(var C_NPC giver, var int iteminstance, var C_NPC taker) 

Parameters

  • var C_NPC giver - instance of the giver NPC
  • var int iteminstance - instance name of the item
  • var 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

func void Rtn_Exchange(var string oldroutine, var string newroutine) 

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

func int Npc_CheckAvailableMission(var C_NPC npc, var int missionstate, var int important) 

Npc_CheckOfferMission

Npc_CheckOfferMission

Relic of the old mission system

func int Npc_CheckOfferMission(var C_NPC npc, var int important) 

Npc_CheckRunningMission

Npc_CheckRunningMission

Relic of the old mission system

func int Npc_CheckRunningMission(var C_NPC npc, var int important) 

Npc_CreateSpell

Npc_CreateSpell

Supposed to add spell the mag book

func void Npc_CreateSpell(var C_NPC npc, var int spellnr) 

Parameters

  • self - instance of the NPC
  • var int spellnr - spell number

Npc_LearnSpell

Npc_LearnSpell

Supposed to add spell to the mag book if NPC doesn't know it

func void Npc_LearnSpell(var C_NPC npc, var int spellnr) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var 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

func int Npc_GetActiveSpellLevel(var C_NPC npc) 

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

func int Npc_IsInCutscene(var C_NPC npc) 

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

func int Npc_StartItemReactModules(var C_NPC slf, var C_NPC oth, var C_ITEM itm) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var C_NPC oth - instance of the other NPC
  • var 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

func int Npc_HasOffered(var C_NPC slf, var C_NPC oth, var int iteminstance) 

Parameters

  • var C_NPC slf - instance of the NPC
  • var 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.

func void Npc_MemoryEntry(var C_NPC witness, var int source, var C_NPC offender, var int newsid, var C_NPC vic) 

Parameters

  • var C_NPC witness - instance of the NPC who will receive this memory
  • var int source - type of the news/event
  • var C_NPC offender - instance of the NPC who performed the action
  • var int newsid - ID of the event type
  • var 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.

func void Npc_MemoryEntryGuild(var C_NPC witness, var int source, var C_NPC offender, var int newsid, var C_NPC vic) 

Parameters

  • var C_NPC witness - instance of the NPC who will receive this memory
  • var int source - type of the news/event
  • var C_NPC offender - instance of the NPC who performed the action
  • var int newsid - ID of the event type
  • var 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

func int Npc_HasNews(var C_NPC slf, var int newsID, var C_NPC offender, var C_NPC vic) 

Parameters

  • var C_NPC slf - instance of the NPC to check
  • var int newsID - ID of the news to find
  • var C_NPC offender - optional (can be NULL) offender to match
  • var 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

func int Npc_IsNewsGossip(var C_NPC npc, var int newsNumber) 

Parameters

  • var C_NPC npc - NPC owning the news
  • var 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

func C_NPC Npc_GetNewsWitness(var C_NPC npc, var int newsNumber) 

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 witness

Npc_GetNewsVictim

Npc_GetNewsVictim

Not used in the original scripts, gets the victim of the specified news event

func C_NPC Npc_GetNewsVictim(var C_NPC npc, var int newsNumber) 

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 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

func C_NPC Npc_GetNewsOffender(var C_NPC npc, var int newsNumber) 

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

func int Npc_DeleteNews(var C_NPC npc, var int newsNumber) 

Parameters

  • var C_NPC npc - NPC whose news entry should be deleted
  • var 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.