Project Zomboid Lua Docs 29123
Unofficial documentation for Project Zomboid's Lua
Loading...
Searching...
No Matches
Events

AcceptedFactionInvite

(Multiplayer) (Client) AcceptedFactionInvite: Triggered when receiving confirmation that a local player has accepted a faction invite.

Parameters

Name Type Notes
faction string Name of the faction.
username string Username of the faction leader.

AcceptedSafehouseInvite

(Multiplayer) (Client) AcceptedSafehouseInvite: Triggered when a player accepts an invite to a safehouse.

Parameters

Name Type Notes
safehouse string Name of the safehouse.
username string Username of the safehouse owner.

AcceptedTrade

(Multiplayer) (Client) AcceptedTrade: Triggered when the other player in the client's current trade accepts or declines the trade.

Parameters

Name Type Notes
accepted boolean Whether the trade was accepted.

AddXP

(Client) AddXP: Triggered after a local character gains perk XP, except when the XP source specifically requested not to.

Parameters

Name Type Notes
character IsoGameCharacter The character who gained the XP.
perk PerkFactory.Perk The perk XP was gained in.
amount number The amount of XP gained. This is the final value after all modifiers.

DoSpecialTooltip

DoSpecialTooltip: Triggered when updating the tooltip of an IsoObject with a special tooltip. Used for hover-over information about plants.

Parameters

Name Type Notes
tooltip ObjectTooltip Empty tooltip for the object.
square IsoGridSquare Square of the object the tooltip is being updated for.

EveryDays

EveryDays: Triggered at 0:00 every in-game day.

Parameters

None.

EveryHours

EveryHours: Triggered at the start of every in-game hour.

Parameters

None.

EveryOneMinute

EveryOneMinute: Triggered every in-game minute.

Parameters

None.

EveryTenMinutes

EveryTenMinutes: Triggered every ten in-game minutes.

Parameters

None.

GrappleGrabCollisionCheck

GrappleGrabCollisionCheck:

Parameters

Name Type Notes
character IsoGameCharacter
weapon HandWeapon

GrapplerLetGo

GrapplerLetGo: Triggered when a grappler lets go of their grappled target.

Parameters

Name Type Notes
character IsoGameCharacter The grappler.
result string The reason the grapple ended. 'Aborted' means the grapple was cancelled.

LevelPerk

(Client) LevelPerk: Triggered after a local character gains or loses a perk level.

Parameters

Name Type Notes
character IsoGameCharacter The character whose perk level changed.
perk PerkFactory.Perk The perk that changed level.
level integer The new level of the perk.
increased boolean True if the level increased, false if it decreased.

LoadChunk

LoadChunk:

Parameters

Name Type Notes
chunk IsoChunk

LoadGridsquare

LoadGridsquare: Triggered after a new square is loaded.

Parameters

Name Type Notes
square IsoGridSquare The square that was loaded.

MngInvReceiveItems

(Multiplayer) (Client) MngInvReceiveItems: Triggered when managing a remote player's inventory from the admin menu.

Parameters

Name Type Notes
inventory umbrella.MngInvItemTable Details of the player's inventory.

OnAIStateChange

(Client) OnAIStateChange: Triggered when a local zombie or any loaded player changes state.

Parameters

Name Type Notes
character IsoGameCharacter The character whose state changed.
currentState State The state the character changed to.
previousState State The character's previous state.

OnAcceptInvite

(Client) OnAcceptInvite: Triggered when the client accepts a steam invite to a server.

Parameters

Name Type Notes
connectString string Steamworks connection string. Takes the format of '+connect ip:port'

OnAddMessage

(Multiplayer) (Client) OnAddMessage: Triggered when a message is added to chat.

Parameters

Name Type Notes
message ChatMessage The message that was added.
tabId integer The ID of the tab the message was added to.

OnAdminMessage

(Multiplayer) (Client) OnAdminMessage: Triggered when a ticket is created and the local player is an admin.

Parameters

Name Type Notes
message string The text of the ticket.
x integer World X co-ordinate of the player who made the ticket.
y integer World Y co-ordinate of the player who made the ticket.
z integer World Z co-ordinate of the player who made the ticket.

OnAlertMessage

OnAlertMessage: See OnAddMessage

Parameters

Name Type Notes
message ChatMessage The message that was added.
tabId integer The ID of the tab the message was added to.

OnAmbientSound

OnAmbientSound: Triggered whenever a sound meta event or building alarm is triggered.

Parameters

Name Type Notes
name string Name of the sound script played.
x number World X co-ordinate of the sound.
y number World Y co-ordinate of the sound.

OnCGlobalObjectSystemInit

(Client) OnCGlobalObjectSystemInit: Triggered when the client GlobalObject system is being initialised.

Parameters

None.

OnChallengeQuery

(Client) OnChallengeQuery: Triggered when the main menu wants to check for challenge maps.

Parameters

None.

OnCharacterCollide

OnCharacterCollide: Triggered when a non-zombie character collides into another (possibly zombie) character.

Parameters

Name Type Notes
character IsoGameCharacter The character colliding into the other character.
collidedCharacter IsoGameCharacter The character being collided into.

OnCharacterDeath

OnCharacterDeath: Triggered when any character dies, including zombies, players and animals.

Parameters

Name Type Notes
character IsoGameCharacter The character who died.

OnChatWindowInit

(Multiplayer) (Client) OnChatWindowInit: Triggered when the chat window is initialised.

Parameters

None.

OnClickedAnimalForContext

OnClickedAnimalForContext:

Parameters

Name Type Notes
playerIndex integer
context ISContextMenu
animals IsoAnimal[]
test boolean

OnClientCommand

(Server) OnClientCommand: Triggered when a client command sent through sendClientCommand is received by the server.

Parameters

Name Type Notes
module string The module the command was sent with.
command string The command the command was sent with.
player IsoPlayer The player who sent the command.
args table or nil The arguments table the command was sent with. If the table was empty, nil is passed instead.

OnClimateManagerInit

OnClimateManagerInit: Triggered when the climate manager is initialised.

Parameters

Name Type Notes
climateManager ClimateManager The climate manager.

OnClimateTick

OnClimateTick: Triggered every climate manager tick.

Parameters

Name Type Notes
climateManager ClimateManager The climate manager.

OnClimateTickDebug

(Client) OnClimateTickDebug: Triggered every climate manager tick, but only on the client and only when debug mode is enabled.

Parameters

Name Type Notes
climateManager ClimateManager The climate manager.

OnClothingUpdated

(Client) OnClothingUpdated: Triggered every time a character's clothing is updated. This includes changing clothes and accumulating dirt or blood.

Parameters

Name Type Notes
character IsoGameCharacter The character whose clothing updated.

OnConnectFailed

(Multiplayer) (Client) OnConnectFailed: Triggered when the client fails to connect to a server.

Parameters

Name Type Notes
message string

OnConnected

(Multiplayer) (Client) OnConnected: Triggered after successfully connecting to a server on the main menu, before character creation begins.

Parameters

None.

OnConnectionStateChanged

(Multiplayer) (Client) OnConnectionStateChanged: Triggered when the client's connection state is updated while trying to connect to a server.

Parameters

Name Type Notes
state string
message string

OnContainerUpdate

(Client) OnContainerUpdate: Triggered when a container is added or removed from the world.

Parameters

Name Type Notes
object any The container that was added or removed.

OnContextKey

(Client) OnContextKey: Triggered while the player is holding the context key.

Parameters

Name Type Notes
player IsoPlayer The player pressing the context key.
timeMs number How long, in milliseconds, the context key has been held for.

OnCoopJoinFailed

(Client) OnCoopJoinFailed: Triggered when a splitscreen character fails to be added.

Parameters

Name Type Notes
playerIndex integer The index of the player who could not be added.

OnCoopServerMessage

(Multiplayer) (Server) OnCoopServerMessage: Triggered when receiving a server message during a co-op (in-game hosted) game.

Parameters

Name Type Notes
tag string
cookie string
payload string

OnCreateLivingCharacter

OnCreateLivingCharacter: Triggered when any IsoLivingCharacter object is created. Most useful for detecting spawning animals.

Parameters

Name Type Notes
character IsoLivingCharacter The character who was created.
desc SurvivorDesc The character's descriptor.

OnCreatePlayer

(Client) OnCreatePlayer: Triggered every time a local player loads into the world.

Parameters

Name Type Notes
playerIndex integer The index of the newly-spawned player
player IsoPlayer The new player object

OnCreateSurvivor

(Client) OnCreateSurvivor: Triggered when an IsoSurvivor object is created.

Parameters

Name Type Notes
survivor IsoSurvivor The survior that was created.

OnCreateUI

(Client) OnCreateUI: Triggered when the UI is initialised.

Parameters

None.

OnCustomUIKey

(Client) OnCustomUIKey: Triggered when a key that is not used by vanilla UI is released.

Parameters

Name Type Notes
key integer Key code of the key that was pressed.

OnCustomUIKeyPressed

(Client) OnCustomUIKeyPressed: Triggered when a key that is not used by vanilla UI is pressed.

Parameters

Name Type Notes
key integer Key code of the key that was pressed.

OnCustomUIKeyReleased

(Client) OnCustomUIKeyReleased: Triggered when a key that is not used by vanilla UI is released.

Parameters

Name Type Notes
key integer Key code of the key that was pressed.

OnDeadBodySpawn

OnDeadBodySpawn: Triggered when spawning a dead body.

Parameters

Name Type Notes
body IsoDeadBody The dead body being spawned.

OnDestroyIsoThumpable

OnDestroyIsoThumpable: Triggered when an IsoThumpable object is destroyed by damage.

Parameters

Name Type Notes
object IsoThumpable The thumpable that was destroyed.
player nil Purpose unknown: always nil.

OnDeviceText

(Client) OnDeviceText: Triggered whenever a radio displays text.

Parameters

Name Type Notes
guid string GUID of the line being displayed.
codes string Codes of the line being displayed. These typically contain perk/stat changes, but can be used to associate any arbitrary data with a line.
x number World X co-ordinate where the line is being displayed.
y number World Y co-ordinate where the line is being displayed.
z number World Z co-ordinate where the line is being displayed.
text string or
ChatMessage
The displayed, translated text of the line, or the chat message being displayed.
device WaveSignalDevice The device playing the line.

OnDisconnect

(Multiplayer) (Client) OnDisconnect: Triggered when the client disconnects from a server.

Parameters

None.

OnDistributionMerge

OnDistributionMerge: Triggered when the distribution tables merge.

Parameters

None.

OnDoTileBuilding2

(Client) OnDoTileBuilding2: Triggered every tick while the local mouse and keyboard player has a build cursor (or other drag).

Parameters

Name Type Notes
cursor ISBuildingObject The build cursor object the player is dragging.
bRender boolean Whether the preview should be rendered.
x integer World X co-ordinate of the square the build cursor is over.
y integer World Y co-ordinate of the square the build cursor is over.
z integer World Z co-ordinate of the square the build cursor is over.
square IsoGridSquare or
nil
The square the build cursor is over.

OnDoTileBuilding3

(Client) OnDoTileBuilding3: Triggered every tick while a controller player has a build cursor (or other drag).

Parameters

Name Type Notes
cursor ISBuildingObject The cursor object the player is dragging.
bRender boolean Whether the preview should be rendered.
x integer World X co-ordinate of the square the build cursor is over.
y integer World Y co-ordinate of the square the build cursor is over.
z integer World Z co-ordinate of the square the build cursor is over.

OnDynamicMovableRecipe

(Client) OnDynamicMovableRecipe: Triggered when a local character crafts a dynamically generated Movable scrapping recipe.

Parameters

Name Type Notes
sprite string Sprite of the movable.
recipe MovableRecipe The movable recipe that was crafted.
item Moveable The movable item being scrapped.
character IsoGameCharacter The character crafting the recipe.

OnEnterVehicle

(Client) OnEnterVehicle: Triggered when a character enters a vehicle.

Parameters

Name Type Notes
character IsoGameCharacter The character that entered the vehicle.

OnEquipPrimary

OnEquipPrimary: Triggered when a character changes the item in their primary equip slot.

Parameters

Name Type Notes
character IsoGameCharacter The character that equipped the item.
item InventoryItem or
nil
The newly equipped item.

OnEquipSecondary

OnEquipSecondary: Triggered when a character changes the item in their secondary equip slot.

Parameters

Name Type Notes
character IsoGameCharacter The character that equipped the item.
item InventoryItem or
nil
The newly equipped item.

OnExitVehicle

(Client) OnExitVehicle: Triggered when a character exits a vehicle.

Parameters

Name Type Notes
character IsoGameCharacter The character that exited the vehicle.

OnFETick

(Client) OnFETick: Triggered every tick while on the main menu.

Parameters

Name Type Notes
unknown 0 Purpose unknown: always 0.

OnFillContainer

(Server) OnFillContainer: Triggered whenever a container is first filled with loot, or when loot respawns.

Parameters

Name Type Notes
roomType string Distribution type of the room the container is in, or the type of the vehicle.
containerType string The type of the container that was filled.
container ItemContainer or
ItemPickerContainer
The container that was filled. An ItemPickerContainer is sometimes passed when a sub-container is spawned and filled, and is probably a bug.

OnFillInventoryObjectContextMenu

(Client) OnFillInventoryObjectContextMenu: Triggered after the context menu for an inventory item is filled.

Parameters

Name Type Notes
playerIndex integer The index of the player whose context menu has been filled.
context ISContextMenu The context menu that was filled.
items InventoryItem[] or
umbrella.ContextMenuItemStack[]
The items that were selected to fill the context menu. If only full stacks are selected, a table of ContextMenuItemStacks is passed. Otherwise it is a table of InventoryItems.

OnFillWorldObjectContextMenu

(Client) OnFillWorldObjectContextMenu: Triggered after a world context menu is filled.

Parameters

Name Type Notes
playerIndex integer The index of the player whose context menu has been filled.
context ISContextMenu The context menu that was filled.
worldObjects IsoObject[] The objects that were right clicked on. The first object is whatever the mouse click hit directly. If one can be found, it will also add a door, a window, a window frame, a thumpable, a hoppable, and a tree. Many kinds of objects will never appear in this list or appear inconsistently so it is a common pattern to get the square from the first object and then loop through its objects.
test boolean Whether the context menu was filled to test for interactive objects on the square. If true, the context menu will not actually be displayed.

OnGameBoot

OnGameBoot: Triggered after the game finishes starting up. Note: For clients, lua files in lua/server/ will not have ran by the time this event is triggered, so event callbacks added by those files will not be triggered. This does not apply to servers.

Parameters

None.

OnGameStart

(Client) OnGameStart: Triggered upon finishing loading and entering the game.

Parameters

None.

OnGameStateEnter

(Client) OnGameStateEnter: Triggers upon entering the Terms Of Service GameState. Probably meant to trigger for other GameStates too, but it doesn't.

Parameters

Name Type Notes
state GameState

OnGameTimeLoaded

OnGameTimeLoaded: Triggered after GameTime is initialised.

Parameters

None.

OnGamepadConnect

(Client) OnGamepadConnect: Triggered after a controller is connected.

Parameters

Name Type Notes
controllerId integer ID of the controller.

OnGamepadDisconnect

(Client) OnGamepadDisconnect: Triggered after a controller is disconnected.

Parameters

Name Type Notes
controllerId integer ID of the controller.

OnGetDBSchema

(Multiplayer) (Client) OnGetDBSchema: Triggered when receiving the database schema from the server.

Parameters

Name Type Notes
schema table<string, umbrella.DBSchemaEntry[]>

OnGetTableResult

(Multiplayer) (Client) OnGetTableResult: Triggered when receiving a database table query result from the server.

Parameters

Name Type Notes
data ArrayList<DBResult>
rowId integer
tableName string

OnGridBurnt

OnGridBurnt: Triggered when a square is burned by fire.

Parameters

Name Type Notes
square IsoGridSquare The square that was burned.

OnHitZombie

OnHitZombie: Triggered whenever a zombie is hit by a character.

Parameters

Name Type Notes
zombie IsoZombie The zombie that was hit.
attacker IsoGameCharacter The character that hit the zombie.
bodyPart BodyPartType The type of the body part that was hit.
weapon HandWeapon The weapon the zombie was hit with.

OnInitGlobalModData

OnInitGlobalModData: Triggered when GlobalModData is initialised. This is the earliest event after Sandbox Options are loaded.

Parameters

Name Type Notes
newGame boolean True if this is the first time the save has started.

OnInitModdedWeatherStage

OnInitModdedWeatherStage: Triggered when a modded weather period is created.

Parameters

Name Type Notes
weatherPeriod WeatherPeriod The weather period that was created.
weatherStage WeatherPeriod.WeatherStage The weather stage that was created.
strength number TODO

OnInitRecordedMedia

OnInitRecordedMedia: Triggered when RecordedMedia is initialised.

Parameters

Name Type Notes
recordedMedia RecordedMedia The RecordedMedia object.

OnInitSeasons

OnInitSeasons: Triggered when the ErosionManager is created.

Parameters

Name Type Notes
season ErosionSeason

OnInitWorld

OnInitWorld: Triggered after the world has initialised.

Parameters

None.

OnItemFound

OnItemFound:

Parameters

Name Type Notes
player IsoPlayer
itemType string
amount number

OnJoypadActivate

(Client) OnJoypadActivate: Triggered whenever a controller starts being used during gameplay.

Parameters

Name Type Notes
joypadId integer ID of the joypad.

OnJoypadActivateUI

(Client) OnJoypadActivateUI: Triggered whenever a controller starts being used outside of gameplay, such as on the main menu.

Parameters

Name Type Notes
joypadId integer ID of the joypad.

OnJoypadBeforeDeactivate

(Client) OnJoypadBeforeDeactivate: Triggered when a controller is disconnected, before disconnection is processed.

Parameters

Name Type Notes
joypadId integer ID of the joypad.

OnJoypadBeforeReactivate

(Client) OnJoypadBeforeReactivate: Triggered when a controller is connected, before connection is processed.

Parameters

Name Type Notes
joypadId integer ID of the joypad.

OnJoypadDeactivate

(Client) OnJoypadDeactivate: Triggered after a controller has been disconnected.

Parameters

Name Type Notes
joypadId integer ID of the joypad.

OnJoypadReactivate

(Client) OnJoypadReactivate: Triggered after a controller has been connected.

Parameters

Name Type Notes
joypadId integer ID of the joypad.

OnJoypadRenderUI

(Client) OnJoypadRenderUI: Triggered when rendering controller debug UI.

Parameters

None.

OnKeyKeepPressed

(Client) OnKeyKeepPressed: Triggered every frame while a key is held down.

Parameters

Name Type Notes
key integer Key code of the key that was held.

OnKeyPressed

(Client) OnKeyPressed: Triggered when a key is released.

Parameters

Name Type Notes
key integer Key code of the key that was released.

OnKeyStartPressed

(Client) OnKeyStartPressed: Triggered when a key starts being pressed.

Parameters

Name Type Notes
key integer Key code of the key that was pressed.

OnLoad

(Client) OnLoad: Triggered upon finishing loading and entering the game.

Parameters

None.

OnLoadMapZones

OnLoadMapZones: Triggered before loading the map zones.

Parameters

None.

OnLoadRadioScripts

OnLoadRadioScripts: Triggered after ZomboidRadio loads the radio scripts.

Parameters

Name Type Notes
scriptManager RadioScriptManager The radio script manager.
newGame boolean True when a new save launches for the first time.

OnLoadSoundBanks

(Client) OnLoadSoundBanks: Triggered after the game loads the FMOD sound banks.

Parameters

None.

OnLoadedMapZones

OnLoadedMapZones: Triggered after loading the map zones.

Parameters

None.

OnLoadedTileDefinitions

OnLoadedTileDefinitions: Triggered after loading the tile definitions.

Parameters

Name Type Notes
spriteManager IsoSpriteManager The sprite manager.

OnMainMenuEnter

(Client) OnMainMenuEnter: Triggered upon entering the main menu.

Parameters

None.

OnMechanicActionDone

OnMechanicActionDone: Triggered after a character completes a mechanic action on a vehicle.

Parameters

Name Type Notes
character IsoGameCharacter The character who performed the action.
success boolean Whether the action succeeded.

OnMiniScoreboardUpdate

(Multiplayer) (Client) OnMiniScoreboardUpdate: Triggered when the admin mini-scoreboard is updated.

Parameters

None.

OnModsModified

(Client) OnModsModified: Triggered on the main menu when a mod's files have changed.

Parameters

None.

OnMouseDown

(Client) OnMouseDown: Triggered when the player left clicks, as long as the input isn't eaten by UI.

Parameters

Name Type Notes
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnMouseMove

(Client) OnMouseMove: Triggered every frame, unless mouse movement is eaten by something else.

Parameters

Name Type Notes
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.
xMultiplied number Screen X co-ordinate of the click multiplied by zoom level.
yMultiplied number Screen Y co-ordinate of the click multiplied by zoom level.

OnMouseUp

(Client) OnMouseUp: Triggered whenever the player releases the left mouse button, unless the input is eaten by UI.

Parameters

Name Type Notes
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnMouseWheel

OnMouseWheel:

Parameters

Name Type Notes
wheel number

OnMultiTriggerNPCEvent

OnMultiTriggerNPCEvent: Triggered when the player triggers an NPC event.

Parameters

Name Type Notes
type string
data table
def BuildingDef

OnNewFire

OnNewFire: Triggered when a new fire is started.

Parameters

Name Type Notes
fire IsoFire The fire that was created.

OnNewGame

(Client) OnNewGame: Triggered whenever a local player character is created for the first time.

Parameters

Name Type Notes
player IsoPlayer The character that was created.
square IsoGridSquare The square the character spawned on.

OnObjectAboutToBeRemoved

OnObjectAboutToBeRemoved: Triggered before a tile object is destroyed or picked up.

Parameters

Name Type Notes
object IsoObject The object about to be removed.

OnObjectAdded

OnObjectAdded: Triggered when an object is added to the world. Note: usually not called on the client, but is in some cases.

Parameters

Name Type Notes
object IsoObject

OnObjectCollide

OnObjectCollide: Triggered when two objects collide with each other.

Parameters

Name Type Notes
object IsoMovingObject The object that collided into the other object.
collided IsoObject The object that was collided into.

OnObjectLeftMouseButtonDown

(Client) OnObjectLeftMouseButtonDown: Triggered when the player left clicks a world object.

Parameters

Name Type Notes
object IsoObject The object that was clicked.
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnObjectLeftMouseButtonUp

(Client) OnObjectLeftMouseButtonUp: Triggered when the player releases left click on a world object.

Parameters

Name Type Notes
object IsoObject The object that was clicked.
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnObjectRightMouseButtonDown

(Client) OnObjectRightMouseButtonDown: Triggered when the player right clicks a world object.

Parameters

Name Type Notes
object IsoObject The object that was clicked.
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnObjectRightMouseButtonUp

(Client) OnObjectRightMouseButtonUp: Triggered when the player releases right click on a world object.

Parameters

Name Type Notes
object IsoObject The object that was clicked.
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnPlayerAttackFinished

(Client) OnPlayerAttackFinished: Triggered when a local player finishes attacking.

Parameters

Name Type Notes
player IsoPlayer The player who attacked.
weapon HandWeapon The weapon the player attacked with.

OnPlayerDeath

(Client) OnPlayerDeath: Triggered when a local player dies.

Parameters

Name Type Notes
player IsoPlayer The player who died.

OnPlayerGetDamage

OnPlayerGetDamage: Triggered every time a local player takes damage. Triggered once per frame by each bleeding body part. Also triggered when zombies are hit by weapons: this is the only case in which the event is triggered on the server.

Parameters

Name Type Notes
character IsoGameCharacter The character who took damage.
damageType "POISON" or "HUNGRY" or "SICK" or
"BLEEDING" or "THIRST" or "HEAVYLOAD" or
"INFECTION" or "LOWWEIGHT" or
"FALLDOWN" or "WEAPONHIT" or "CARHITDAMAGE" or
"CARCRASHDAMAGE"
The type of damage the character took.
damage number The damage that was taken.

OnPlayerMove

(Client) OnPlayerMove: Triggered during each local player's update if they are walking.

Parameters

Name Type Notes
character IsoPlayer

OnPlayerUpdate

(Client) OnPlayerUpdate: Triggered during each local player's update (every tick).

Parameters

Name Type Notes
player IsoPlayer The player being updated.

OnPostDistributionMerge

OnPostDistributionMerge: Triggered after the distribution tables have been merged.

Parameters

None.

OnPostFloorLayerDraw

OnPostFloorLayerDraw: Triggered after a floor layer has been rendered.

Parameters

Name Type Notes
z integer The Z level that was rendered.

OnPostMapLoad

OnPostMapLoad: Triggered after the map has been loaded.

Parameters

Name Type Notes
cell IsoCell The cell that was loaded.
x integer
y integer

OnPostRender

(Client) OnPostRender: Triggered after every in-game rendering frame.

Parameters

None.

OnPostSave

OnPostSave: Triggered after saving and exiting the game.

Parameters

None.

OnPostUIDraw

(Client) OnPostUIDraw: Triggered after every UI render frame

Parameters

None.

OnPreDistributionMerge

OnPreDistributionMerge: Triggered after the distribution tables have been merged.

Parameters

None.

OnPreFillInventoryObjectContextMenu

(Client) OnPreFillInventoryObjectContextMenu: Triggered when the context menu for an inventory item is created, before it is filled.

Parameters

Name Type Notes
playerIndex integer The index of the player whose context menu has been created.
context ISContextMenu The context menu that was created.
items InventoryItem[] or
umbrella.ContextMenuItemStack[]
The items that were selected to fill the context menu. If only full stacks are selected, a table of ContextMenuItemStacks is passed. Otherwise it is a table of InventoryItems.

OnPreFillWorldObjectContextMenu

(Client) OnPreFillWorldObjectContextMenu: Triggered after the world context menu is created, before it is filled.

Parameters

Name Type Notes
playerIndex integer The number of the player whose context menu has been created.
context ISContextMenu The context menu that was created.
worldobjects IsoObject[] The objects that were selected.
test boolean Whether the context menu was created to test for interactive objects on the square. If true, the context menu will not actually be displayed.

OnPreMapLoad

OnPreMapLoad: Triggered before the map starts loading.

Parameters

None.

OnPreUIDraw

(Client) OnPreUIDraw: Triggered before every UI render frame

Parameters

None.

OnPressRackButton

(Client) OnPressRackButton: Triggered when a local player has a gun and presses the button to rack it.

Parameters

Name Type Notes
player IsoPlayer The player attempting to rack.
weapon HandWeapon The weapon they are attempting to rack.
shift false Unknown purpose: always false. Added at some point during B42.

OnPressReloadButton

(Client) OnPressReloadButton: Triggered when a local player has a gun and presses the button to reload it.

Parameters

Name Type Notes
player IsoPlayer The player attempting to reload.
weapon HandWeapon The weapon they are attempting to reload.

OnPressWalkTo

(Client) OnPressWalkTo: Triggered when the local player 1 presses their Walk To keybind.

Parameters

Name Type Notes
arg0 0 Always zero.
arg1 0 Always zero.
arg2 0 Always zero.

OnProcessAction

(Multiplayer) (Server) OnProcessAction:

Parameters

Name Type Notes
action "build"
character IsoPlayer
args table

OnProcessTransaction

(Multiplayer) (Server) OnProcessTransaction:

Parameters

Name Type Notes
action "scrapMoveable" or "pickUpMoveable" or
"rotateMoveable" or "placeMoveable" or
"dropOnFloor"
character IsoPlayer
item InventoryItem or
nil
source ContainerID
destination ContainerID
args table or nil When type is "dropOnFloor", has field IsoGridSquare "square". When type is "rotateMoveable" or "placeMoveable", has field string "direction"

OnReceiveGlobalModData

(Multiplayer) OnReceiveGlobalModData: Triggered when receiving a global mod data table.

Parameters

Name Type Notes
key string The key of the mod data table that was requested.
data table or false The mod data table that was returned. False if there was no mod data table by that key.

OnReceiveItemListNet

(Multiplayer) OnReceiveItemListNet: Triggered when receiving a list of items sent with sendItemListNet. This is not used by vanilla, it is provided for mods to use. Item lists sent by clients cannot be longer than 50 items and all of the items must be in the player's inventory.

Parameters

Name Type Notes
sender IsoPlayer or
nil
The player who sent the item list. Nil if it was sent by the server.
items ArrayList<InventoryItem> The list of items.
receiver IsoPlayer or
nil
The specific local player the list was sent to. Nil if it was sent by a client to the server, or by the server to all clients.
transferID string Arbitrary string associated with the message. Defaults to -1 if none was given.
custom string or nil Arbitrary string associated with the message. Nil if none was given.

OnReceiveUserlog

(Multiplayer) (Client) OnReceiveUserlog: Triggered when receiving another client's Userlogs.

Parameters

Name Type Notes
username string
logs ArrayList

OnRefreshInventoryWindowContainers

(Client) OnRefreshInventoryWindowContainers: Triggered when the available containers in the inventory UI change.

Parameters

Name Type Notes
inventoryPage ISInventoryPage
reason string

OnRenderTick

OnRenderTick: Triggered on every rendering tick.

Parameters

None.

OnResetLua

OnResetLua: Triggered after Lua has been reloaded.

Parameters

Name Type Notes
reason string

OnResolutionChange

OnResolutionChange: Triggered whenever the window resolution changes.

Parameters

Name Type Notes
oldX integer Previous width of the window.
oldY integer Previous height of the window.
newX integer New width of the window.
newY integer New height of the window.

OnRightMouseDown

(Client) OnRightMouseDown: Triggered when the player right clicks, as long as the input isn't eaten by UI.

Parameters

Name Type Notes
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnRightMouseUp

(Client) OnRightMouseUp: Triggered whenever the player releases the right mouse button, unless the input is eaten by UI.

Parameters

Name Type Notes
x number Screen X co-ordinate of the click.
y number Screen Y co-ordinate of the click.

OnSGlobalObjectSystemInit

(Server) OnSGlobalObjectSystemInit: Triggered when the server GlobalObject system has been initialised.

Parameters

None.

OnSafehousesChanged

(Multiplayer) (Client) OnSafehousesChanged: Triggered every time a safehouse is added, removed or changed.

Parameters

None.

OnSave

OnSave: Triggered while saving the world, after characters and sandbox options have been saved, but before global mod data and the world have been saved.

Parameters

None.

OnScoreboardUpdate

(Multiplayer) (Client) OnScoreboardUpdate: Triggered when the client receives an update to the in-game scoreboard.

Parameters

Name Type Notes
usernames ArrayList<String>
displayNames ArrayList<String>
steamIDs ArrayList<String>

OnSeeNewRoom

OnSeeNewRoom: Triggered when a room becomes visible for the first time.

Parameters

Name Type Notes
room IsoRoom The room.

OnServerCommand

(Multiplayer) (Client) OnServerCommand: Triggered when a server command sent through sendServerCommand is received by the client.

Parameters

Name Type Notes
module string The module the command was sent with.
command string The command the command was sent with.
args table or nil The arguments table the command was sent with. If the table was empty, nil is passed instead.

OnServerFinishSaving

(Multiplayer) (Client) OnServerFinishSaving: Triggered when the server has finished saving and unpauses the game.

Parameters

None.

OnServerStartSaving

(Multiplayer) (Server) OnServerStartSaving: Triggered when the server has paused the game to save.

Parameters

None.

OnServerStarted

(Multiplayer) (Server) OnServerStarted: Triggered when the server has started and can now be connected to.

Parameters

None.

OnServerStatisticReceived

(Multiplayer) (Client) OnServerStatisticReceived: Triggered when the MPStatistics have been received from the server.

Parameters

None.

OnServerWorkshopItems

(Multiplayer) (Client) OnServerWorkshopItems: Triggered when receiving an update about the server's Steam Workshop items while connecting. Has a very variable signature depending on the type.

Parameters

Name Type Notes
type string
items ArrayList<String> or
ArrayList<SteamUGCDetails> or
string or
integer or
nil
error string or integer or nil
maxSize integer or nil

OnSetDefaultTab

(Multiplayer) (Client) OnSetDefaultTab: Triggered when the player sets their favourite chat window tab.

Parameters

Name Type Notes
title string

OnSleepingTick

OnSleepingTick:

Parameters

Name Type Notes
playerIndex number
timeOfDay number

OnSourceWindowFileReload

OnSourceWindowFileReload: Triggered when a file is reloaded from the debug source viewer.

Parameters

None.

OnSpawnRegionsLoaded

(Client) OnSpawnRegionsLoaded: Triggered when the spawn regions have been loaded.

Parameters

Name Type Notes
regions table

OnSpawnVehicleEnd

OnSpawnVehicleEnd:

Parameters

Name Type Notes
vehicle BaseVehicle

OnSpawnVehicleStart

OnSpawnVehicleStart:

Parameters

Name Type Notes
vehicle BaseVehicle

OnSteamFriendStatusChanged

(Client) OnSteamFriendStatusChanged: Triggered when the player has gained or lost a steam friend.

Parameters

Name Type Notes
steamID string Steam ID of the friend who was gained/lost.

OnSteamGameJoin

(Multiplayer) (Client) OnSteamGameJoin: Triggered when the player joins a game through steam.

Parameters

None.

OnSteamRefreshInternetServers

(Client) OnSteamRefreshInternetServers: Triggered when the steam server list has been refreshed.

Parameters

None.

OnSteamRulesRefreshComplete

(Client) OnSteamRulesRefreshComplete: Triggered after a server's rules are retrieved.

Parameters

Name Type Notes
address string
port number
rules table Table of information about the server TODO: investigate what this actually is, class definition?

OnSteamServerFailedToRespond2

OnSteamServerFailedToRespond2:

Parameters

Name Type Notes
host string
port number

OnSteamServerResponded

(Client) OnSteamServerResponded: Triggered when receiving a server for the server list.

Parameters

Name Type Notes
index integer

OnSteamServerResponded2

(Client) OnSteamServerResponded2: Triggered when receiving a server for the favourite server list.

Parameters

Name Type Notes
address string
port number
server Server

OnSteamWorkshopItemCreated

(Client) OnSteamWorkshopItemCreated: Triggered when the client successfully uploads a workshop item.

Parameters

Name Type Notes
workshopId string
bUserNeedsToAcceptWorkshopLegalAgreement boolean

OnSteamWorkshopItemNotCreated

(Client) OnSteamWorkshopItemNotCreated: Triggered when the client fails to upload a workshop item.

Parameters

Name Type Notes
result integer

OnSteamWorkshopItemNotUpdated

(Client) OnSteamWorkshopItemNotUpdated: Triggered when the client fails to update a workshop item.

Parameters

Name Type Notes
result integer

OnSteamWorkshopItemUpdated

(Client) OnSteamWorkshopItemUpdated: Triggered when the client successfully updates a workshop item.

Parameters

Name Type Notes
bUserNeedsToAcceptWorkshopLegalAgreement boolean

OnSwitchVehicleSeat

(Client) OnSwitchVehicleSeat: Triggered when a local character moves seats in a vehicle.

Parameters

Name Type Notes
character IsoGameCharacter The character who moved seats.

OnTabAdded

(Multiplayer) (Client) OnTabAdded: Triggered when a tab is added to the chat.

Parameters

Name Type Notes
title string
tabID integer

OnTabRemoved

(Multiplayer) (Client) OnTabRemoved: Triggered when a tab is removed from the chat.

Parameters

Name Type Notes
title string
tabID integer

OnTemplateTextInit

OnTemplateTextInit: Triggered when TemplateText is initialised.

Parameters

None.

OnThrowableExplode

OnThrowableExplode: Triggered when a throwable or trap explodes.

Parameters

Name Type Notes
throwable IsoTrap The explosive.
square IsoGridSquare The square it exploded on.

OnThunderEvent

(Client) OnThunderEvent: Triggered when a thunder event is enqueued.

Parameters

Name Type Notes
x integer World X co-ordinate where the thunder event will happen.
y integer World Y co-ordinate where the thunder event will happen.
strike boolean Whether the thunder event will make a striking sound.
light boolean Whether the thunder event will create light.
rumble boolean Whether the thunder event will make a rumbling sound.

OnTick

OnTick: Triggered every game tick.

Parameters

Name Type Notes
tick number The number of ticks since the game started.

OnTickEvenPaused

OnTickEvenPaused: Triggered every game tick, even if the game is paused.

Parameters

Name Type Notes
tick number The number of ticks since the game started. Always zero while paused.

OnTileRemoved

OnTileRemoved: Triggered when a tile object is removed.

Parameters

Name Type Notes
object IsoObject The object being removed.

OnTriggerNPCEvent

OnTriggerNPCEvent: Triggered when the player triggers an NPC event.

Parameters

Name Type Notes
type string
data table
def BuildingDef

OnUpdateModdedWeatherStage

(Server) OnUpdateModdedWeatherStage: Triggered when a modded weather stage tries to be updated.

Parameters

Name Type Notes
weatherPeriod WeatherPeriod
weatherStage WeatherPeriod.WeatherStage
strength number

OnUseVehicle

(Client) OnUseVehicle: Triggered when a local character enters or exits a vehicle.

Parameters

Name Type Notes
player IsoPlayer The player using the vehicle.
vehicle BaseVehicle The vehicle being used.
pressedNotTapped boolean True if the button was held for a short duration, false if the button was tapped.

OnVehicleDamageTexture

OnVehicleDamageTexture: Triggered when a vehicle part has become damaged enough to gain a damage overlay.

Parameters

Name Type Notes
driver IsoGameCharacter The character driving the vehicle.

OnWaterAmountChange

OnWaterAmountChange: Triggered when the amount of fluid (not just water) in an object changes.

Parameters

Name Type Notes
object IsoObject The object which has gained/lost fluid.
previousAmount number The amount of fluid the object had before the change.

OnWeaponHitCharacter

(Client) OnWeaponHitCharacter: Triggered when a non-zombie character is hit by an attack from a local player.

Parameters

Name Type Notes
attacker IsoGameCharacter The character who attacked.
target IsoGameCharacter The character who was hit by the attack.
weapon HandWeapon The weapon that was attacked with.
damage number How much damage the attack did. TODO: what does this actually mean? injuries?

OnWeaponHitThumpable

(Server) OnWeaponHitThumpable: Triggered when a Thumpable is hit by an attack.

Parameters

Name Type Notes
attacker IsoGameCharacter The character attacking the object.
weapon HandWeapon The weapon the object was attacked with.
object Thumpable The object that was attacked.

OnWeaponHitTree

(Client) OnWeaponHitTree: Triggered when a tree is hit by an attack.

Parameters

Name Type Notes
attacker IsoGameCharacter The character hitting the tree.
weapon HandWeapon The weapon the tree was hit with.

OnWeaponHitXp

OnWeaponHitXp: Triggered when XP is being granted for an attack.

Parameters

Name Type Notes
attacker IsoGameCharacter The character who attacked.
weapon HandWeapon The weapon the character attacked with.
target IsoMovingObject The target of the attack.
damage number The damage of the attack.
hitcount 1 Unknown purpose: always 1. Added at some point in B42.

OnWeaponSwing

OnWeaponSwing: Triggered when a player begins swinging a weapon.

Parameters

Name Type Notes
attacker IsoPlayer The character attacking.
weapon HandWeapon The weapon being attacked with.

OnWeaponSwingHitPoint

(Client) OnWeaponSwingHitPoint: Triggered when a local player's attack connects.

Parameters

Name Type Notes
attacker IsoPlayer The player attacking.
weapon HandWeapon The weapon being attacked with.

OnWeatherPeriodComplete

(Server) OnWeatherPeriodComplete: Triggered when a weather period finishes.

Parameters

Name Type Notes
period WeatherPeriod

OnWeatherPeriodStage

(Server) OnWeatherPeriodStage: Triggered when a weather period progresses a stage.

Parameters

Name Type Notes
period WeatherPeriod

OnWeatherPeriodStart

(Server) OnWeatherPeriodStart: Triggered when a weather period begins.

Parameters

Name Type Notes
period WeatherPeriod

OnWeatherPeriodStop

(Server) OnWeatherPeriodStop: Triggered when a weather period ends early, such as by an admin command.

Parameters

Name Type Notes
period WeatherPeriod

OnWorldSound

OnWorldSound: Triggered whenever a world sound is created.

Parameters

Name Type Notes
x integer World X co-ordinate of the square the sound was created on.
y integer World Y co-ordinate of the square the sound was created on.
z integer World Z co-ordinate of the square the sound was created on.
radius integer Radius of the sound.
volume integer Volume of the sound. Zombies are more likely to investigate louder sounds when they have multiple choices.
source Object The source of the sound.

OnZombieCreate

OnZombieCreate: Triggered when a zombie is being spawned.

Parameters

Name Type Notes
zombie IsoZombie The zombie being spawned.

OnZombieDead

OnZombieDead: Triggered when a zombie dies. The zombie's inventory is not filled with loot when this event is triggered, but their clothing and attached items are added. The corpse does not exist until a few seconds later.

Parameters

Name Type Notes
zombie IsoZombie The zombie that died.

OnZombieUpdate

(Client) OnZombieUpdate: Triggered whenever a zombie updates.

Parameters

Name Type Notes
zombie IsoZombie The zombie being updated.

ReceiveFactionInvite

(Multiplayer) (Client) ReceiveFactionInvite: Triggered when the client receives a faction invite.

Parameters

Name Type Notes
factionName string
hostUsername string

ReceiveSafehouseInvite

(Multiplayer) (Client) ReceiveSafehouseInvite: Triggered when the client receives a safehouse invite.

Parameters

Name Type Notes
title string
hostUsername string

RenderOpaqueObjectsInWorld

RenderOpaqueObjectsInWorld:

Parameters

Name Type Notes
playerIndex integer
x integer
y integer
z integer
square IsoGridSquare

RequestTrade

(Multiplayer) (Client) RequestTrade: Triggered when the client receives a trade request.

Parameters

Name Type Notes
requester string

ReuseGridsquare

ReuseGridsquare: Triggered before a square is unloaded.

Parameters

Name Type Notes
square IsoGridSquare The square being reused.

SendCustomModData

(Multiplayer) (Server) SendCustomModData: Triggered when a client is requesting server mod data.

Parameters

None.

ServerPinged

(Multiplayer) (Client) ServerPinged: Triggered when receiving a ping response from the server. The 'numClients' string is suffixed with '/512'.

Parameters

Name Type Notes
clientAddress string
numClients string

SetDragItem

(Client) SetDragItem: Triggered before a local player's drag item (typically a build cursor) is set.

Parameters

Name Type Notes
item table The drag item being set.
playerIndex integer The index of the player whose drag item is being set.

SwitchChatStream

(Multiplayer) (Client) SwitchChatStream: Triggered when the client switches chat tabs.

Parameters

None.

SyncFaction

(Multiplayer) (Client) SyncFaction: Triggered when the client receives changes to a faction.

Parameters

Name Type Notes
faction string

TradingUIAddItem

(Multiplayer) (Client) TradingUIAddItem: Triggered when the other player in a trade adds an item.

Parameters

Name Type Notes
player IsoPlayer The player who added the item.
item InventoryItem The item that was added.

TradingUIRemoveItem

(Multiplayer) (Client) TradingUIRemoveItem: Triggered when the other player in a trade removes an item.

Parameters

Name Type Notes
player IsoPlayer The player who removed the item.
id integer The id of the removed item.

TradingUIUpdateState

(Multiplayer) (Client) TradingUIUpdateState: Triggered when the other player in a trade changes the state of the trade.

Parameters

Name Type Notes
player IsoPlayer The player changing the state.
state integer The new state. TODO: enum for this

ViewBannedIPs

(Multiplayer) (Client) ViewBannedIPs: Triggered when receiving the response to a request from getBannedIPs().

Parameters

Name Type Notes
bannedIPs ArrayList<DBBannedIP> List of banned ip database entries.

ViewBannedSteamIDs

ViewBannedSteamIDs:

Parameters

None.

ViewTickets

(Multiplayer) (Client) ViewTickets: Triggered when receiving the list of tickets from the server.

Parameters

Name Type Notes
tickets ArrayList

onAddForageDefs

onAddForageDefs: Triggered after the foraging item definitions are created.

Parameters

Name Type Notes
forageSystem forageSystem The foraging system.

onDisableSearchMode

(Client) onDisableSearchMode: Triggered when a local player disables search mode.

Parameters

Name Type Notes
character IsoPlayer The character disabling search mode.
isSearchMode false Always false.

onEnableSearchMode

(Client) onEnableSearchMode: Triggered when a local player enables search mode.

Parameters

Name Type Notes
character IsoPlayer The character disabling search mode.
isSearchMode true Always true.

onFillSearchIconContextMenu

(Client) onFillSearchIconContextMenu: Triggered when opening the context menu for a foraging item.

Parameters

Name Type Notes
context ISContextMenu The foraging context menu.
icon ISBaseIcon The foraging icon the context menu was created for.

onItemFall

(Client) onItemFall: Triggered when a local character is forced to drop the items in their hands.

Parameters

Name Type Notes
item InventoryItem The item that fell.

onLoadModDataFromServer

(Multiplayer) onLoadModDataFromServer: Triggered when the server sends a square's mod data to the clients, or when the client receives it.

Parameters

Name Type Notes
square IsoGridSquare The square that had its mod data updated.

onToggleSearchMode

(Client) onToggleSearchMode: Triggered when a local player toggles search mode.

Parameters

Name Type Notes
character IsoPlayer The character toggling search mode.
isSearchMode boolean Whether search mode is now on or off.

onUpdateIcon

(Client) onUpdateIcon: Triggered when an ISForageIcon is moved or removed.

Parameters

Name Type Notes
zoneData table
iconID string
icon ISForageIcon

preAddCatDefs

preAddCatDefs: Triggered before the foraging system processes item category definitions.

Parameters

Name Type Notes
system forageSystem The foraging system.

preAddForageDefs

preAddForageDefs: Triggered before the foraging system processes any definitions.

Parameters

Name Type Notes
system forageSystem The foraging system.

preAddItemDefs

preAddItemDefs: Triggered before the foraging system processes item definitions.

Parameters

Name Type Notes
system forageSystem The foraging system.

preAddSkillDefs

preAddSkillDefs: Triggered before the foraging system processes trait and profession definitions.

Parameters

Name Type Notes
system forageSystem The foraging system.

preAddZoneDefs

preAddZoneDefs: Triggered before the foraging system processes zone definitions.

Parameters

Name Type Notes
system forageSystem The foraging system.