FrameworkZ 4.4.2
Provides a framework for Project Zomboid with various systems.
Loading...
Searching...
No Matches
CHARACTER Class Reference

Character class for FrameworkZ. More...

Public Member Functions

void Destroy ()
 Destroy a character. This will remove the character from the list of characters and is usually called after a player has disconnected.
 
table GetInventory ()
 Get the character's inventory object.
 
void GetName (name)
 
boolean GiveItem (uniqueID)
 Give a character an item.
 
void GiveItems (uniqueID, amount)
 Give a character items by the specified amount.
 
string Initialize ()
 Initialize a character.
 
void InitializeDefaultItems ()
 Initialize the default items for a character based on their faction. Called when FZ_CHAR mod data is first created.
 
boolean IsCitizen ()
 Checks if a character is a citizen.
 
boolean IsCombine ()
 Checks if a character is a combine.
 
void OnLoad ()
 
void OnPostLoad (firstLoad)
 
void OnPreLoad ()
 
boolean Save (shouldTransmit)
 Save the character's data from the character object.
 
void SetAge (age)
 Set the age of the character.
 
void SetDescription (description)
 Set the description of the character.
 
void SetFaction (faction)
 Set the faction of the character.
 
void SetName (name)
 Set the name of the character.
 
boolean TakeItem (itemID)
 Take an item from a character's inventory.
 
boolean TakeItemByInstanceID (itemID, instanceID)
 Take an item from a character's inventory by its instance ID. Useful for taking a specific item from a stack.
 
boolean ValidateCharacterData ()
 Validate the character's data.
 

Data Fields

CHARACTER __index
 

Detailed Description

Character class for FrameworkZ.

Definition at line 147 of file Characters.lua.

Member Function Documentation

◆ Destroy()

void Destroy ( )

Destroy a character. This will remove the character from the list of characters and is usually called after a player has disconnected.

◆ GetInventory()

table GetInventory ( )

Get the character's inventory object.

Returns
table The character's inventory object.

◆ GetName()

void GetName ( name )

◆ GiveItem()

boolean GiveItem ( uniqueID )

Give a character an item.

Parameters
uniqueIDstring The ID of the item to give.
Returns
boolean Whether or not the item was successfully given.

◆ GiveItems()

void GiveItems ( uniqueID ,
amount  )

Give a character items by the specified amount.

Parameters
itemIDstring The ID of the item to give.
amountinteger The amount of the item to give.

◆ Initialize()

string Initialize ( )

Initialize a character.

Returns
string username

◆ InitializeDefaultItems()

void InitializeDefaultItems ( )

Initialize the default items for a character based on their faction. Called when FZ_CHAR mod data is first created.

◆ IsCitizen()

boolean IsCitizen ( )

Checks if a character is a citizen.

Returns
boolean Whether or not the character is a citizen.

◆ IsCombine()

boolean IsCombine ( )

Checks if a character is a combine.

Returns
boolean Whether or not the character is a combine.

◆ OnLoad()

void OnLoad ( )

◆ OnPostLoad()

void OnPostLoad ( firstLoad )

◆ OnPreLoad()

void OnPreLoad ( )

◆ Save()

boolean Save ( shouldTransmit )

Save the character's data from the character object.

Parameters
shouldTransmitboolean (Optional) Whether or not to transmit the character's data to the server.
Returns
boolean Whether or not the character was successfully saved.

◆ SetAge()

void SetAge ( age )

Set the age of the character.

Parameters
ageinteger The age of the character.

◆ SetDescription()

void SetDescription ( description )

Set the description of the character.

Parameters
descriptionstring The description of the character's appearance.

◆ SetFaction()

void SetFaction ( faction )

Set the faction of the character.

Parameters
factionstring The ID of the faction to set on the character.

◆ SetName()

void SetName ( name )

Set the name of the character.

Parameters
namestring The new name for the character.

◆ TakeItem()

boolean TakeItem ( itemID )

Take an item from a character's inventory.

Parameters
itemIDstring The ID of the item to take.
Returns
boolean Whether or not the item was successfully taken.

◆ TakeItemByInstanceID()

boolean TakeItemByInstanceID ( itemID ,
instanceID  )

Take an item from a character's inventory by its instance ID. Useful for taking a specific item from a stack.

Parameters
itemIDstring The ID of the item to take.
instanceIDinteger The instance ID of the item to take.
Returns
boolean Whether or not the item was successfully taken.

◆ ValidateCharacterData()

boolean ValidateCharacterData ( )

Validate the character's data.

Returns
boolean Whether or not any of the character's new data was initialized.

Field Documentation

◆ __index

CHARACTER __index

Definition at line 149 of file Characters.lua.


The documentation for this class was generated from the following file: