What Game Events fire on Server/Dedicated Server? How to get OnNewGame to fire?

1 post in this topic

Recommended Posts


Im working with the event OnFillContainer which is working fine on my test dedicated server. Im using Moddata to store a gamestate variable, and this is only on the server, since OnFillContainer is updating that gamestate and I'm storing it back to moddata. Im storing it with the gametime object on the server. 


Ok, I want to reset the gamestate variable when a new game is started on the server. I'm trying Events.OnNewGame, and btw I notice that OnGameLoad and OnGameStart does not get called on my dedicated server.


So not sure about OnNewGame, since I read that to start a new game, I should go into my Users\<profilename>\Zomboid\Saves\Multiplayer\servername

and delete the files there. I did that and my moddata variable still did not reset, and  OnNewGame did not seem to fire. So not sure if I actually started a new game or not :-)  (EDIT: Reading that it might be in users\YOU\Zomboid\Multiplayer\ and delete servername folder there, but thought I did delete the correct directory, will double check., also see that OnNewGame is in the baseline /server/ lua files, so must be called, and I didnt restart the server properly.) 


So how do I start a new game on a dedicated server once I have already created a game? And if so, can I expect OnNewGame to fire on the server? If not, what events should I expect to rely on, on the server ? http://pz-mods.net/guide/event-reference/

OnGameBoot event the moddata object does not seem to be available then. 


Thanks for any help. 


EDIT: Ok, I was starting a new game after I deleted the directories and files, and OnNewGame did not fire on the server for me. But I was able to make it all work within OnFillContianer, which does get called on the server. 

Edited by ddraigcymraeg

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now