• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

math.random question

Zantera.S

New Member
Joined
Feb 20, 2013
Messages
83
Reaction score
2
Hello so I have a question about a part of this code

XML:
lookType = math.random(136,142)

Where look type 136 is Female Citizen and 142 is Female Warrior. Does this mean it was pick a look type between 136-142 or will it only pick 136 or 142?
 
This is for team battle event, so I want the outfits to be random but i want all of the player outfits in there so there is a random chance of getting any outfit :)
 
Code:
local outfits = {{id = 136, chance = 20}, {id = 142, chance = 40}}
local lookType, randomChance = nil, math.random(1, 100)

for k, v in pairs(outfits) do
	if randomChance <= v.chance then
		lookType = v.id
		break
	end
end

I do this very fast, but this isn't work 100% perfect....
 
Back
Top