Skip to content

TrainerInteraction ​

Inherits: Interaction < Resource

A trainer: using the NPC or the object opens a list of lessons that the player can buy (abilities, ranks, proficiency levels, professions, tiers, specializations, recipes). The lessons are the ones of a TrainerDefinition. Like the vendor, it can sit on any entity or object that has interactions.

Properties ​

inttrainer_definition_id
SFXSelectionopen_sfx
AnimationSelectionSocialopen_animation

Variables ​

booltraining_is_activefalse
Playercurrent_learner

Methods ​

boolcan_interact( player: Player )
voidstart_interaction( player: Player )
voidend_interaction()
TrainerDefinitionget_trainer_definition()
Array[Dictionary]get_offers( player: Player )
Dictionarylearn( lesson: TrainerLesson, player: Player )
voidcleanup()

Signals ​

lesson_learned( lesson: TrainerLesson, player: Player ) ​

A lesson was bought

Property descriptions ​

int trainer_definition_id ​

The trainer definition: the lessons and the prices

SFXSelection open_sfx ​

Optional audio to play when the lessons open

AnimationSelectionSocial open_animation ​

Optional animation to play when the lessons open

Variable descriptions ​

bool training_is_active = false ​

Whether the list of lessons is open

Player current_learner ​

The player who is looking at the lessons

Method descriptions ​

bool can_interact( player: Player ) ​

Can the player use it: the trainer exists and the requirements are met?

void start_interaction( player: Player ) ​

Opens the list of lessons.

void end_interaction() ​

Closes the list of lessons.

TrainerDefinition get_trainer_definition() ​

The trainer this interaction opens.

Array[Dictionary] get_offers( player: Player ) ​

The lessons the player is shown: the ones that are not hidden for them, each with its offer

Dictionary learn( lesson: TrainerLesson, player: Player ) ​

The player buys a lesson. Returns {"success", "reason"}; says so to the player

void cleanup() ​

Give the timer back (the object is going away)