Postado Fevereiro 7, 2017 8 anos Olá, Preciso de alguém que me ajuda a arrumar uma spell. É um trap em target Preciso que o item (esse vermelho) apareca em baixo de todos es quadrados ao redor, para não ter como o target fugirde maneira alguma. O item no itens.otb O item no object builder Trap.lua local remove_time = 4 -- tempo em segundos para remover as magic wall local item_id = 12077 -- id da magic wall function onCastSpell(cid, var) doPlayerSay(cid, 'Shisekiyojin!', TALKTYPE_ORANGE_1) local waittime = 15 -- Tempo de exhaustion local storage = 115812 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) then doCreateItem(item_id, 1, posAll) end end addEvent(removeItem, remove_time*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.x,y=posAll.y,z=posAll.z,stackpos=j} removeTile = getThingfromPos(pos_stack) if removeTile.itemid == item_id then doRemoveItem(removeTile.uid) end end end end Editado Fevereiro 7, 2017 8 anos por diarmaint (veja o histórico de edições)
Postado Fevereiro 7, 2017 8 anos 3 horas atrás, diarmaint disse: Olá, Preciso de alguém que me ajuda a arrumar uma spell. É um trap em target Preciso que o item (esse vermelho) apareca em baixo de todos es quadrados ao redor, para não ter como o target fugirde maneira alguma. Mostrar conteúdo oculto O item no itens.otb Mostrar conteúdo oculto O item no object builder Mostrar conteúdo oculto Trap.lua Ocultar conteúdo local remove_time = 4 -- tempo em segundos para remover as magic wall local item_id = 12077 -- id da magic wall function onCastSpell(cid, var) doPlayerSay(cid, 'Shisekiyojin!', TALKTYPE_ORANGE_1) local waittime = 15 -- Tempo de exhaustion local storage = 115812 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) then doCreateItem(item_id, 1, posAll) endend addEvent(removeItem, remove_time*1000, posAll) return trueend 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 endreturn trueend function removeItem(posAll) for i=1, #posAll do for j=0, 255 do pos_stack = {x=posAll.x,y=posAll.y,z=posAll.z,stackpos=j} removeTile = getThingfromPos(pos_stack) if removeTile.itemid == item_id then doRemoveItem(removeTile.uid) end end endend Usa essa script e muda o id do item que tem : 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, 2728) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 2728) .. " segundos para usar novamente.") return false end exhaustion.set(cid, 2728, 8) 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(2728,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, 2728).uid > 0 then doRemoveItem(getTileItemById(posicao, 2728).uid) end end end end,5*1000) return true end
Postado Fevereiro 7, 2017 8 anos 1 hora atrás, diarmaint disse: O id do item seria aqui ? itemid == 0 then 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, 2728) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 2728) .. " segundos para usar novamente.") return false end exhaustion.set(cid, 2728, 8) 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(12007,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, 12007).uid > 0 then doRemoveItem(getTileItemById(posicao, 12007).uid) end end end end,5*1000) return true end
Postado Fevereiro 7, 2017 8 anos Autor 2 horas atrás, Gustavo Ntos disse: 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, 2728) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, 2728) .. " segundos para usar novamente.") return false end exhaustion.set(cid, 2728, 8) 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(12007,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, 12007).uid > 0 then doRemoveItem(getTileItemById(posicao, 12007).uid) end end end end,5*1000) return true end De alguma forma dava pra andar livremente encima do item criado, dei uma vasculhada no servidor aqui e peguei outro como base, ajustei as posições e deu tudo certo. --------- Special UE By WilkU ----------- --- local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) setCombatParam(combat1, COMBAT_PARAM_EFFECT, 131) setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -0.0, 0, -0.0, 0) local combat2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) setCombatParam(combat2, COMBAT_PARAM_EFFECT, 142) setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -0.0, 0, -0.0, 0) arr1 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } arr2 = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } local area1 = createCombatArea(arr1) local area2 = createCombatArea(arr2) setCombatArea(combat1, area1) setCombatArea(combat2, area2) local function onCastSpell1(parameters) doCombat(parameters.cid, parameters.combat1, parameters.var) end local function onCastSpell2(parameters) doCombat(parameters.cid, parameters.combat2, parameters.var) end function onCastSpell(cid, var) local waittime = 15 -- Tempo de exhaustion local storage = 115814 if exhaustion.check(cid, storage) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.") return false end local target = getCreatureTarget(cid) local pos2 = getPlayerPosition(target) local pos3 = getPlayerPosition(target) local pos4 = getPlayerPosition(target) local pos5 = getPlayerPosition(target) local pos6 = getPlayerPosition(target) local pos7 = getPlayerPosition(target) local pos8 = getPlayerPosition(target) local pos9 = getPlayerPosition(target) pos2.y=pos2.y+1 pos3.y=pos3.y+1 pos3.x=pos3.x+1 pos4.y=pos4.y-0 pos4.x=pos4.x+1 pos5.y=pos5.y+1 pos5.x=pos5.x-1 pos6.y=pos6.y+0 pos6.x=pos6.x-1 pos7.y=pos7.y-1 pos7.x=pos7.x+1 pos8.y=pos8.y-1 pos8.x=pos8.x-1 pos9.y=pos9.y-1 local aps1 = doCreateItem(12077,1,pos2) local aps2 = doCreateItem(12077,1,pos3) local aps3 = doCreateItem(12077,1,pos4) local aps4 = doCreateItem(12077,1,pos5) local aps5 = doCreateItem(12077,1,pos6) local aps6 = doCreateItem(12077,1,pos7) local aps7 = doCreateItem(12077,1,pos8) local aps8 = doCreateItem(12077,1,pos9) doDecayItem(aps1) doDecayItem(aps2) doDecayItem(aps3) doDecayItem(aps4) doDecayItem(aps5) doDecayItem(aps6) doDecayItem(aps7) doDecayItem(aps8) doPlayerSay(cid, 'Shisekiyojin!', TALKTYPE_ORANGE_1) exhaustion.set(cid, storage, waittime) return true end
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.