Tá ai. Se souber fazer, vai entender.
local conf = {
["Rat"] = {points = 5, chance = 5},
}
if(math.randon(1, 100) <= conf[getCreatureName(cid)].chance)then
--aqui adiciona o seu codigo
-- conf[getCreatureName(cid)].points
end
Tá ai. Se souber fazer, vai entender.
local conf = {
["Rat"] = {points = 5, chance = 5},
}
if(math.randon(1, 100) <= conf[getCreatureName(cid)].chance)then
--aqui adiciona o seu codigo
-- conf[getCreatureName(cid)].points
end
info
Grupo: Visconde
Registrado: 08/10/11
Posts: 444
Reputação: +71
Gênero: Feminino
Char no Tibia: No Have.

monster = {
["Demon"] = {itemid = 1403, count = 1, chance = 20 }
}
function onKill(cid, target, lastHit)
if(math.random(1, 100) <= monster[getCreatureName(cid)].chance)then
if monster[getCreatureName(target)] then
monster = monster [getCreatureName(target)]
doPlayerAddItem(cid, monster.itemid, monster.count)
end
end
return true
end
Editado Junho 13 por DarkHeel
local monster = {
["Demon"] = {itemid = 1403, count = 1, chance = 20}
}
function onKill(cid, target, lastHit)
local m = monster[getCreatureName(target)]
if m and math.random(1, 100) <= m.chance then
doPlayerAddItem(cid, m.itemid, m.count)
end
return true
end
info
Grupo: Visconde
Registrado: 08/10/11
Posts: 444
Reputação: +71
Gênero: Feminino
Char no Tibia: No Have.
["Rat"] = {hp = 5, mp = 5, chance = 5}
Como eu faço para por chance em tabelas, no caso isso seria um Creaturescripts, ao matar o rat teria chance de curar 5 hp e 5 de mp, eu so queria saber como funciona melhor math.random.