Jump to content

Help - Running Custom LUA


kilroy23

Recommended Posts

Alright, so I figure I will start of with HI! I am the new guy on the block. I would have brought you a fruit basket or something but those pesky zombies ate the fruit... and the basket  :-| Then they ate lead from my shotgun  :cool: 

I would also like to apologize in advance if there is already a thread on this topic, I did have a look for one but I came up with nothing.

 

Now, down to business. I am attempting to write LUA mods/addons for PZ. so far I have just followed these two tutorials on how to do this:

http://pz-mods.net/guide/your-first-pz-lua-script/

http://pz-mods.net/guide/robomats-mod-tutorials/#toc4 (only the I Love turtles script so far)

 

I have experience programming in C++, VB, and Python. I am fairly confident in my ability to program but for the life on me I cannot figure out how to get the scripts I have written to run in game.

 

I am simply looking for suggestions for the mistake(s) I am making and or what it is I am messing up. Thank you in advance for your help  (fedora)

 

for the convience of all I have attached the two LUA Files I wrote as .txt files

 

hastalavista.txt

Iliketurtles.txt

Link to comment
Share on other sites

I'm assuming you just want to test your .lua files?

 

Its been a while since I've done that myself but I think they should load if you put them in "....\Steam\SteamApps\common\ProjectZomboid\media\lua" Just make a new folder there so you can remove them again easily.... "....\Users\....\Zomboid\Lua" MIGHT work, but like I said I havent had to do this since before the Modloader :)

 

If those dont work, you will have to set up your Mods filesystem.... I explained to someone else how it works here

 

EDIT

You should see your .lua file load in the console window if you run PZ in compatibility mode

 

EDIT 2

OnPlayerUpdate doesn't carry a key value..... Just use a:

if isKeyDown(keyvalue) then 

inside the method 

Edited by ExcentriCreation
Link to comment
Share on other sites

Users/Zomboid/Lua is just where the files created and being read via lua are placed. It won't help moving your files there :)

As EC said either place them directly in the game files or create a "dummy"-mod so to speak (I have one of these to test random stuff).

I suggest you read through this part of my tutorial:

http://theindiestone.com/forums/index.php/topic/61-robomats-modding-tutorials-updated-12112013/#III

(the one on pz-mods is a bit outdated unfortunately :()

Link to comment
Share on other sites

Users/Zomboid/Lua is just where the files created and being read via lua are placed. It won't help moving your files there :)

As EC said either place them directly in the game files or create a "dummy"-mod so to speak (I have one of these to test random stuff).

 

Cool.... Since I'm only working on NecroForge atm, I usually just test in there ;)

Link to comment
Share on other sites

Thank you both of you for your help. I was able to figure out exavlty what is was I had done wrong. I was putting the LUA files in C:\Users\Me\Zomboid\Lua when really they needed to be going into C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid\media\lua as ExcentriCreation had suggested.

 

They both work like a charm, and now that I have an idea of what it is I am doing I can start planning and writing my own addons  :evil:  I am all the excited!

Link to comment
Share on other sites

A little addition...

You may know so already, but you can also test lua files with the lua binary:

 

http://www.lua.org/download.html

 

Obviously this doesnt work for PZ lua stuff, so if your code is heavily dependant on that dont bother. However i use it allot to test small classes/functions (sometimes adding dummies for PZ lua references) or just to test conceptual things. (its faster then booting the game huh :P)

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...