Project Zomboid

Project Zomboid

Party System
 This topic has been pinned, so it's probably important
leScepter  [developer] 4 Jan @ 1:13pm
Mod Integration & API
For ease of integration, I have created a few events for the Lua event bus. Let me know if there are any other events needed to be added so that integration can go more smoothly.

Note that all the indices states below are not player index in the sense that PZ keeps player indices for server or coop, these are just indices to keep track and sync with the number on the sprites of the radial menu, so do not use "getSpecificPlayer()" function with any of these indices, as it will not yield any meaningful results!


Require
Remember to include this line where ever event listeners are used to avoid mod load order issue

require "risky_party_core"

OnRiskyPartyInitialized
This event fires when the mod is fully initialized after new game starts or save file is loaded. By initialized, it means all the character are created (along with their indicators in B42)

Example
local function onRiskyPartyInitialized(leader, member_list) -- Your code here end Events.OnRiskyPartyInitialized.Add(onRiskyPartyInitialized)

Params:
  • IsoPlayer Leader of the party
  • KahluaTable[IsoPlayer] List of available members

OnRiskyPartyMemberCreated
This event fires when a member is successfully created through the radial menu

Example
local function onRiskyPartyMemberCreated(created_member_obj, created_member_index) -- Your code here end Events.OnRiskyPartyMemberCreated.Add(onRiskyPartyMemberCreated)

Params:
  • IsoPlayer Created member
  • int Index of new party member

OnRiskyPartyMemberSwitch
This event fires when user switches to another member via the radial menu. This can also fire when a focused member (not leader) dies, as it will automatically switch back to the leader

Example
local function onRiskyPartyMemberSwitch(old_member_obj, new_member_obj, old_member_index, new_member_index) -- Your code here end Events.OnRiskyPartyMemberSwitch.Add(onRiskyPartyMemberSwitch)

Params:
  • IsoPlayer Last focused member. Will be nil if the second scenario happens
  • IsoPlayer Newly focused member
  • int Last focused member index. Will be nil if the second scenario happens
  • int Newly focused member index

OnRiskyPartyMemberDead
This event fires when a member (not leader) is dead

Example
local function onRiskyPartyMemberDead(dead_member_obj, dead_member_index) -- Your code here end Events.OnRiskyPartyMemberDead.Add(onRiskyPartyMemberDead)

Params:
  • IsoPlayer Member who is dead
  • int Index of the dead member

OnRiskyPartyLeaderDead
This event fires when the leader is dead

Example
local function onRiskyPartyLeaderDead(dead_leader_obj, dead_leader_index) -- Your code here end Events.OnRiskyPartyLeaderDead.Add(onRiskyPartyLeaderDead)

Params:
  • IsoPlayer Leader who is dead
  • int Index of the dead leader, which is always 0
Last edited by leScepter; 5 Jan @ 10:38am