Jump to content

Unable to get lua scripts loaded


Nils

Recommended Posts

I've been dabbling with modding PZ but am having issues getting my newly created items to spawn on the player. A bit of background:

 

I used RJ's guide on how to set up the modloader. This seems to work fine. It shows up, turns on, that's all great.

 

I then used RM's tutorial on using lua to create a "cheatmod" to spawn my newly created items. All I did was copy and paste his code and change the items given.

 

This is where I seem to run into issues. I've tried placing my .lua script in both my mod/media/lua folder as well as zomboid/lua folder but either way when I load up the game and press P I don't get any items. I've loaded the script with both custom items and default items, neither of which appear so I don't think it's an item creation problem. Also, I don't get key presses showing up in the console window which is what makes me think the script isn't running at all.

 

Any help would be appreciated.

Link to comment
Share on other sites

I'm running build 25.

 

Messing around some more, I looked at the console log and saw it's only loading scripts from the Steam/blahblah/Project Zomboid directory instead of the Users/Me/Zomboid directory. I put the script in the Steam folder and now it runs and my items get added. I guess my question is how to include a lua script with my mod without having to add it to the main folder? I saw lemmy's post about directory changes with lua scripts but I don't think that applies.

 

Edit: modified title to reflect real issue

Link to comment
Share on other sites

Looks like my problem was that you can't just dump the lua file in the lua folder. It still has to reflect the directory structure from the main folder.

 

So putting the script in:

 

Users/Me/Zomboid/mods/mymod/media/lua/ does not work

 

But putting it in:

 

Users/Me/Zomboid/mods/mymod/media/lua/client/ does work

Link to comment
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
×
×
  • Create New...