Hi!
I’m trying to work out a system (in javascript) that will spawn an item in a pre-placed loot pile. Using Random.Range, I could have easily just had it so that any item spawns randomly, but I want different items to be rarer/more common than others. If you’re not sure what I’m on about I’m trying to replicate the Day-Z loot system Day-Z wiki.
So far I’ve created an ‘item list’ that just has an array for an item, with it’s name and then it’s object. The variable name is the item’s ‘data value’.
static var i4310 = Array("Riot Shotgun Slugs", Resources.Load("i4310"));
Also I have another script that says how rare it is in certain areas.
//Rarity out of 100
/*i4310 - riot shotgun ammo*/ static var i4310Rarity = 40; //40 for testing purposes
So my question is; How can you make items spawn at pre-placed loot spawn locations, and have a different rarity for each item?
Hopefully that wasn’t too much to ask, thanks in advance!