Skip to content

NpcLevels ​

Inherits: RefCounted

The level of an NPC and the experience it gives, by the settings of the project (Gameplay Config: NPC Level Scaling and Kill Experience).

Description ​

  • Level scaling. When an NPC is made it takes the level of its definition (or of the placed NPC), and, if the project scales NPC levels, that level is

moved towards the level of the party (scaled_level). The level is fixed from then on: an NPC does not change level while it lives or when the player switches character; a saved NPC keeps the level it had. The entity types of an NPC (elite, rare, boss) can change how it scales (EntityTagDefinition.level_scaling).

  • Kill experience. What a defeated NPC gives: the settings' amount for its (scaled) level, times the multipliers of its definition, of the placed NPC and of

its entity types (kill_experience). See section 7 of the entity document in docs/systems.

Methods ​

intreference_level( party_manager: PartyManager, config: GameplayConfig = null ) static
Arrayentity_types_of( entity: Entity ) static
intscaled_level( npc: Entity, base_level: int, party_manager: PartyManager ) static
PartyManagerparty_manager_of( npc: Entity ) static
intbase_level_of( npc: NPC ) static
boolrescale( npc: NPC, party_manager: PartyManager ) static
floatexperience_multiplier( npc: NPC ) static
intkill_experience( npc: NPC ) static

Method descriptions ​

int reference_level( party_manager: PartyManager, config: GameplayConfig = null ) ​

The level the NPCs scale to: the party's average, the highest of the party, or the character in control. 0 when there is no party yet (nothing to scale to)

Array entity_types_of( entity: Entity ) ​

The entity types (EntityTagDefinition) of an entity, in the order of its list

int scaled_level( npc: Entity, base_level: int, party_manager: PartyManager ) ​

The level an NPC takes when it is made: base_level (its definition or its placed NPC) moved by the scaling settings of the project

PartyManager party_manager_of( npc: Entity ) ​

The party manager an NPC can reach (null when it has no world yet)

int base_level_of( npc: NPC ) ​

The level the NPC has by its definition or its placed NPC, before any scaling

bool rescale( npc: NPC, party_manager: PartyManager ) ​

Gives a living NPC the level the party needs now (after a respawn, a level-up of the party ...). An NPC in a fight waits for the fight to end. Returns true when the level changed

float experience_multiplier( npc: NPC ) ​

The multiplier on the experience of an NPC from its definition, its placed NPC and its entity types

int kill_experience( npc: NPC ) ​

The experience a defeated NPC gives