I don't now how to get informations from a table like that, so I want someone to help me with that.
I need each monster with an individual chance.
Here are the script:
I need each monster with an individual chance.
Here are the script:
Lua:
local config = {
chance = 2,
bosses = {
--["monster_name"] = "boss",
["Dragon Lord"] = "Demondras", --Like ["Dragon Lord"] = "Demondras", chance = 15
["Juggernaut"] = "Massacre", --["Juggernaut"] = "Massacre", chance = 3
},
}
function onSpawn(cid)
if isMonster(cid) then
addEvent(function()
if isCreature(cid) then
local boss = config.bosses[getCreatureName(cid)]
if math.random(1, 100) <= config.chance then
local pos = getThingPos(cid)
doRemoveCreature(cid)
doCreateMonster(boss, pos)
end
end
end, 5)
end
return true
end