Jump to content

Prevent spawning


GoodOldLeon

Recommended Posts

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

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 by tommysticks
Link to comment
Share on other sites

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 by TheLeonBM
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by tommysticks
Link to comment
Share on other sites

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 by tommysticks
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 months later...
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 :P

 

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

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 :P

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

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