Eu criei um script em que você usa uma chave num portal e então sai um monstro aleatório... Só que não funcionou, alguém poderia concertar este erro para mim?
local monstro = {
{"Ogre", 1},
{"demon", 1},
}
local chance = 20 --1% chance
function onUse(cid, item, fromPosition, itemEx, toPosition)
local function back(item, pos)
doCreateItem(item.itemid, 1, pos)
end
if itemEx.itemid == 12593 then << id do portao
local item = getTileItemById(toPosition, 12593) << id do portao
addEvent(back, choose(5, 10, 15) * 60 * 1000, itemEx, toPosition)
doSendMagicEffect(toPosition, 1)
if math.random(1000) <= chance*20 then
local this = monstro[math.random(#monstro)]
local pokes = doCreateMonster("Ogre",toPosition)
if isCreature(monstro) then
local summon = getCreatureSummons(cid)[1]
if isCreature(summon) then
doSendMagicEffect(getThingPos(summon), 173)
doChallengeCreature(summon, monstro)
else
doSendMagicEffect(getThingPos(cid), 173)
doChallengeCreature(cid, monstro)
end
return true
end
end
end
Pergunta
LordTibia123 0
Eu criei um script em que você usa uma chave num portal e então sai um monstro aleatório... Só que não funcionou, alguém poderia concertar este erro para mim?
local monstro = { {"Ogre", 1}, {"demon", 1}, } local chance = 20 --1% chance function onUse(cid, item, fromPosition, itemEx, toPosition) local function back(item, pos) doCreateItem(item.itemid, 1, pos) end if itemEx.itemid == 12593 then << id do portao local item = getTileItemById(toPosition, 12593) << id do portao addEvent(back, choose(5, 10, 15) * 60 * 1000, itemEx, toPosition) doSendMagicEffect(toPosition, 1) if math.random(1000) <= chance*20 then local this = monstro[math.random(#monstro)] local pokes = doCreateMonster("Ogre",toPosition) if isCreature(monstro) then local summon = getCreatureSummons(cid)[1] if isCreature(summon) then doSendMagicEffect(getThingPos(summon), 173) doChallengeCreature(summon, monstro) else doSendMagicEffect(getThingPos(cid), 173) doChallengeCreature(cid, monstro) end return true end end endLink para o comentário
https://xtibia.com/forum/topic/208405-script-portal-de-monstros/Compartilhar em outros sites
15 respostass a esta questão
Posts Recomendados