C_NPC Daedalus class
Class C_Npc describes the character and monsters1. The playable character is also an NPC.
Tip
You can call externals inside the instance of C_NPC class e.g. to give an item or customize look of the NPC.
Class definition
C_Npc class definition differs between Gothic 1 and Gothic 2 Addon.
Class definition as it is defined in Scripts/Content/_intern/Classes.d script file.
C_Npc Daedalus class
Class definition as it is defined in Scripts/Content/_intern/Classes.d script file.
C_Npc Daedalus class
Class members
| variable | Type | Description |
|---|---|---|
| id | int | NPC id |
| name | string | NPC name |
| slot | string | Slot (deprecated) |
| effect | string | Visual effect (only in G2A) |
| npcType | int | NPC type |
| flags | int | NPC flags |
| attribute | int | NPC attribute values |
| hitChance | int | NPC fight skill values (only in G2A) |
| protection | int | NPC protection against damage types |
| damage | int | NPC damage values |
| damagetype | int | NPC damage type |
| guild | int | NPC guild |
| level | int | NPC level |
| mission | func | Missions (deprecated) |
| fight_tactic | int | NPC fight tactic |
| weapon | int | Current comabt mode |
| voice | int | SVM voice assigned to the NPC |
| voicePitch | int | Pitch of the voice |
| bodymass | int | Body mass (deprecated) |
| daily_routine | func | Starting daily routine of the NPC |
| start_aistate | func | Starting AI state of the NPC |
| spawnPoint | string | Spawn point (deprecated) |
| spawnDelay | int | Spawn delay (deprecated) |
| senses | int | NPC senses |
| senses_range | int | NPC senses range |
| aivar | int | NPC AI variables |
| wp | string | Currently tracked waypoint |
| exp | int | Experience points |
| exp_next | int | Experience points needed for the next level |
| lp | int | Learning points |
| bodyStateinterruptableOverride | int | Possibility to interrupt the current body state (only in G2A) |
| noFocus | int | Disable focus on the NPC (only in G2A) |
Class member overview
Description of the class member variables.
id
Unique identification number used for human NPCs.
name
Name of the NPC. Only the first name from array is used.
slot
Deprecated setting
Slot.
effect
VFX visual effect aplied to the NPC. The effect must be defined as CFx_Base instance.
Warning
This property is only available in Gothic 2 Addon.
npcType
Type of NPC.
NPC type constants are defined in Scripts/Content/AI/AI_Intern/AI_Constants.d file.
NPC type constants are defined in Scripts/Content/AI/AI_Intern/AI_Constants.d file.
flags
NPC flags.
NPC flag constants are defined in Scripts/Content/_intern/Constants.d file.
NPC flag constants are defined in Scripts/Content/_intern/Constants.d file.
attribute
Array of NPC attribute values.
Attribute constants are defined in Scripts/Content/_intern/Constants.d file.
Note
Some attributes are associated with C_MENU_ITEM predefined instances.
| Attribute | Menu item instance |
|---|---|
| ATR_STRENGTH | MENU_ITEM_ATTRIBUTE_1 |
| ATR_DEXTERITY | MENU_ITEM_ATTRIBUTE_2 |
| ATR_MANA | MENU_ITEM_ATTRIBUTE_3 |
| ATR_HITPOINTS | MENU_ITEM_ATTRIBUTE_4 |
hitChance
Array of NPC skill for fighting with different types of weapons.
NPC talents constants are defined in Scripts/Content/_intern/Constants.d file.
Warning
This property is only available in Gothic 2 Addon.
protection
Array of NPC protection values against different types of damage.
Protection constants are defined in Scripts/Content/_intern/Constants.d file.
damage
Array of maximum damage values inflicted by the NPC for different types of damage. Used with damagetype property.
Damage type constants are defined in Scripts/Content/_intern/Constants.d file.
damagetype
Type of damage inflicted by the NPC. Used with damage property.
Tip
You can combine multiple damage types using the bitwise OR operator |.
Damage type constants are defined in Scripts/Content/_intern/Constants.d file.
guild
NPC guild. Guilds differ between Gothic 1 and Gothic 2 Addon, but could be devided into two main groups - human and animal.
Guild constants are defined in Scripts/Content/_intern/Constants.d file.
Relations between human guilds are specified in GIL_ATTITUDES array inside the Scripts/Content/Story/Guilds.d file.
Guild constants are defined in Scripts/Content/_intern/Constants.d file.
Relations between human guilds are specified in GIL_ATTITUDES array inside the Scripts/Content/AI/Human/Guilds.d file.
Info
General parameters for each guild are specified inside the instance of the C_GilValues class.
level
Current level of the NPC.
Logic for hero leveling is implemented in the B_GiveXP function.
Logic for hero leveling is implemented in the B_GivePlayerXP function.
Note
This property is available in menu as MENU_ITEM_LEVEL predefined instance of the C_MENU_ITEM class.
mission
Deprecated setting
Array of missions assigned to the NPC.
fight_tactic
NPC fight tactic. Tactics are described by the C_FightAI class instances and each tactic has its own index.
Fight tactic constants are defined in Scripts/Content/AI/AI_Intern/AI_Constants.d file.
Fight tactic constants are defined in Scripts/Content/AI/AI_Intern/AI_Constants.d file.
weapon
Current combat mode of the NPC. Property is never used in the game scripts but should work with following constants.
voice
Voice assigned to the NPC. This is used for C_SVM instances.
For example, if the NPC has voice property set to 1, it will use the SVM_1 instance of the C_SVM class.
voicePitch
Pitch of the voice. Accepts values from -5 to 5.
Note
When the pitch is lowered, the playback speed is decreased and overlaing may occur.
bodymass
Deprecated setting
Body mass of the NPC.
daily_routine
Function defining the starting daily routine of the NPC.
All routine functions start with the Rtn_ prefix and end with NPC id as suffix. For example, the Start routine of the npc with id 1 will be defined like this:
Instide the function body should be TA_ function calls defining the routine actions. It is important to remember that the routine have to contain at least two functions.
To Change the daily routine use the Npc_ExchangeRoutine function.
start_aistate
Function defining the starting AI state of the NPC. Used mainly for monsters and animals that do not have a daily routine.
spawnPoint
Deprecated setting
Spawn point of the NPC.
spawnDelay
Deprecated setting
Spawn delay of the NPC.
senses
Active NPC senses. Used with senses_range property.
Senses constants are defined in Scripts/Content/_intern/Constants.d file.
senses_range
Range of active NPC senses in cm.
aivar
Array of NPC AI variables. Used inside the NPC AI scripts.
Array has 50 elements.
Aivar constants are defined in Scripts/Content/AI/AI_Intern/AI_Constants.d file.
Array has 100 elements.
Aivar constants are defined in Scripts/Content/AI/AI_Intern/AI_Constants.d file.
wp
Currently tracked waypoint. Used with the pathfinding system.
exp
Current experience points of the NPC.
See level property for more information about leveling.
Note
This property is available in menu as MENU_ITEM_EXP predefined instance of the C_MENU_ITEM class.
exp_next
Experience points needed for the next level.
See level property for more information about leveling.
Note
This property is available in menu as MENU_ITEM_LEVEL_NEXT predefined instance of the C_MENU_ITEM class.
lp
Current learning points of the NPC. Optained when the NPC levels up.
See level property for more information about leveling.
Note
This property is available in menu as MENU_ITEM_LEARN predefined instance of the C_MENU_ITEM class.
bodyStateinterruptableOverride
Possibility to interrupt the current body state.
Warning
This property is only available in Gothic 2 Addon.
noFocus
Disable focus on the NPC. The NPC will not be highlighted when the player looks at it.
Warning
This property is only available in Gothic 2 Addon.
-
Heavily inspired by the amazing documentation site Gothic library ↩