GoodOldLeon Posted February 10, 2017 Share Posted February 10, 2017 Hi. When I want to add an item to the spawn points I use this format: table.insert(SuburbsDistributions["all"]["crate"].items, "Base.Axe"); table.insert(SuburbsDistributions["all"]["crate"].items, 0.01); But what if I want an item to not spawn at all? I don't want axes to appear on corpses. Link to comment Share on other sites More sharing options...
tommysticks Posted February 10, 2017 Share Posted February 10, 2017 (edited) Sup dude... I know the following is a function, but I haven't checked to see if it works as expected: table.remove(SuburbsDistributions["all"]["inventorymale"].items, "Base.Axe"); table.remove(SuburbsDistributions["all"]["inventorymale"].items, 0.1); --works the same way? Edited February 10, 2017 by tommysticks Link to comment Share on other sites More sharing options...
GoodOldLeon Posted February 10, 2017 Author Share Posted February 10, 2017 (edited) 6 minutes ago, tommysticks said: Sup dude... I know the following is a function, but I haven't checked to see if it works as expected: table.remove(SuburbsDistributions["all"]["inventorymale"].items, "Base.Axe"); table.remove(SuburbsDistributions["all"]["inventorymale"].items, 0.5); --works the same way? Thanks! I'll give it a try and let you know if it works. Edited February 10, 2017 by TheLeonBM Link to comment Share on other sites More sharing options...
tommysticks Posted February 10, 2017 Share Posted February 10, 2017 I'm just gonna predict that something screwy is going to happen. I believe it will have no problem removing the line Base.Axe, but when removing the number (which is actually 0.1 not 0.5) it might freak out. So I don't think I actually helped you... Link to comment Share on other sites More sharing options...
GoodOldLeon Posted February 10, 2017 Author Share Posted February 10, 2017 I used 0.1 but sadly it didn't work. Link to comment Share on other sites More sharing options...
RobertJohnson Posted February 10, 2017 Share Posted February 10, 2017 I think an easy way will just be fetching all infos in the inventorymale.items, keep them in a table, reinint the inventorymale.items = {} and then just fetch your table to re-add all the items and ignoring what you don't want. Or pretty sure you could play with # for lua table, checking where is the Base.Axe, and then removing the index + 1 to remove it's spawn rate. Make sense? I'm not even sure I make sense for myself... GoodOldLeon 1 Link to comment Share on other sites More sharing options...
tommysticks Posted February 10, 2017 Share Posted February 10, 2017 (edited) 4 hours ago, RobertJohnson said: Or pretty sure you could play with # for lua table, checking where is the Base.Axe, and then removing the index + 1 to remove it's spawn rate. This is what I was thinking, but I'm not sure how to count the index correctly, like if there's a zero spot or whatever or if index 10 becomes 9 after 9 has been removed... or if I'm even using table.remove correctly (i've never used it before, but just added it to my notes when I read about it). So Leon... try these out: table.remove(SuburbsDistributions["all"]["inventorymale"].items, 12); --removes spawn rate from Base.Axe? or possibly this, if the index starts at zero: table.remove(SuburbsDistributions["all"]["inventorymale"].items, 11); --removes index 11 assuming there is a 0 index ...and this is why it takes me forever to get anything done. I kind of shotgun blast my way to the end, hoping to figure things out. I'm not a programmer. Like I said, this may not even be the proper way to use table.remove. EDIT By the way, the function above remove the spawn rate only, and I don't know how the game will function with just that removed... so I would try this as well: table.remove(SuburbsDistributions["all"]["inventorymale"].items, 12); --removes Spawn rate table.remove(SuburbsDistributions["all"]["inventorymale"].items, 11); --removes Base.Axe, done in this order to prevent crazy table shifting Edited February 10, 2017 by tommysticks GoodOldLeon 1 Link to comment Share on other sites More sharing options...
tommysticks Posted February 10, 2017 Share Posted February 10, 2017 (edited) I'm going to attempt to explain what I'm trying to help you do real quick... So we are working with the table SuburbsDistributions which is defined by { in Lua. Inside tables you can have other tables as indexes. An index is an item in a table and can be accessed by using its position. So we are trying to reach the table "items," within the table "inventory," within the table "all" within the table "SuburbsDistributions" : table.remove(SuburbsDistributions["all"]["inventorymale"].items... ...then tryin to remove the indexes(indices?) Base.Axe and its spawn rate 0.1, which, if you count in the actual document, are at position 11 and 12: SuburbsDistributions = { all = { inventorymale = { items = { "Base.DigitalWatch2", 0.5, --position 1 and 2 "Base.ButterKnife", 0.1, --position 3 and 4 "Base.KitchenKnife", 0.1, --position 5 and 6 "Base.RollingPin", 0.1, --position 7 and 8 "Base.BaseballBat", 0.1, --position 9 and 10 "Base.Axe", 0.1, --position 11 and 12 } } } } This table has been edited to fit here. So if table.remove works as expected then you'll have this: table.remove(SuburbsDistributions["all"]["inventorymale"].items, 12); --removes index 12 SuburbsDistributions = { all = { inventorymale = { items = { "Base.DigitalWatch2", 0.5, --position 1 and 2 "Base.ButterKnife", 0.1, --position 3 and 4 "Base.KitchenKnife", 0.1, --position 5 and 6 "Base.RollingPin", 0.1, --position 7 and 8 "Base.BaseballBat", 0.1, --position 9 and 10 "Base.Axe", nil, --position 11 and 12, 12 has been removed which leads me to believe you need to remove 11 and 12 } } } } Edited February 10, 2017 by tommysticks GoodOldLeon 1 Link to comment Share on other sites More sharing options...
GoodOldLeon Posted February 10, 2017 Author Share Posted February 10, 2017 Thank you Robert and thanks a lot Tommy for your explanation, it really helped. I just started modding so my knowledge is pretty limited, which can make things very confusing sometimes. I'll try this right away. Link to comment Share on other sites More sharing options...
tommysticks Posted February 10, 2017 Share Posted February 10, 2017 I would try this one first: table.remove(SuburbsDistributions["all"]["inventorymale"].items, 12); --removes Spawn rate table.remove(SuburbsDistributions["all"]["inventorymale"].items, 11); Link to comment Share on other sites More sharing options...
GoodOldLeon Posted February 10, 2017 Author Share Posted February 10, 2017 I tried that one. I started a new sandbox with abundant weapons (everything else extremely rare) and the lucky trait, killed 250 male zeds and not a single one of them dropped an axe. Is it a high enough number to assume that it worked? Link to comment Share on other sites More sharing options...
tommysticks Posted February 10, 2017 Share Posted February 10, 2017 Just now, TheLeonBM said: I tried that one. I started a new sandbox with abundant weapons (everything else extremely rare) and the lucky trait, killed 250 male zeds and not a single one of them dropped an axe. Is it a high enough number to assume that it worked? A 100% way to see if it worked is to change the line in suburbsdistributions.lua to something absurd like 100, which would normally ensure all zombie bodies had an axe, but the new code will cancel it out. GoodOldLeon 1 Link to comment Share on other sites More sharing options...
GoodOldLeon Posted February 10, 2017 Author Share Posted February 10, 2017 Did that, kill a hundred more and still no axes. After so many hours of trial and error I can't believe it was so easy. Thanks again, you've been a huge help. tommysticks 1 Link to comment Share on other sites More sharing options...
tommysticks Posted February 10, 2017 Share Posted February 10, 2017 5 minutes ago, TheLeonBM said: ...after so many hours of trial and error I can't believe it was so easy... I know this feeling... Link to comment Share on other sites More sharing options...
GoodOldLeon Posted February 10, 2017 Author Share Posted February 10, 2017 2 hours ago, tommysticks said: I know this feeling... I really hope it gets rarer over time lol Link to comment Share on other sites More sharing options...
Snakeman Posted September 19, 2017 Share Posted September 19, 2017 This method still works? (Toolstore, shelves) index 43 and 44. Because i get some red screens when i approach to toolstore Link to comment Share on other sites More sharing options...
GoodOldLeon Posted September 20, 2017 Author Share Posted September 20, 2017 1 hour ago, Snakeman said: This method still works? (Toolstore, shelves) index 43 and 44. Because i get some red screens when i approach to toolstore La última vez que lo testeé todavía funcionaba (hace tres semanas apróx.), así que calculo que no deberías tener ningún problema. Link to comment Share on other sites More sharing options...
Snakeman Posted September 20, 2017 Share Posted September 20, 2017 2 minutes ago, TheLeonBM said: La última vez que lo testeé todavía funcionaba (hace tres semanas apróx.), así que calculo que no deberías tener ningún problema. Tu seteo es solo en zombies? Link to comment Share on other sites More sharing options...
tommysticks Posted September 22, 2017 Share Posted September 22, 2017 On 9/19/2017 at 7:33 PM, Snakeman said: This method still works? (Toolstore, shelves) index 43 and 44. Because i get some red screens when i approach to toolstore The only reason it wouldn't work is if stuff was added to the table, which would change the indexes. Or if you play with a mod that adds shit to zombie corpses. 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