build 26: Event reference

last updated : 12th may 2014

Use this list for triggering your mod functions for example

function derpFunction(player,item)
    player:Say(player:getName().." is attacking with "..item);

Any suggestions, comments or corrections are greatly appreciated. Please contact me on the indie stone community forum. Thanks a lot!

EventCallback argumentsnotes
LevelPerk char, perk, int level, bool  
LoadGridsquare square  
OnAIStateChange owner, newState, currentState  
OnAIStateEnter owner  
OnAIStateExecute owner  
OnAIStateExit owner  
OnAmbientSound name, Float.valueOf(x), Float.valueOf(y)  
OnCharacterCollide charA, charB  
OnCharacterMeet char, survivor, int met  
OnClientCommand module, command, player, tbl  
OnConnectFailed "Connection failed"  
OnCreateLivingCharacter survivor, descriptor  
OnCreatePlayer int player, int playerAmount  
OnCreateSurvivor survivor  
OnDestroyIsoThumpable this, null  
OnDoTileBuilding bool render int pickedTileX, int pickedTileY, int CamCharactorX, IsoGridSquare orig, UIManager.getDragInventory()  
OnEquipPrimary this, leftHandItem  
OnEquipSecondary this, rightHandItem  
OnFETick int  
OnGameStart   When a game is created or loaded and the player sees himself on the map
OnIsoThumpableLoad this  
OnIsoThumpableSave this  
OnJoypadActivate int id  
OnJoypadActivateUI Integer.valueOf(((JoypadManager.Joypad) JoypadManager.instance.JoypadList.get(n)).getID())  
OnKeyKeepPressed Integer.valueOf(n)  
OnKeyPressed int keynum When the player presses a key on the keyboard. This includes special keys and movement keys
OnLoginState LoginState  
OnMainMenuEnter   When user is presented with survival, sandbox and last stand game options.
OnMakeItem result, resultItem, recipe  
OnMouseDown int x, int y  
OnMouseMove int mx, int my, int mxw, int myw  
OnMouseUp int x, int y  
OnMultiTriggerNPCEvent type, data, def  
OnNPCSurvivorUpdate survivor  
OnNewFire this  
OnNewGame player, sq  
OnObjectAdded o  
OnObjectCollide char, obj  
OnObjectLeftMouseButtonDown tile, int x,int y  
OnObjectLeftMouseButtonUp tile, int x,int y  
OnObjectRightMouseButtonDown tile, int x,int y  
OnObjectRightMouseButtonUp tile, int x,int y  
OnPlayerCancelTimedAction BaseAction  
OnPlayerMove   When the player pushes a movement key, triggers only once per key press
OnPlayerSetSafehouse group, building  
OnPlayerUpdate player Every time the player is updated, which is several time each second
OnPostFloorLayerDraw int value  
OnPostMapLoad cell, name, int x, int y  
OnResetLua reason  
OnResolutionChange int oldWidth, int oldHeight, int width, int height  
OnRightMouseDown int x, int y  
OnRightMouseUp int x, int y  
OnScoreboardUpdate names  
OnSeeNewRoom def  
OnServerCommand module, command, tbl  
OnTick double ticks Each program update cycle
OnTickEvenPaused double ticks  
OnTriggerNPCEvent type, data, def  
OnWaterAmountChange this, int old  
OnWeaponHitCharacter wielder, char, weapon, float damage  
OnWeaponHitTree owner, weapon  
OnWeaponSwing owner, weapon Triggers every time the user swings or fires his weapon, regardless if anything is hit
OnWeaponSwingHitPoint owner, weapon Triggers when the player successfully attack and hit a zombie
OnWorldMessage str chat, bool unusedForNow  
OnZombieDead this  
OnZombieUpdate zombie  
ReuseGridsquare sq  
ServerPinged ip, users  
onLoadModDataFromServer sq  
OnDoTileBuilding2 bool render, int pickedTileX, int pickedTileY, int CamCharactorX, IsoGridSquare orig, bool isNorth  
OnDoTileBuilding3 bool render, int dragXJoypad, int dragXJoypad, bool CamCharactorX Used for joypads


  • RoboMat

    Awesome! Thanks a lot for the update Aricane!

    Jan 26. 14
  • SarahLambar

    This website is great, Just as great as you guys. ^.^

    Mar 7. 14
  • Zetr0x

    Am I the only one to encouter a trouble with OnObjectCollide(which don't fire.) ?

    Mar 10. 14
  • syrneth

    Are all these events client-side? Do I have some way of performing server tasks? I.e. each time a player character is created, I want to check his profession and do some fancy stuff.

    Mar 12. 14
    • Raenbow

      This is relevant to me. For example the event "OnGameBoot". Once that kicks off, I want to have an IRC(Chat channel) listener run and wait for anyone to "Ask" something about my server. So the player types /c time" and my irc channel will ask the server, ultimately responding something like "3.14pm, DAY".

      So far, I run the event OnGameBoot, and it doesn't even print a statement to the console. tried build 25b and the "onlinetest" one. No likey, no printy.

      Apr 28. 14
      • semTex

        i just realized that onGameBoot is obviously not executed by any mod. onGameBoot is triggered if the game itself is loaded. so it has to be part of a script in "path/to/zomboid/media/lua/client". If i do this, i get the print message exactly once. but *never* if a savegame is loaded.

        May 16. 14
  • aricane

    Don't you mention it Vic ;)

    May 29. 14
  • Viceroy

    Love it, would be clueless without it. Thanks for all the effort Aricane

    May 29. 14
  • aricane

    * "OnFillContainer" // Every time we fill a new container with item, param : room name, container type name, the container just filled.
    * OnChangeWeather // Every time we change the weather, triggered in lua, param : the new weather (string).

    Nov 20. 13
You need to be logged in to write comments