Constructor






Methods


PartyMember:addFlag(name: any, amount: number?)

Adds amount to a numeric flag for this party member named flag (or defines it if it does not exist)

@param flag — The name of the flag to add to

@param amount — (Defaults to 1)

Arguments:

name: any
amount: number?

(Defaults to 1)

Returns:

new_value: number


PartyMember:addSpell(spell: string|Spell)

Adds a spell to this party member's set of available spells

Arguments:

spell: string|Spell

Spells are data files that extend this Spell class to define a castable spell.
Spells are stored in scripts/data/spells, and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class(). Spells are learned by PartyMembers, and they can be given a spell by calling PartyMember:addSpell() (likewise, PartyMember:removeSpell() removes a spell).



PartyMember:addStatBuff(stat: string, amount: number, max: number?)

Adds to one of this party member's current stat buffs

Arguments:

stat: string
amount: number
max: number?


PartyMember:autoHealAmount()

(Override) Gets the amount of health this party member should heal each turn whilst DOWN in battle

Returns:

1: number






PartyMember:canEquip(item: Item|nil, slot_type: string, slot_index: integer)

(Override) Checks whether this party member is able to equip a specific item
By default, calls item:canEquip() to check equippability, and rejects trying to unequip the item if the slot type is "weapon"

Arguments:

item: Item|nil

The Item class represents all types of item in Kristal.
Items are data files contained in scripts/data/items that should extend this class or one of its extensions (see below), and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class().
There are extensions of item that provide additional functionality when extended from: HealItem and TensionItem
Items that are Light World equipment should extend LightEquipItem instead of this class (it provides all of the same fields and functions as Item).
Items can be given to the player directly in the code through Inventory:addItem().

slot_type: string
slot_index: integer

Returns:

1: boolean


PartyMember:checkArmor(id: string)

Checks whether this party member has the armor with id id equipped

Arguments:

id: string

Returns:

equipped: boolean
count: integer


PartyMember:checkWeapon(id: string)

Checks whether this party member has the weapon with id id equipped

Arguments:

id: string

Returns:

equipped: boolean






PartyMember:drawPowerStat(index: integer, x: number, y: number, menu: DarkPowerMenu)

(Override) Called every frame for each stat in the party member's Power menu.

@param index — The index of the power stat

@param x — The x-coordinate of the text

@param y — The y-coordinate of the text

@param menu — The current menu instance

Arguments:

index: integer

The index of the power stat

x: number

The x-coordinate of the text

y: number

The y-coordinate of the text

menu: DarkPowerMenu

The current menu instance



PartyMember:getActor(light: boolean?)

Arguments:

light: boolean?

Returns:

1: Actor


PartyMember:getArmor(i: integer)

Arguments:

i: integer

Returns:

1: Item












PartyMember:getBaseStat(name: string, default: number?, light: boolean?)

Arguments:

name: string
default: number?
light: boolean?

Returns:

1: number














PartyMember:getEquipmentBonus(stat: string)

Gets this party member's stat bonuses from equipment for a particular stat

Arguments:

stat: string

Returns:

1: number


PartyMember:getFlag(name: any, default: any)

Gets the value of the flag for this party member named flag, returning default if the flag does not exist

Arguments:

name: any
default: any

Returns:

1: unknown














PartyMember:getLightEXPNeeded(lv: any)

Arguments:

lv: any

Returns:

1: integer




PartyMember:getMaxStat(stat: string)

Arguments:

stat: string

Returns:

1: number












PartyMember:getReaction(item: Item, user: PartyMember)

Gets this party member's reaction for using or seeing someone use a particular item
By default, calls item:getReaction() for reaction text

Arguments:

item: Item

The Item class represents all types of item in Kristal.
Items are data files contained in scripts/data/items that should extend this class or one of its extensions (see below), and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class().
There are extensions of item that provide additional functionality when extended from: HealItem and TensionItem
Items that are Light World equipment should extend LightEquipItem instead of this class (it provides all of the same fields and functions as Item).
Items can be given to the player directly in the code through Inventory:addItem().

user: PartyMember

The PartyMember class is a type of data class that stores information about a member of the party.
PartyMembers are stored in scripts/data/party, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().

Returns:

1: string?








PartyMember:getStat(name: string, default: number?, light: boolean?)

Gets the full (buffs applied) stat value for one of the party member's stats

Arguments:

name: string
default: number?
light: boolean?

Returns:

1: number


PartyMember:getStatBuff(stat: string)

Arguments:

stat: string

Returns:

1: number




PartyMember:getStats(light: boolean?)

Arguments:

light: boolean?

Returns:

1: unknown
















PartyMember:hasSpell(spell: string|Spell)

Checks whether this party member has the spell spell

Arguments:

spell: string|Spell

Spells are data files that extend this Spell class to define a castable spell.
Spells are stored in scripts/data/spells, and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class(). Spells are learned by PartyMembers, and they can be given a spell by calling PartyMember:addSpell() (likewise, PartyMember:removeSpell() removes a spell).

Returns:

has_spell: boolean






PartyMember:heal(amount: number, playsound: boolean?)

Heals this party member

Arguments:

amount: number
playsound: boolean?

Returns:

full_heal: boolean


PartyMember:increaseStat(stat: string, amount: number, max: number?)

Increases one of this party member's stats permanently

Arguments:

stat: string
amount: number
max: number?


PartyMember:load(data: PartyMemberSaveData)

Arguments:

data: PartyMemberSaveData

Party Member data in the format it is saved to file



PartyMember:loadEquipment(data: table)

Arguments:

data: table


PartyMember:loadSpells(data: string[])

@param data — An array of the spell IDs this party member knows

Arguments:

data: string[]

An array of the spell IDs this party member knows



PartyMember:onActionBox(box: any, overworld: any)

Arguments:

box: any
overworld: any


PartyMember:onActionSelect(battler: PartyBattler, undo: boolean)

(Override) Called whenever this party member's action select turn starts

@param battler — The party member's associated battler

@param undo — Whether their previous action was just undone

Arguments:

battler: PartyBattler

The party member's associated battler

undo: boolean

Whether their previous action was just undone



PartyMember:onAttackHit(enemy: EnemyBattler, damage: number)

(Override) Called whenever this party member's attack hits an enemy in battle

Arguments:

enemy: EnemyBattler

EnemyBattlers are a type of Battler that represent enemies, defining all their properties and behaviours.
Every enemy defined in a mod should be located in its own file in scripts/battle/enemies/, and should extend this class.
Each enemy is assigned an id that defaults to their filepath starting from scripts/battle/enemies, unless an id is specified as an argument to Class().
Enemies are added to battles in the encounter, with Encounter:addEnemy(enemy, x, y, ...), where enemy is their unique id, and all enemies for the current battle reside in Game.battle.enemies

Recruit data is separate to enemies, see Recruit for how to set up a corresponding recruit.

damage: number


PartyMember:onEquip(item: Item, item2: Item?)

(Override) Called when the party member equips an item

@param item — The item being equipped

@param item2 — The item previously in its slot

@return can_continue — Whether the equip process will occur

Arguments:

item: Item

The item being equipped

item2: Item?

The item previously in its slot

Returns:

can_continue: boolean

Whether the equip process will occur



PartyMember:onLevelUp(level: integer)

(Override) Called whenever this party member levels up

@param level — The party member's new level

Arguments:

level: integer

The party member's new level



PartyMember:onLoad(data: PartyMemberSaveData)

(Override) Called whenever the party member's data is loaded

Arguments:

data: PartyMemberSaveData

Party Member data in the format it is saved to file



PartyMember:onPowerDeselect(menu: DarkPowerMenu)

(Override) Called whenever the party member stops being hovered over in the Overworld Power menu

@param menu — The current menu instance

Arguments:

menu: DarkPowerMenu

The current menu instance



PartyMember:onPowerSelect(menu: DarkPowerMenu)

(Override) Called whenever the party member is hovered over in the Overworld Power menu

@param menu — The current menu instance

Arguments:

menu: DarkPowerMenu

The current menu instance



PartyMember:onSave(data: PartyMemberSaveData)

(Override) Called whenever the party member's data is saved

Arguments:

data: PartyMemberSaveData

Party Member data in the format it is saved to file



PartyMember:onTurnStart(battler: PartyBattler)

(Override) Called whenever this party member's turn starts in battle

@param battler — The party member's associated battler

Arguments:

battler: PartyBattler

The party member's associated battler



PartyMember:onUnequip(item: Item, item2: Item?)

(Override) Called when the party member unequips an item

@param item — The item being unequipped

@param item2 — The item that will replace this item in its slot

@return can_continue — Whether the unequip process will occur

Arguments:

item: Item

The item being unequipped

item2: Item?

The item that will replace this item in its slot

Returns:

can_continue: boolean

Whether the unequip process will occur



PartyMember:removeSpell(spell: string|Spell)

Removes a spell from this party member's available spells

Arguments:

spell: string|Spell

Spells are data files that extend this Spell class to define a castable spell.
Spells are stored in scripts/data/spells, and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class(). Spells are learned by PartyMembers, and they can be given a spell by calling PartyMember:addSpell() (likewise, PartyMember:removeSpell() removes a spell).



PartyMember:replaceSpell(spell: string|Spell, replacement: string)

Replaces one of this party member's spells with another
If spell is not in this party member's spell list, they will not learn replacement

Arguments:

spell: string|Spell

Spells are data files that extend this Spell class to define a castable spell.
Spells are stored in scripts/data/spells, and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class(). Spells are learned by PartyMembers, and they can be given a spell by calling PartyMember:addSpell() (likewise, PartyMember:removeSpell() removes a spell).

replacement: string


PartyMember:resetBuff(stat: string)

Sets one of this party member's stat buffs back to nil

Arguments:

stat: string


PartyMember:resetBuffs()

Resets all of this party member's stat buffs







PartyMember:saveSpells()

@return spells — An array of the spell IDs this party member knows

Returns:

spells: string[]

An array of the spell IDs this party member knows



PartyMember:setActor(actor: string|Actor)

Changes this party member's Dark World actor

Arguments:

actor: string|Actor

Actors are a type of data class that represent the visuals of a character - anything that is some type of character, be it the player, an NPC, or an enemy in battle, it will require an actor.
As a data class, actors are stored in scripts/data/actors/, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().



PartyMember:setArmor(i: integer, item: string|Item)

Arguments:

i: integer
item: string|Item

The Item class represents all types of item in Kristal.
Items are data files contained in scripts/data/items that should extend this class or one of its extensions (see below), and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class().
There are extensions of item that provide additional functionality when extended from: HealItem and TensionItem
Items that are Light World equipment should extend LightEquipItem instead of this class (it provides all of the same fields and functions as Item).
Items can be given to the player directly in the code through Inventory:addItem().



PartyMember:setDarkTransitionActor(actor: string|Actor)

Changes this party member's Dark Transition actor

Arguments:

actor: string|Actor

Actors are a type of data class that represent the visuals of a character - anything that is some type of character, be it the player, an NPC, or an enemy in battle, it will require an actor.
As a data class, actors are stored in scripts/data/actors/, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().



PartyMember:setFlag(name: any, value: any)

Sets the value of the flag for this party member named flag to value

Arguments:

name: any
value: any


PartyMember:setHealth(health: number)

Sets this party member's health value

Arguments:

health: number


PartyMember:setLightActor(actor: string|Actor)

Changes this party member's Light World actor

Arguments:

actor: string|Actor

Actors are a type of data class that represent the visuals of a character - anything that is some type of character, be it the player, an NPC, or an enemy in battle, it will require an actor.
As a data class, actors are stored in scripts/data/actors/, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().



PartyMember:setStatBuff(stat: string, amount: number)

Sets one of this party member's stat buffs

Arguments:

stat: string
amount: number


PartyMember:setWeapon(item: string|Item)

Arguments:

item: string|Item

The Item class represents all types of item in Kristal.
Items are data files contained in scripts/data/items that should extend this class or one of its extensions (see below), and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class().
There are extensions of item that provide additional functionality when extended from: HealItem and TensionItem
Items that are Light World equipment should extend LightEquipItem instead of this class (it provides all of the same fields and functions as Item).
Items can be given to the player directly in the code through Inventory:addItem().




Fields










PartyMember.dark_transition_actor: Actor

Actors are a type of data class that represent the visuals of a character - anything that is some type of character, be it the player, an NPC, or an enemy in battle, it will require an actor.
As a data class, actors are stored in scripts/data/actors/, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().













PartyMember.lw_actor: Actor

Actors are a type of data class that represent the visuals of a character - anything that is some type of character, be it the player, an NPC, or an enemy in battle, it will require an actor.
As a data class, actors are stored in scripts/data/actors/, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().
























Undocumented



PartyMember.lw_exp: integer

Light world EXP (saved to the save file)





PartyMember.lw_exp_needed: table

Light world EXP requirements



PartyMember.stronger_absent: table

Party members which will also get stronger when this character gets stronger, even if they're not in the party