Jump to content

Please help getting start with modding


Zheo

Recommended Posts

Hello everyone.

 

As you can see Im new here.

I tried the last 2 days in building my own mod for anything - yea anything.

Anything because everything i tried with tutorials and code from other modders were useless

 

The only thing that worked was to find my own mod in the mod-selection-screen.

 

I tried the following Tutorials:

 

- RoboMat's - Mod Tutorials

- RobertJohnson - How to use the modloader

 

I tried to learn with the code from following mods:

 

- Action Hero Updated 1.1

- Points to spend 1.1 2.6

 

Nothing helps..

Just wanted to try modding my own profession at first.

 

 

Best regards Zheo

 

Link to comment
Share on other sites

Mod files need to be in specific directories in order for them to load properly.

ModFolder - Should contain.
- mod.info
- poster.jpg (It can have any name, just include it in mod.info)
- media folder

media - That's where all the assets go, they need to be in their own folders within
- textures - sprites, tiles, item icons etc. go in there
- scripts - item and recipe code go in there
- lua - lua code goes there

lua - Lua code is devided into three categories
- client - loaded when the game is launched
- server - loaded upon loading the game
- shared - used by both client and server code

Profession code would need to be in client, it's effects in the server subfolders of lua. It's icon would need to go to textures subfolder of media.

Professions and Traits are largely hardcoded into the game, default ones cannot be easily modified, you would need to look at available javadocs for the game and figure out how the game creates them. It would likely take some understanding of java and lua.

You should check out Lockpicking mod, if I recall correctly it adds a profession and traits although I'm not sure if it's compatible with modern PZ Builds but it might give you an understanding of how to create a custom profession\traits.

Also, in the future, post questions and help requests pertaining to modding here - http://theindiestone.com/forums/index.php/forum/60-help/

Link to comment
Share on other sites

Thank you much for your comments.

The understanding of Java and lua arent the big problem.

Its more I dont know where to start.

 

Svarog: Does it make a different with client and server when I just use the "beginners"-mode to test my mod?

RoboMat: I will take a look tomorrow - today i spend at least 6 hours in trying to handle the problems..

Link to comment
Share on other sites

Svarog: Does it make a different with client and server when I just use the "beginners"-mode to test my mod?

As long as it's loaded it does not matter which mode you use, Beginner, Survival or any Sandbox setting, the mod should work just fine.

I suggest you go to your game directory and take a look a media\lua there, see what kind of code is client\shared\server I'm not good with coding I only have a basic understanding of what goes where and why, UI, Traits, Professions basic code all that is client, the effects Traits and Professions have during gameplay is server. 

Also, if you hold left Shift when booting up the game it will launch in debug mode, it has a lua debugger, it might be helpful as it allows to reload lua code within the game without restarting but I noticed that if code is wrong it doesn't load at all, console output can point you in the right direction. I'm afraid I won't be able to help much beyond that.

Link to comment
Share on other sites

Ouh thats a nice hint!!

Thank you again for your help.

 

I will trying it again after work today - but there is still one question left for me...

Does any documentation or compendium exist, wich gives descriptions and comments to all the useable classes and functions?

 

This page is hard to understand - I dont know what every function does and what they are good for.:

 

http://theindiestone.com/zomboidjavadocs/zombie/scripting/commands/BaseCommand.html

Link to comment
Share on other sites

No, the javadocs is the only official resource for that. You basically have to try and find the bits you want from the existing code. Try using a software that can search frases in multiple files. Then compare it to the javadocs inheritance etc. or vice versa. And of course as you've done, use other mods as a template and learn from their code.

Link to comment
Share on other sites

Try using a software that can search frases in multiple files. 

For that I suggest Notepad++, it has a great tool to search for something in multiple files and highlights the syntax for multiple languages. I've been using it without regret as my default text file editor for quite a while.

Link to comment
Share on other sites

@Svarog: The reloading  of lua was a great idea, thank you.

 

@RoboMat: Ive downloaded your mod and tried a bit. At first i have to say your mod is really good :)

 

So i played a bit with your code and changed some thing until i realised, that you changed the "Burglar"-profession instead of creating a complete new one. Isnt it possible at the moment?

 

Maybe you have some ideas, how to solve my current target - im trying to get a new profession called "Nerd".

It should get a Trait named "Smartphone" allows him to earn ???(needs to be balanced) more experience in skills like cooking or others.

 

- I already got changed another profession (better would add instead of change)

- Got a new Trait for it (smartphone)

 

But how to continue this functionality?

Link to comment
Share on other sites

Ok it seems to work :)

 

To search through the zomboid/media folder with notepad++ was an amazing hint  for me!

Now im trying to write another XPBoost because my profession should start with 0 Skllpoints instead of 1+75% multyplier..

 

Does anyone get experience in it?

Link to comment
Share on other sites

I use a search-program called "aborange Searcher" to search text in the lua-files in the /media directory.

This way you just have to search the function you want and can look into the lines with the command even without opening it.

You get the whole line and line-nr displayed.

 

With this program I "copy-and-paste"ed nearly my whole modscript. :D

 

And another experience:

Use a lot of 'print()' commands in order to give you feedback in the console about what is actually going on, how the values of the variables are, etc.

After checking, you can just comment them out, and if you have to change some lines of script, you can comment them in again if you have to fix some bugs.

 

Modding itself is very easy.

At least if you do it step by step and always check your code after each step with print commands.

Link to comment
Share on other sites

Mmmmmh.. First I need to complete it.

 

I completed my 2 professions "Nerd" and "Ironman" ..

Now I try to add some new Items like a Katana or Bow. To craft a bow you need springs, wich you get out of pillows.

Everything ok so far. Icons and crafting are working but now I have 2 problems.

 

1. My craftet bow has infinitive ammo - did I forget any option?

2. My new items katana and bow need 3D models i think. How do i create such models and how do i add them into game?

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