Jump to content

Just some mod ideas, which I can't do.


Buggster

Recommended Posts

  Ok, just to clear things up from the get go, I haven't seen anyone else post anything about this. If you have, or you know of a mod like this please tell me. Now in this post there are three general topics I would like to talk about. 

 

Firstly, new ways to get water. 

 

Rain barrels are good, don't get me wrong but they're very dependent on, you guessed it, rain. So you could be killed by a dry streak. I have two ideas related to getting water, and one other thing, for lack of me knowing a better word for it. The first way of getting water is using the river as a source of "bad water" which basically means it's not decontaminated, so you could get a disease from it, (plants too maybe?) however you could add bleach or boil the "bad water" in a pot to create a regular pot of water . The other idea is digging for water. Now this may or may not be unrealistic, I'm not quite sure. So, with this you would use the spade (now it has a use other than a weapon, yay) to dig a hole, and you may find some water which you could gather into a container. This would be "gritty water", which you could filter using a piece of clothing, or a sheet. The other thing I spoke of earlier, is to where you can plant within like 5 squares of the river, and it won't need to be water. However, the risk to doing this is that if there is ever a long period of rain, the river may flood, causing it to rise and destroy everything in those 5 squares. 

 

The second thing I wanted to talk about is different tools... things. 

 

Ok, so in real life when something like an axe or hammer in broken, its the handle that has broken, not the actual head. So maybe you could disassemble the broken tool, or remove the head or something, and then use the sturdy sticks to make a new handle, for said tool. This would only work for things like the hammer, axe, spade, and sledgehammer, but still. Another thing would be being able to dig something like a trench with the spade, and use that to "capture" the undead, and kill the more safely, but if too many get in, they will like climb over each other and get out (no idea if this could actually work in game). Maybe also finding things like rocks, glass, ect. in the areas with either trash cans, or out in the wilderness, and use those to make crude tools, which would be less effective, and break faster, but get the job done none the less. 

 

The third and final thing I would like to talk about is climbable posts. This is basically just a thing so that you don't need to build stairs, then destroy said stairs to get a base set above the ground. What it would be in like a normal wooden post, but it could be climbed and stood on top of, at which point you would right click on the top part to climb back down, somewhat like a sheet rope. 

 

Now I have no idea how feasible any of these ideas are, but any kind of advice would be appreciated. 

 

I would love to make this mode myself, but I have effectively no coding skills.

 

Link to comment
Share on other sites

As for the water, there are some talks about alrdy and also a mod i think.

The tool repair sounds good and have though the other day about it too. Also a sharpening for several tools would be needed like a saw needs sharpend and recrampt or a axe needs from time to time to be sharpend.

 

For the pole thing hmm, maybe a quick way down, would rather see ladders in the game to get the job done you decribed.

but as much as you i have zero or less skill in coding :D

Link to comment
Share on other sites

I like the tool idea, you could repair a broken axe as you said, and it makes a more 'makeshift' version of the weapon, with maybe less durability and damage.  It would also be neat if the head would fly off the axe (e.g. while lumberjackin') and you'd have to find it on the ground.

Link to comment
Share on other sites

I like the tool repairing idea. I thought of something like it before but more like having to resharpen tools/weapons instead. Havent looked into it but it might be possible to hook on an event of an item breaking or something similar, and since the fixing scripts are readily available...

In short, I think its feasible. Might give it a try after I finish my food canning mod.

Link to comment
Share on other sites

As far as your tool repair idea, that's already done for Axes by Craftable Axes, almost exactly how you described it in the OP, actually. It hasn't been updated recently, but does still work with build 27 except that the makeshift axes can't be repaired with the new fixing system.

 

The main problem I see with doing the same for the other tools you've listed is that they don't actually lose condition when used, only when hitting things (does the sledge lose condition when destroying things by whacking them?). I may look into this anyway for the other tools you've listed, but I'll leave axes for Tooks to handle with his mod. Stay tuned.

 

Edit: Just realized this got a little more complicated than I first thought, since if I were to add Makeshift Hammers, I would need to clone all the recipes that need a hammer to also allow Makeshift Hammers to be used... I may put this one on the back burner for now, but who knows?

 

Edit2: Actually not as hard as I thought, but another issue I'm running into is making it compatible with my Homemade Bats mod (using Makeshift Hammers to nail Homemade Bats), seeing as I have no idea how to make one mod aware of another. I could combine the two into a single mod... but I'm not sure that's the direction I want to take. Any help here would be appreciated!

 

Edit3: Hrm, I can't seem to find out how to enable the new spades to dig or the new sledges to smash things like the vanilla ones do, as it doesn't seem to be a tag in their item properties... I may need to learn more about PZ modding before I can do this properly.

Link to comment
Share on other sites

Edit: Just realized this got a little more complicated than I first thought, since if I were to add Makeshift Hammers, I would need to clone all the recipes that need a hammer to also allow Makeshift Hammers to be used... I may put this one on the back burner for now, but who knows?

You could safe yourself the trouble by using lua code. Just have simple recipe to make your makeshit hammer which would actually be a regular hammer, add a 'Oncreate' parameter to your recipe to link to  lua function where you edit the properties of this hammer, like conditionMax, name, and textures. And further more you can store any other variables/information you want on it by using getModData(). Which if you don't know already, is basically a table of various variables that you can make per item.

 

 

Edit2: Actually not as hard as I thought, but another issue I'm running into is making it compatible with my Homemade Bats mod (using Makeshift Hammers to nail Homemade Bats), seeing as I have no idea how to make one mod aware of another. I could combine the two into a single mod... but I'm not sure that's the direction I want to take. Any help here would be appreciated!

you can require your mod to be used only in the presence of another mod. I believe you do this through your mod.info file. But other than that, as long as the independent mod files are there, the dependent mod will work. And by dependent I mean it uses info/script/code from the independent mod (in this case your homemade bats mod).

 

 

Edit3: Hrm, I can't seem to find out how to enable the new spades to dig or the new sledges to smash things like the vanilla ones do, as it doesn't seem to be a tag in their item properties... I may need to learn more about PZ modding before I can do this properly.

my response to your first edit should solve this issue.

Link to comment
Share on other sites

You could safe yourself the trouble by using lua code. Just have simple recipe to make your makeshit hammer which would actually be a regular hammer, add a 'Oncreate' parameter to your recipe to link to  lua function where you edit the properties of this hammer, like conditionMax, name, and textures. And further more you can store any other variables/information you want on it by using getModData(). Which if you don't know already, is basically a table of various variables that you can make per item.

Hrm, I'll look into this, but I freely admit than even the basic scripting is pretty intimidating to me, not to mention writing new lua code, but I guess there's only one way to learn...

 

Assuming I can get that part figured out, the rest should be cake. Thanks!

Link to comment
Share on other sites

 

You could safe yourself the trouble by using lua code. Just have simple recipe to make your makeshit hammer which would actually be a regular hammer, add a 'Oncreate' parameter to your recipe to link to  lua function where you edit the properties of this hammer, like conditionMax, name, and textures. And further more you can store any other variables/information you want on it by using getModData(). Which if you don't know already, is basically a table of various variables that you can make per item.

Hrm, I'll look into this, but I freely admit than even the basic scripting is pretty intimidating to me, not to mention writing new lua code, but I guess there's only one way to learn...

 

Assuming I can get that part figured out, the rest should be cake. Thanks!

 

 

Mhmm, when I started to mod PZ I wanted to just stick with basic scripting without touching lua, but its inevitable, basic scripting is just too limited. I don't know how much you know so I'll just give you what I think you'll need to get started. So here are some resources:

http://theindiestone.com/zomboidjavadocs/ if you're diving into lua pz modding this source is essential as a reference. Ctrl + F to find 'InventoryItem' and 'ItemContainer'  ... look through those for functions you can use to modify item properties or add/remove items from inventory through lua.

http://pz-mods.net/guide/ take a look at 'Your first PZ Lua Script' and 'get what data? getModData()!' ... Those should get you started with some basic lua. Take a look at 'RoboMat's Mod Tutorials' too. The code should help you out a bit to familiarize yourself with lua, enough for PZ modding.

 

and lastly, Ctrl + F in the recipes.txt file to find battery. You'll see the 'OnCreate' parameter I was talking about. The function it triggers is in the recipecode.lua file located in the media > lua > server folder. Look through those two files to understand how it works and see the structure of a function. I highly recommend you use an IDE, I use Notepad++ to edit my mod files, its free. Good luck xD.

Link to comment
Share on other sites

 

Edit3: Hrm, I can't seem to find out how to enable the new spades to dig or the new sledges to smash things like the vanilla ones do, as it doesn't seem to be a tag in their item properties... I may need to learn more about PZ modding before I can do this properly.

my response to your first edit should solve this issue.

 

Deadend is right on the money here.  I recently created a fully functional folding entrenching tool (type of portable military spade for those unfamiliar) for an upcoming update to my Realistic Kentucky Firearms Apocalypse Edition mod and the script handling the digging functions, as well as their ui menus, are entirely contained within the lua portions the game's code.  Specifically, you'll need to edit data contained within ISFarmingMenu.lua located at client/Farming/ISUI and ISShovelGround.lua contained within client/BuildingObjects/ISUI to make a new item capable of using the current spade/digging functions.  I haven't looked specifically but I assume its much the same with Sledgehammers.  I believe I remember seeing some of their function contained within ISWorldObjectContextMenu.lua but I'd have to check again to be sure.  Good luck!  Learning lua is difficult but can be intensely fun and rewarding!

Link to comment
Share on other sites

Well, I've gotten to the point where I have functioning recipes / items to remove heads from a tool, make handles from a plank, then stick them together with woodglue, but for the life of me I cannot get the lua part to work to change the name to "Makeshift (Tool)" and reduce the damage by 20%, which isn't really necessary I suppose, but I'd like there to at least be some sort of drawback to being able to recycle near-infinite tools as long as you have some woodglue left. Here's what I have so far.

 

The recipe (which produces a normal hammer, without any changes to damage or name):

	recipe Craft Makeshift Hammer	{	   HeadHammer,	   HandleTool,	   Woodglue,	   Result:Hammer,	   Time:150.0,	   OnCreate:CraftMakeshiftHammer_OnCreate,	}

The lua script (which doesn't seem to work):

function CraftMakeshiftHammer_OnCreate(items, result, player)  for i=0, items:size()-1 do  'Not sure if this line above is necessary, or what it even does...'	if items:get(i):getType() == "Hammer" then        'Assuming this line is referencing the stats of Hammers, so that the below lines can make changes to them'		result:setDisplayName("Makeshift Hammer");		result:setMaxDamage(result:getMaxDamage()*0.8);		result:setMinDamage(result:getMinDamage()*0.8);                'If the variable being set in the above two lines doesnt work, could I just put in a number?'                'result:setMaxDamage(0.8);'                'result:setMinDamage(0.4);'	end  endend

(Of course, those comments aren't in the script)

 

I'm really at a total loss here, as I'm mostly basing this off the previously mentioned flashlight / battery recipes, and am not really sure what I'm looking at to begin with... At this point I basically need someone else to write the script, as much as I hate to ask that, but I really don't know what I'm doing wrong (or right) here. Thanks for any help anyone can offer, and for all the help so far!

Link to comment
Share on other sites

Well, the damage issue is probably just a reference error.  "result:" is literally just what it states, the result of the completed recipe.  Keeping that in mind you can't technically declare "result:setMaxDamage(result:getMaxDamage()*0.8)" because the bolded "result:" you're trying to get a value from technically doesn't exist until the result item itself is defined.  I hope that made sense, lol.  I don't know a lot of the proper terminology to use for these types of situations.

 

Basically, you'll need to reference the items undergoing the recipe to give value to "result:"  Like this:

result:setMaxDamage(items:getMaxDamage()*0.8);result:setMinDamage(items:getMinDamage()*0.8);

As far as the naming convention goes, I'm not sure what to tell you there.  I've never tried to set a custom display name through lua while keeping the original itemType.  I usually just :setName() or :setType() to something new and add the new items to a custom "recipes.txt" java script.

Link to comment
Share on other sites

I appreciate the help. Makes sense to me... but I still can't get it to function. I gave up on renaming the new Hammer, hoping to see if I could just get a damage reduction... but I still get the same shiny fresh hammer back. I'm pretty sure the lua function is either not firing because I didn't set something up properly, or I've made some horrible syntax error that I can't see. Either way, I think I'm just going to give up on this request unless there's some dumb simple mistake that I just can't find. Here's what I made so far if anyone else wants to take a look.

 

Makeshift Tools/media/scripts/MakeshiftTools.txt (this part works just fine)

module MakeshiftTools{	imports	{		Base	}	recipe Craft Tool Handle	{	   Plank,	   keep Saw,	   	   Result:HandleTool,	   Time:150.0,	}	recipe Remove Hammer Head	{	   Hammer,	   keep Saw,	   Result:HeadHammer,	   Time:150.0,	}	recipe Craft Makeshift Hammer	{	   HeadHammer,	   HandleTool,	   Woodglue,	   Result:Hammer,	   Time:150.0,	   OnCreate:CraftMakeshiftHammer_OnCreate,	}	item HandleTool	{		Weight	=	0.5,		Type	=	Normal,		DisplayName	=	Tool Handle,		Icon = TZ_WoodenStick,	}		item HeadHammer	{		Weight	=	0.5,		Type	=	Normal,		DisplayName	=	Hammer Head,	}}

Makeshift Tools/media/lua/MakeshiftTools.lua (here be Dragons)

function CraftMakeshiftHammer_OnCreate(items, result, player)  for i=0,items:size()-1 do	if items:get(i):getType() == "Hammer" then		result:setMaxDamage(items:getMaxDamage()*0.8);		result:setMinDamage(items:getMinDamage()*0.8);	end  endend
Link to comment
Share on other sites

 

 

Your recipe/items script should be working fine. The only suggesting is to take a look at the 'OnTest' parameter of the battery, you could reuse that to see if the item is broken / zero condition.

 

As for your lua:

function CraftMakeshiftHammer_OnCreate(items, result, player)  for i=0,items:size()-1 do '--this line iterates a loop to go through the entire list of items used in the recipe that triggered this function.'	if items:get(i):getType() == "Hammer" then '--until it finds this item.'		result:setMaxDamage(result:getMaxDamage()*0.8); '-- you want use result for both instances here'		result:setMinDamage(result:getMinDamage()*0.8);	end  endend

Basically you're looking for a 'Hammer' in your items list that is not there. In your Craft Makeshit Hammer recipe you're only adding HeadHammer, HandleTool, and Woodglue to your items list.

But anyways, you don't need the loop or to look into the items list. All that matters is the result. If the changes don't work you might need to instead hook the function to an event.. http://pz-mods.net/guide/event-reference/ such as  OnMakeItem ... 

Link to comment
Share on other sites

Thanks for the help. Just gave it a try again a few different ways, but I'm still getting the same result.

 

First I removed the loop that was checking to see if a Hammer was in the recipe, which it wasn't.

function CraftMakeshiftHammer_OnCreate(items, result, player)	result:setMaxDamage(result:getMaxDamage()*0.8);	result:setMinDamage(result:getMinDamage()*0.8);end

Then I tried changing the recipe to include a Hammer, and re-including the check to see if it was there.

	recipe Craft Makeshift Hammer	{	   destroy Hammer,	   Plank,	   Woodglue,	   keep Saw,	   Result:Hammer,	   Time:300.0,	   OnCreate:CraftMakeshiftHammer_OnCreate,	}'These are in separate files, of course...'function CraftMakeshiftHammer_OnCreate(items, result, player)  for i=0,items:size()-1 do	if items:get(i):getType() == "Hammer" then		result:setMaxDamage(items:get(i):getMaxDamage()*0.8);		result:setMinDamage(items:get(i):getMinDamage()*0.8);	end  endend

Finally, I threw in this event reference at the end of the lua.

Events.OnMakeItem.Add(CraftMakeshiftHammer_OnCreate);

I am in way over my head here...

 

I may just drop the lua, and release it as-is with the other tools added in. Infinitely recycling brand-new tools isn't what I had in mind, but at least I can make that work.

 

Edit: One last lua attempt, this time giving up on the OnCreate, instead trying to use OnTest to only allow the recipe to fire if your Hammer is broken, which didn't work (like all my other lua attempts). Here's the lua (the OnTest part was added correctly to the recipe).

function CraftMakeshiftHammer_TestIsValid(sourceItem, result)	 return sourceItem:getCurrentCondition() == 0;end

I tried changing getCurrentCondition to getUsedDelta like in the Insert Battery OnTest, which also didn't work, because I suspect that it was checking the UsedDelta of the Woodglue bottle (not empty), which was then not allowing the recipe to be visible.

 

Edit2: Hrm, I'm thinking the condition of the Plank may be messing with the GetCurrentCondition... one more try, this time bringing back the Tool Handle...

 

And that's a complete failure, even if I remove all items from the recipe except for the Hammer. I think there's a reason that I dropped out of college soon after taking classes in C++ and Java, this is too much...

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