Jump to content

Better way to spawn items?


kinyoshi

Recommended Posts

So ya, is there a better way than below to spawn items? I've been running into Swap Buffer errors when starting games and sometimes loading a save-game (maybe one in every 20 starts error out, but I start hundreds of games daily, testing stuff out..), only with a load of items mods that spawn a massive amount of stuff.

table.insert(SuburbsDistributions["all"]["bin"].items, "EntomophagyMod.KMDragonFly1");table.insert(SuburbsDistributions["all"]["bin"].items, 1.7);
Edited by kinyoshi
Link to comment
Share on other sites

I can't say it surprises me, looking at the amount of lines you insert in that poor global table :D

RegularX uses a more convenient to insert the lines IIRC, but that won't help with your problems. The only thing that will help is reducing the amount of stuff you dump in the table. Remove double entries for example.

But maybe one of our more tech-savvy programming members has a better answer :)

Link to comment
Share on other sites

I can't say it surprises me, looking at the amount of lines you insert in that poor global table :D

RegularX uses a more convenient to insert the lines IIRC, but that won't help with your problems. The only thing that will help is reducing the amount of stuff you dump in the table. Remove double entries for example.

But maybe one of our more tech-savvy programming members has a better answer :)

 

But I put the double entries for a reason. Guess I'll keep it all like I have it unless a better way comes out :D.

Link to comment
Share on other sites

 

So ya, is there a better way than below to spawn items? I've been running into Swap Buffer errors when starting games and sometimes loading a save-game (maybe one in every 20 starts error out, but I start hundreds of games daily, testing stuff out..), only with a load of items mods that spawn a massive amount of stuff.

table.insert(SuburbsDistributions["all"]["bin"].items, 1.7);

 

The reason the game is crashing is that you're most likely overloading the game with stored items. Like I stated your spawn percentages are way too high. Everything needs to be "0.1". Also get rid of all the duplicate item drop code.

Link to comment
Share on other sites

 

 

So ya, is there a better way than below to spawn items? I've been running into Swap Buffer errors when starting games and sometimes loading a save-game (maybe one in every 20 starts error out, but I start hundreds of games daily, testing stuff out..), only with a load of items mods that spawn a massive amount of stuff.

table.insert(SuburbsDistributions["all"]["bin"].items, 1.7);

 

The reason the game is crashing is that you're most likely overloading the game with stored items. Like I stated your spawn percentages are way too high. Everything needs to be "0.1". Also get rid of all the duplicate item drop code.

 

 

Ya but the Hiking bag and such are 0.8, so 0.1 would make all of my items super rare.

Link to comment
Share on other sites

You could do your own right-click context menu entry for certain containers and then let them spawn the items. Tie it to a timed action and let it randomly choose from a seperate list. E.g. an "Search for spices" entry for kitchen counters.

 

This is a good idea, and it is how I handle Rat Traps in SICmod.  It would mean you are only spawning new items into the world on player input, would allow for a very high number of items, etc.

 

And yeah, I just have a convenience function to wrap the normal two line call - but just to reduce overall code length.  Wouldn't effect this (and should be noted I haven't done much testing there on really rare items, everything in SICmod is intended to be pretty common).

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