Postado Julho 16, 2015 10 anos Bom, eu gostaria de pedir ajuda, peguei uma magia aqui no forum, ela funciona tudo okay, mas se o player morrer ou deslogar enquanto a magia estiver tendo efeito, ela fica spamando mensagens no distro de errors causando um lag absurdo tanto no pc e no servidor -- dash as it is in avaOT by Night Wolf local damage = 20 -- dano que toma qnd bate em algum obstáculo local function isWalkable(pos, creature, proj, pz)-- by Nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false, true 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 onWalk(cid) local poslook = getCreatureLookPosition(cid) poslook.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE if isWalkable(poslook, false, false, false) then if not isCreature(getThingfromPos(poslook).uid) then doMoveCreature(cid, getPlayerLookDirection(cid)) doSendMagicEffect(getPlayerPosition(cid), 14) return true else doCreatureAddHealth(cid, -damage) doSendMagicEffect(getPlayerPosition(cid), 31) doSendAnimatedText(getPlayerPosition(cid), "-"..damage , 180) return true end else doCreatureAddHealth(cid, -damage) doSendMagicEffect(getPlayerPosition(cid), 31) doSendAnimatedText(getPlayerPosition(cid), "-"..damage , 180) end end function onCastSpell(cid, var) local distance = 15 for i = 0, distance do addEvent(onWalk,90*i,cid) end return true end Segue os errors [16/07/2015 12:31:42] [Error - Spell Interface] [16/07/2015 12:31:42] In a timer event called from: [16/07/2015 12:31:42] data/spells/scripts/dash.lua:onCastSpell [16/07/2015 12:31:42] Description: [16/07/2015 12:31:42] (luaGetThingPosition) Thing not found [16/07/2015 12:31:42] [Error - Spell Interface] [16/07/2015 12:31:42] In a timer event called from: [16/07/2015 12:31:42] data/spells/scripts/dash.lua:onCastSpell [16/07/2015 12:31:42] Description: [16/07/2015 12:31:42] (luaGetCreatureLookDirection) Creature not found [16/07/2015 12:31:42] [Error - Spell Interface] [16/07/2015 12:31:42] In a timer event called from: [16/07/2015 12:31:42] data/spells/scripts/dash.lua:onCastSpell [16/07/2015 12:31:42] Description: [16/07/2015 12:31:42] data/spells/scripts/dash.lua:26: attempt to index local 'poslook' (a boolean value) [16/07/2015 12:31:42] stack traceback: [16/07/2015 12:31:42] data/spells/scripts/dash.lua:26: in function <data/spells/scripts/dash.lua:24> O que eu gostaria que fizessem seria colocar uma especie de storage que checa se a magia ta continuando ou não, ou seja uma storage pra tirar esse lag caso o player morra ou deslogue
Postado Julho 16, 2015 10 anos -- dash as it is in avaOT by Night Wolf local damage = 20 -- dano que toma qnd bate em algum obstáculo local function isWalkable(pos, creature, proj, pz)-- by Nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and pz then return false, true 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 onWalk(cid) if not isCreature(cid) then return true end local poslook = getCreatureLookPosition(cid) poslook.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE if isWalkable(poslook, false, false, false) then if not isCreature(getThingfromPos(poslook).uid) then doMoveCreature(cid, getPlayerLookDirection(cid)) doSendMagicEffect(getPlayerPosition(cid), 14) return true else doCreatureAddHealth(cid, -damage) doSendMagicEffect(getPlayerPosition(cid), 31) doSendAnimatedText(getPlayerPosition(cid), "-"..damage , 180) return true end else doCreatureAddHealth(cid, -damage) doSendMagicEffect(getPlayerPosition(cid), 31) doSendAnimatedText(getPlayerPosition(cid), "-"..damage , 180) end end function onCastSpell(cid, var) local distance = 15 for i = 0, distance do addEvent(onWalk,90*i,cid) end return true end _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
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.