Hello,
i just wonder how can i add that when it summon the monster from table, it will also summon the amount it get from that monster row table.
Thanks.
i just wonder how can i add that when it summon the monster from table, it will also summon the amount it get from that monster row table.
Code:
local monsters = {
["Rat"] = {level = 3, amount = 2},
["Cave Rat"] = {level = 5, amount = 4}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local mons = {}
for a, b in pairs (monsters) do
if getPlayerLevel(cid) >= b.level then
table.insert(mons, a)
end
end
doSummonCreature(mons[math.random(#mons)], toPosition)
doCreatureSay(cid, "Watch out!", TALKTYPE_ORANGE_1)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
return true
end
Thanks.