Duuhzinhow 30 Postado Maio 7, 2015 Share Postado Maio 7, 2015 (editado) Alguem poderia colocar condowl de 15 segundos nessa spell para mim? Quero tambem que coloque o (distanceeffect 29) e o (effect 34).. remove_time = 4 local item_id = 1285 function onCastSpell(cid, var) 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 Ja adicionei no function.lua >> V function getCooldown(cid, spellname) local storage = tostring(getPlayerStorageValue(cid, 40001)) local spellname = '"' .. spellname .. '"' return string.find(storage, spellname) and tonumber(string.match(storage, "%d+", string.find(storage, spellname) + #spellname)) - os.time() or 0 end function setCooldown(cid, spellname, seconds) local storage = getPlayerStorageValue(cid, 40001) == -1 and "" or tostring(getPlayerStorageValue(cid, 40001)) local spellname = '"' .. spellname .. '"' if string.find(storage, spellname) then local gsub = string.gsub(storage, string.match(storage, "%d+", string.find(storage, spellname) + #spellname), tostring(os.time() + seconds)) setPlayerStorageValue(cid, 40001, gsub) else setPlayerStorageValue(cid, 40001, storage .. spellname .. " " .. tostring(seconds + os.time()) .. " ") end end function isExhausted(cid, spellname) return getCooldown(cid, spellname) > 0 end Agradeço desde ja, rep+ Vitera is comming... Fique ligado Editado Maio 8, 2015 por Duuhzinhow Link para o comentário Compartilhar em outros sites More sharing options...
0 Duuhzinhow 30 Postado Maio 12, 2015 Autor Share Postado Maio 12, 2015 Tenta isso se for oque eu to pensando ta certo porque testei aqui mas com uns efeitos fedorentos. remove_time = 6 local item_id = 1285 local efeitodistancia = 29 local magikeffect = 34 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, efeitodistancia) function onCastSpell(cid, var) if exhaustion.check(cid, 23006) == false then exhaustion.set(cid, 23006, 10) else doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 23006).."]") return false end 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(item_id, 1, posAll[i]) doSendMagicEffect(posAll[i], magikeffect) end end addEvent(removeItem, remove_time*1000, posAll) return doCombat(cid, combat, var) and 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 O distanceeffect nao saiu... Link para o comentário Compartilhar em outros sites More sharing options...
0 Wend ll 268 Postado Maio 12, 2015 Share Postado Maio 12, 2015 (editado) Mano o efeito pra sair em cima das pedras deu certo, rep + quero tipo, colocar um distance effect, que saia do player e va para o target... entendeu? kkkk Testei e está funcionando: remove_time = 4 local item_id = 1285 function onCastSpell(cid, var) if exhaustion.check(cid, 23006) == false then exhaustion.set(cid, 23006, 10) else doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 23006).."]") return false end 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(item_id, 1, posAll[i]) doSendMagicEffect(posAll[i], 34) doSendDistanceEffect(getThingPos(cid), getThingPosition(getCreatureTarget(cid)), 29) 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 @Duuhzinhow Editado Maio 12, 2015 por AnnaFeeh Link para o comentário Compartilhar em outros sites More sharing options...
0 Duuhzinhow 30 Postado Maio 12, 2015 Autor Share Postado Maio 12, 2015 Testei e está funcionando: remove_time = 4 local item_id = 1285 function onCastSpell(cid, var) if exhaustion.check(cid, 23006) == false then exhaustion.set(cid, 23006, 10) else doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 23006).."]") return false end 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(item_id, 1, posAll[i]) doSendMagicEffect(posAll[i], 34) doSendDistanceEffect(getThingPos(cid), getThingPosition(getCreatureTarget(cid)), 29) 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 Bom, nao sei oq esta funcionando ai entao kkkkk aqui aconteceu o seguinte: Cada vez que usa a spell, cria apenas uma das pedras, ou seja, tem que usar varias vezes para criar todas, elas nao sao removidas, e nao sai o distance effect. ;v Link para o comentário Compartilhar em outros sites More sharing options...
0 Wend ll 268 Postado Maio 14, 2015 Share Postado Maio 14, 2015 (editado) Bom, nao sei oq esta funcionando ai entao kkkkk aqui aconteceu o seguinte: Cada vez que usa a spell, cria apenas uma das pedras, ou seja, tem que usar varias vezes para criar todas, elas nao sao removidas, e nao sai o distance effect. ;v Teste assim: remove_time = 4 local item_id = 1285 function onCastSpell(cid, var) if exhaustion.check(cid, 23006) == false then exhaustion.set(cid, 23006, 10) else doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 23006).."]") return false end 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(item_id, 1, posAll[i]) doSendDistanceShoot(getCreaturePosition(cid), posAll[i], 29) -- efeito de distancia doSendMagicEffect(posAll[i], 34) -- efeito normal 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 Editado Maio 14, 2015 por AnnaFeeh Link para o comentário Compartilhar em outros sites More sharing options...
0 Furabio 257 Postado Maio 14, 2015 Share Postado Maio 14, 2015 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
Duuhzinhow 30
Alguem poderia colocar condowl de 15 segundos nessa spell para mim? Quero tambem que coloque o (distanceeffect 29) e o (effect 34)..
remove_time = 4
Fique ligadoLink para o comentário
Compartilhar em outros sites
20 respostass a esta questão
Posts Recomendados