Skip to content

Talents

The Talents package does two things:

  1. save any number of values for a specific NPC (effectively AIVar array extension).
  2. identify NPC by unique ID.

Talents package uses one free AIVar variables, the default is AIVar with the index 89 that can be customized in Userconst.d the AIV_TALENT constant.

Dependencies

Initialization

Initialize with LeGo_PermMem flag.

LeGo_Init(LeGo_PermMem);

Implementation

Talents.d on GitHub

Functions

Npc_GetID

Returns unique ID specific for provided NPC.

func int Npc_GetID(var C_NPC slf)
Parameters
  • var C_NPC slf
    NPC to get ID

Return value

The function returns NPCs unique ID.

Npc_FindByID

Finds the NPC pointer of an NPC with the given ID.

func int Npc_FindByID(var int ID)
Parameters
  • var int ID
    NPC ID

Return value

The function returns NPC pointer.

TAL_CreateTalent

Creates a talent into which you can later save a value for every NPC (just like AI_Var).

func int TAL_CreateTalent()
Return value

The function returns value that can be later used as a talent ID.

TAL_SetValue

Sets a new value to the specified talent.

func void TAL_SetValue(var C_NPC npc, var int talent, var int value)
Parameters
  • var C_NPC npc
    Set the talent value for this NPC
  • var int talent
    Talent ID
  • var int value
    Value to be set

TAL_GetValue

Returns the value of a saved talent for specified NPC.

func int TAL_GetValue(var C_NPC npc, var int talent)
Parameters
  • var C_NPC npc
    Get the talent value from this NPC
  • var int talent
    Talent ID