elnelson
Lunaria World Dev
Hello, good morning!
I have a crafting system that uses a RNG to get skill level. But im struggling with getting values from the table i made.
I want to raise the chances to get the level if the item is better and uses more amount of items to craft.
At the moment i have 3 tier ore bars (copper, silver and mithril)
(E.G; recipe for brass armor uses 3 copper bar, then the math.random formula will be;
math.random(1+10(exp of bar)*3(amount of bars), professionSkill*1.15) >= professionSkil
If want to create a plate armor that uses 5 silver bars then
math.random(1+50(exp)*5(amount), professionSkill*1.15) >= professionSkil
Hope you guys could orientate me how to achieve this, in advance thanks!
I have a crafting system that uses a RNG to get skill level. But im struggling with getting values from the table i made.
Lua:
local itemlvl = {
[1] = {bar=12808, exp = 10, amount},
[2] = {bar=12814, exp = 50, amount},
[3] = {bar=12815, exp = 100, amount}
}
local professionSkill = getPlayerStorageValue(cid, 1039)
if math.random(1, professionSkill*1.15) >= professionSkill then
if professionSkill < 500 then
setPlayerStorageValue(cid, 1039, professionSkill + 1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You advanced in forging ["..professionSkill.."].")
end
end
I want to raise the chances to get the level if the item is better and uses more amount of items to craft.
At the moment i have 3 tier ore bars (copper, silver and mithril)
(E.G; recipe for brass armor uses 3 copper bar, then the math.random formula will be;
math.random(1+10(exp of bar)*3(amount of bars), professionSkill*1.15) >= professionSkil
If want to create a plate armor that uses 5 silver bars then
math.random(1+50(exp)*5(amount), professionSkill*1.15) >= professionSkil
Hope you guys could orientate me how to achieve this, in advance thanks!