I'm trying to go about creating a weighted choice system to spawn Weapons, Ammo, Health and monsters, but the problem I'm encountering is that I have no idea how to increase the probability of high-tier weapons, ammo and health if I choose a high-tier monster. Is anyone familiar with a concept like this?
Create a model in Lighting, for example and just clone the things to account for the probability The following example will just put empty model in the Workspace based on the probability. Instead you should use a full model or tool and then have it positioned. Ex
local m=Instance.new("Model",game.Lighting) local k=Instance.new("Model",m) k.Name='Hi' local k=Instance.new("Model",m) k.Name='Hi' local k=Instance.new("Model",m) k.Name='Bye' function Get() local n=game.Lighting.Model:GetChildren() local r=n[math.random(1,n)]:Clone() return r end function Add() local n=Instance.new("Model",game.Lighting.Model) n.Name='Bye' end --Set 'Bye' to 50% Add() --Place in Workspace while true do local s=Get() s.Parent=game.Workspace wait(math.random(15,20)) end
Well, you could insert another value, and then find the amount of values and name each value "Tier" or something, and already have a few values with different tiers. Then the script can go through and check for the values and randomly pick one with math.random. Then if it picks a value named High Tier, then another math.random function for getting any one of the high tier items