Postado Setembro 8, 2013 11 anos Tenho essa magia de trap,porem os traps não somen,alguem poderia me ajudar local remove_time = 7 -- tempo em segundos para remover as magic wall local item_id = 1497 -- id da magic wall function onCastSpell(cid, var) local pos = getThingPosition(getCreatureTarget(cid)) local efeito = 251 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(item_id, 1, posAll[i]) doSendMagicEffect(posAll[i], efeito) 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[i].x,y=posAll[i].y,z=posAll[i].z,stackpos=j} removeTile = getThingfromPos(pos_stack) if removeTile.itemid == item_id then doRemoveItem(removeTile.uid) end end end end
Postado Setembro 8, 2013 11 anos créditos brun123 usa essa: function onCastSpell(cid) local item = 1497 local tempo = 5 * 1000 local efeito_ao_criar = CONST_ME_MAGIC_GREEN local efeito_ao_remover = CONST_ME_POFF for direction = 0, 7 do local position = getPosByDir(getThingPos(cid), direction) doCreateItem(item, position) doSendMagicEffect(position, efeito_ao_criar) end addEvent(function (center, id) for direction = 0, 7 do local position = getPosByDir({x = center.x, y = center.y, z = center.z}, direction) local item = getTileItemById(position, id).uid if item > 1 then doSendMagicEffect(position, efeito_ao_remover) doRemoveItem(item) end end end, tempo, getThingPos(cid), item) return true end Ot Design: https://discord.gg/VgtVRNmCD7
Postado Setembro 8, 2013 11 anos ta então tenta essa modificada: local remove_time = 7 -- tempo em segundos para remover as magic wall local item_id = 2719 -- id da magic wall local efeito = 197 --efeito q vai sair nas posiçoes da trap local 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 local function removeAll(pos, item_id) for i = 0, 7 do local posi = getPosByDir(pos, i) local item = getTileItemById(posi, item_id) if item and item.uid > 1 then doRemoveItem(item.uid, 1) end end end function onCastSpell(cid, var) local target = getCreatureTarget(cid) if not isCreature(target) then return not doPlayerSendCancel(cid, "You need a target!") end for i = 0, 7 do local pos = getPosByDir(getThingPos(target), i) if isWalkable(pos, true, true, false) then doCreateItem(item_id, 1, pos) doSendMagicEffect(pos, efeito) end end addEvent(removeAll, remove_time*1000, getThingPos(target), item_id) return true end Ot Design: https://discord.gg/VgtVRNmCD7
Postado Setembro 8, 2013 11 anos e so mudar isso amigo addEvent(removeItem, remove_time*aqui se muda, posAll) raell, me come
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.