Jump to content

Extending existing item


elvendertig

Recommended Posts

Hello, I have a question regarding extending items. (a bit of a big post for what it actually is...)

 

For example:

 

I wish to create a new item which inherits all methods and properties of "Hammer", let's say I call this "Handmade Hammer".

This way I only have to change a few properties but the most important part, all methods/recipes which require "Hammer" can also use the "Handmade Hammer", as it's just a 'copy' of "Hammer".

 

If there's no way to extend an item then each method/recipe has to be edited to make the completely new item work as well.

 

If you're still reading, I think we both now what I'm talking about, but as the script files are txt's I have no clue in what language they are and therefore I can't do any research.

 

So, how do I extend from an existing item?

Link to comment
Share on other sites

The language used in the item.txt is zomboid's own.

 

Extending these items isn't really possible, you just copy the entry and replace the values you want.

 

I don't have the code in front of me so this probably won't be very useful but I'm guessing the recipes are operating in one of two ways...

 

a) you define a list of possible items that can be used as each ingredient. in which case you just add the new item to the respective ingredient list

 

b ) you have a series of near-identical recipes with slightly different names and ingredients. In which case you need to add your own.

Link to comment
Share on other sites

Yeah, I thought it would turn out to be option a (as I stated). It's sad, as such thing should be possible..

Guess I'll have to edit everything manually for now then, along which each update corresponding to the items being used, and it's a lot..

 

Thanks for your reply!

Link to comment
Share on other sites

Since I know very little about modding this game, I hope I may be able to help point you in some positive direction with your plans.

 

 

 

By Aricane- "When I made the pillowsilencer mod, I decided that a pillow should get torned and loose its ability to reduce noise. To achieve it I had two choices. One was to alter the pillow item shipped with the game and make it drainable like a battery, the other was to make my own pillow health property and attach it to the pillow. Since I hate altering existing code, the last became the obvious answer.           The answer to my prayers was getModData()."

http://pz-mods.net/guide/get-what-data-getmoddata/

http://pz-mods.net/gameplay/ThePillowsilencer/

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