JungleMoney Posted October 31, 2017 Share Posted October 31, 2017 (edited) i've made a mod that adds magazines that allow you to learn certain unlearnable recipes, and a trait. the code itself is not complicated, as i've essentially ripped off pre-existing code from the base game. here's the media/scripts item .txt module MagItems { item NutMag { Weight = 0.1, Type = Literature, DisplayName = The Nutritionist, Icon = MagazineNutritionist, TeachedRecipes = Nutritionist, ReplaceOnUse = NutMag, } item BigBookOfBangs { Weight = 0.1, Type = Literature, DisplayName = Big Book of Bangs, Icon = MagazineBoom, TeachedRecipes = Make Flame bomb;Make Aerosol bomb;Make Pipe bomb, ReplaceOnUse = BigBookOfBangs, } } and here's the media/lua/server distribution file require 'Items/SuburbsDistributions'; table.insert(SuburbsDistributions["zippeestore"]["shelvesmag"].items, "NutMag"); table.insert(SuburbsDistributions["zippeestore"]["shelvesmag"].items, 0.2); table.insert(SuburbsDistributions["all"]["postbox"].items, "NutMag"); table.insert(SuburbsDistributions["all"]["postbox"].items, 0.1); table.insert(SuburbsDistributions["all"]["crate"].items, "NutMag"); table.insert(SuburbsDistributions["all"]["crate"].items, 100); table.insert(SuburbsDistributions["all"]["crate"].items, "BigBookOfBangs"); table.insert(SuburbsDistributions["all"]["crate"].items, 100); table.insert(SuburbsDistributions["zippeestore"]["shelvesmag"].items, "BigBookOfBangs"); table.insert(SuburbsDistributions["zippeestore"]["shelvesmag"].items, 0.2); table.insert(SuburbsDistributions["all"]["postbox"].items, "BigBookOfBangs"); table.insert(SuburbsDistributions["all"]["postbox"].items, 0.1); like i said, simplicity itself. yet nothing i do makes it work. i made them spawn often in crates for debug purposes. i'd really appreciate some help, i've been working on this for awhile and i'm starting to get pissed off. More Magazines.zip Edited October 31, 2017 by JungleMoney Link to comment Share on other sites More sharing options...
GoodOldLeon Posted October 31, 2017 Share Posted October 31, 2017 Items in the distribution file need to have the module id before the item id, eg: table.insert(SuburbsDistributions["all"]["crate"].items, "MagItems.NutMag"); table.insert(SuburbsDistributions["all"]["crate"].items, 100); Link to comment Share on other sites More sharing options...
GoodOldLeon Posted October 31, 2017 Share Posted October 31, 2017 When learning to mod, my recommendation would be that you check the game files and also a mod that does what you're trying to replicate (if applicable) for comparison, because mods often need some extra code in order to be functional in game, like in this particular case. Link to comment Share on other sites More sharing options...
JungleMoney Posted October 31, 2017 Author Share Posted October 31, 2017 15 hours ago, TheLeonBM said: Items in the distribution file need to have the module id before the item id, eg: table.insert(SuburbsDistributions["all"]["crate"].items, "MagItems.NutMag"); table.insert(SuburbsDistributions["all"]["crate"].items, 100); Did exactly that, now everything works. Except for the magazine that is supposed to give you the Nutritionist trait.. the code is ripped directly from the Herbalist magazine. I assumed the 'recipe' was just the name of the trait, and reading it would let you learn it. Link to comment Share on other sites More sharing options...
GoodOldLeon Posted October 31, 2017 Share Posted October 31, 2017 1 hour ago, JungleMoney said: Did exactly that, now everything works. Except for the magazine that is supposed to give you the Nutritionist trait.. the code is ripped directly from the Herbalist magazine. I assumed the 'recipe' was just the name of the trait, and reading it would let you learn it. Skills and traits also have their own IDs, sometimes they're as straightforward as just their names, and sometimes they aren't. You'd have to find what the ID for the nutritionist trait is, and then put it in the "TeachedRecipes = " line of the item. That should do it. I would tell you where to look, but It's been a long time since I last modded anything so I don't remember where things are anymore. Link to comment Share on other sites More sharing options...
GoodOldLeon Posted October 31, 2017 Share Posted October 31, 2017 I forgot... It might also be the case that Nutritionist isn't a recipe in the same way Herbalist or cooking recipes are, and would need a not so straightforward method to be implemented, in wich case you'll need help from someone that has more knowledge than I do. Link to comment Share on other sites More sharing options...
JungleMoney Posted November 1, 2017 Author Share Posted November 1, 2017 3 hours ago, TheLeonBM said: I forgot... It might also be the case that Nutritionist isn't a recipe in the same way Herbalist or cooking recipes are, and would need a not so straightforward method to be implemented, in wich case you'll need help from someone that has more knowledge than I do. Thanks for the help. 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