Jump to content
kinyoshi

Better way to spawn items?

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

Share this post


Link to post
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 :)

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...