Sejemus Posted May 1, 2014 Share Posted May 1, 2014 Hello fellow survivers.I'm trying to get into modding, but I am unfamilliar with Lua.I am familliar with programming in other languages and I do understand most of the modding aspects.But how do I make an item use batteries? and how do I make an item do something to the character? Like drying yourself when you're wet, like a towel? Thanks in advance.-Sejemus Link to comment Share on other sites More sharing options...
Aricane Posted May 1, 2014 Share Posted May 1, 2014 There's many good resources both here on the forums and on pz-mods.net. I suggest you get started with Robomats modding tutorial Link to comment Share on other sites More sharing options...
Sejemus Posted May 1, 2014 Author Share Posted May 1, 2014 I did read his tutorials, but I didn't find what I was looking for Link to comment Share on other sites More sharing options...
RoboMat Posted May 1, 2014 Share Posted May 1, 2014 If you can't find a tutorial for it then maybe you need to be "the guy" to write one If you want to do stuff that no one has done before, then you'll need to find it out on your own. You could also simply download mods and read through their source code - they might do what you want to do, or at least something similar. I'm going to move this thread to the correct section. Link to comment Share on other sites More sharing options...
Sejemus Posted May 1, 2014 Author Share Posted May 1, 2014 Yea, I do download mods to see what to do, mainly to see how I make mods for build 25+But I actually thought that someone would've made a mod with items that ran on batteries before ^^But it doesn't appear to be the case then. Thanks anyway. I'll try the getModData() function and see if I can figure it out.I found a tutorial for that on the pzmods.net website Link to comment Share on other sites More sharing options...
badtrix Posted May 1, 2014 Share Posted May 1, 2014 The game resources are your best friend sejemus. When i started with lua coding/modding a few weeks ago, i did not read a single tutorial (at least until i had to know about available events, etc.). What i did was analyzing the lua files of the AddBuilding mod, and when i got a basic understanding of the files involved i started with my own mod, learning step by step what i needed. So here's what i would do in your case. First, as RoboMat has suggested too, look if there is a mod which has a similar function (e.g. adds an item using batteries). If there is one, analyse that mod. If there is no similar mod, then search the orignal lua file which handles the add/remove battery to flashlight. Most likely the important steps are done by java functions (you find most of them here: http://theindiestone.com/zomboidjavadocs/), but there will be a lua file which at least triggers the event. Look in files like ISContextMenu (or how they all are called), or use WinGrep to scan all lua files for keywords like "battery". Study that lua file, look what other files are involved etc. then start rebuilding that file by copy pasting the parts you need and modifying them so they do what you want them to do. Dont forget to give them different names so they dont override the original game files (if you dont need them to do so explicitly). EDIT: i helped you a little bit by scanning the lua files for "battery". here's the result, you might want to check those files mention below first. media\lua\client\BuildingObjects\ISUI\ISBuildMenu.luamedia\lua\client\ISUI\ISWorldObjectContextMenu.luamedia\lua\server\Items\SuburbsDistributions.luamedia\lua\server\recipecode.luamedia\lua\shared\Translate\EN\Tooltip_EN.txtmedia\lua\shared\Translate\Recipes_empty.txt Link to comment Share on other sites More sharing options...
Sejemus Posted May 3, 2014 Author Share Posted May 3, 2014 Awesome, Thanks for your support I'll have a look around.In the mean time I also wrote another mod which so far works like a charm Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now