Jump to content

Random number of nails


dred

Recommended Posts

Hello. I was wondering if there is a way to change number of nails found in containers, to make it totally random. Items.txt defines the number = 5 and i can change it to my liking but it's not what i want. 

What variables can be used in the script, is there a list of'em and where it could search for it?(lua file i imagine) 

Link to comment
Share on other sites

 You can try add several new item drop chances through lua:
table.insert(SuburbsDistributions["all"]["crate"].items, "Base.Nails");    table.insert(SuburbsDistributions["all"]["crate"].items, 4)table.insert(SuburbsDistributions["all"]["crate"].items, "Base.Nails");    table.insert(SuburbsDistributions["all"]["crate"].items, 4)table.insert(SuburbsDistributions["all"]["crate"].items, "Base.Nails");    table.insert(SuburbsDistributions["all"]["crate"].items, 4)table.insert(SuburbsDistributions["all"]["crate"].items, "Base.Nails");    table.insert(SuburbsDistributions["all"]["crate"].items, 4)table.insert(SuburbsDistributions["all"]["crate"].items, "Base.Nails");    table.insert(SuburbsDistributions["all"]["crate"].items, 4)

4 is chance for every roll (all/crate distribution have one roll,you can check rolls and chances in media/lua/items/SuburbsDistributions.lua),this will add spawn chance for additional 0/5/10/15/20/25 nails into crates. 

 

Or you can check media/scripts/suburbsdistribution.txt but im not sure how that work

Link to comment
Share on other sites

  • 2 weeks later...

I'm talking about completely random numbers, 15, 9, 56, 28 etc., rather than multiplier. I was thinking of system, which gives a different result for each roll -or-

when a container do a roll each time they are drawn items (in our case - nails), their number is selected randomly from a 1-100 scale.

Other possibility is to change 'Count = 1,' and add more roll chances, like suggested Ramibuk?

Are those possibilities or i am only imagining things? :unsure:

Link to comment
Share on other sites

Well RJ has added a nifty new event which is called each time a container is filled.

 

local function spawnGlobalStories(_roomName, _containerType, _containerFilled)...endEvents.OnFillContainer.Add(spawnGlobalStories);
You could use it to write your own random-nail-generator (see what I did there?).
Link to comment
Share on other sites

Thank you, i try to use that later but for now i have did it in the easy way - i have changed nails number to Count = 1 and 100x this line: "(Base.Nails", 4)" in the SuburbsDistribution and it's actually working good. What i must change is "Base.Nails", 4, to "Base.Nails", 1, and try it with those values.

I will play a little and report how it's working.Thanks for the tips. 

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