Postado Abril 27, 2020 5 anos Estou com um problema no script de spell, é uma spell de trap que cria itens em volta do player. Ao usa-lá, não acontece nada, mas também não aparece nenhum erro na distro. Mostrar conteúdo oculto function isWalkable(pos, creature, pz, proj) if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end local creature = getTopCreature(pos) if creature.type > 0 then return false end if getTilePzInfo(pos) and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function onCastSpell(cid, var) if isPlayer(cid) and exhaustion.check(cid, 5750) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 5750) .. " segundos para usar novamente.") return false end exhaustion.set(cid, 5750, 2) local pos = getThingPosition(getCreatureTarget(cid)) for x = -1,1 do for y = -1,1 do posicao = {x = pos.x + x, y = pos.y + y, z = pos.z} if isWalkable(posicao) and posicao ~= {x = pos.x,y = pos.y,z = pos.z} then doCreateItem(5750,1,posicao) end end end addEvent(function() for x = -1,1 do for y = -1,1 do posicao = {x = pos.x + x, y = pos.y + y, z = pos.z} if getTileItemById(posicao, 5750).uid > 0 then doRemoveItem(getTileItemById(posicao, 5750).uid) end end end end,5*1000) return true endfunction isWalkable(pos, creature, pz, proj) if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end local creature = getTopCreature(pos) if creature.type > 0 then return false end if getTilePzInfo(pos) and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function onCastSpell(cid, var) if isPlayer(cid) and exhaustion.check(cid, 5750) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 5750) .. " segundos para usar novamente.") return false end exhaustion.set(cid, 5750, 2) local pos = getThingPosition(getCreatureTarget(cid)) for x = -1,1 do for y = -1,1 do posicao = {x = pos.x + x, y = pos.y + y, z = pos.z} if isWalkable(posicao) and posicao ~= {x = pos.x,y = pos.y,z = pos.z} then doCreateItem(5750,1,posicao) end end end addEvent(function() for x = -1,1 do for y = -1,1 do posicao = {x = pos.x + x, y = pos.y + y, z = pos.z} if getTileItemById(posicao, 5750).uid > 0 then doRemoveItem(getTileItemById(posicao, 5750).uid) end end end end,5*1000) return true end
Postado Abril 27, 2020 5 anos Mostrar conteúdo oculto <instant name="prision" words="prision" lvl="200" mana="100" aggressive="1" range="6" blockwalls="1" needtarget="1" exhaustion="0" needlearn="0" event="script" value="prision.lua"> <vocation id="1"/> </instant> Mostrar conteúdo oculto local duracao = 5 -- tempo em segundos para remover os item q apareçe local idItem = 5750 -- id do item function onCastSpell(cid, var) local waittime = 5 -- Tempo de cdr local storage = 15288 if exhaustion.check(cid, storage) then return false end exhaustion.set(cid, storage, waittime) local pos = getThingPosition(getCreatureTarget(cid)) posTile1 = {x=pos.x+1,y=pos.y+1,z=pos.z,stackpos=1} posTile2 = {x=pos.x+1,y=pos.y,z=pos.z,stackpos=1} posTile3 = {x=pos.x+1,y=pos.y-1,z=pos.z,stackpos=1} posTile4 = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=1} posTile5 = {x=pos.x-1,y=pos.y-1,z=pos.z,stackpos=1} posTile6 = {x=pos.x-1,y=pos.y,z=pos.z,stackpos=1} posTile7 = {x=pos.x-1,y=pos.y+1,z=pos.z,stackpos=1} posTile8 = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=1} posAll = {posTile1,posTile2,posTile3,posTile4,posTile5,posTile6,posTile7,posTile8} for i=1, #posAll do if isWalkable(posAll[i]) then doCreateItem(idItem, 1, posAll[i]) end end addEvent(removeItem, duracao*1000, posAll) return true end function isWalkable(pos, creature, pz, proj) if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end local creature = getTopCreature(pos) if creature.type > 0 then return false end if getTilePzInfo(pos) and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function removeItem(posAll) for i=1, #posAll do for j=0, 255 do pos_stack = {x=posAll[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j} removeTile = getThingfromPos(pos_stack) if removeTile.itemid == idItem then doRemoveItem(removeTile.uid) end end end end
Postado Abril 27, 2020 5 anos Autor @Spooky Ghost Também não funconou, os itens que aparecem ao redor do player não aparecem. Também não deu nenhum erro no console
Postado Abril 27, 2020 5 anos Estranho, aqui funcionou você tentou com outros items tmb? pode ser o item que você quer que apareça que está com problema.
Postado Abril 27, 2020 5 anos Autor @Spooky Ghost O item está normal, consigo criar ele in game com o comando /i. Meu servidor é 8.6 OTX, será que é este o problema? Editado Abril 27, 2020 5 anos por MarkCharlotte (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.