Postado Setembro 4, 2020 4 anos 14 horas atrás, xWhiteWolf disse: Adiciona essa função no inicio do script: function doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, n) if fromPos ~= nil and (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) then doSendDistanceShoot(fromPos, getCreaturePosition(target), effectx) fromPos = (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) and getCreaturePosition(target) or nil else fromPos = getCreaturePosition(target) end doTargetCombatHealth(uid, target, type, -min, -max, effectz) n = n or 1 if math.random(1, 10) <= (percent/10) then possible = {} for j = -3, 3 do for k = -3, 3 do middlePos = {x = getCreaturePosition(target).x + j, y = getCreaturePosition(target).y + k, z = getCreaturePosition(target).z, stackpos = 253} if isWalkable(middlePos, false, true, true) then creature = getTopCreature(middlePos).uid if creature > 0 then table.insert(possible, creature) end end end end target = #possible > 0 and possible[math.random(#possible)] or target end if n < hits then addEvent(function() if isCreature(uid) and isCreature(target) then doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, (n + 1)) end end, delay) end return true end Que bom que voce ainda ta pelo forum ainda todas os posts que vejo são antigoes hahaha. Cara botei esse codigo antes da script da spell. Agora carregou mas ela não ta batendo de target em target só das os multiplos hits em 1 target. Eu to com ml 40, e testei de perto de longe com varios e só pega 1 target. O script ficou assim: (Nao estou conseguindo carregar da forma correta. Me perdoem) -------------------------------------------------------------------------------------------------------- function doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, n) if fromPos ~= nil and (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) then doSendDistanceShoot(fromPos, getCreaturePosition(target), effectx) fromPos = (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) and getCreaturePosition(target) or nil else fromPos = getCreaturePosition(target) end doTargetCombatHealth(uid, target, type, -min, -max, effectz) n = n or 1 if math.random(1, 10) <= (percent/10) then possible = {} for j = -3, 3 do for k = -3, 3 do middlePos = {x = getCreaturePosition(target).x + j, y = getCreaturePosition(target).y + k, z = getCreaturePosition(target).z, stackpos = 253} if isWalkable(middlePos, false, true, true) then creature = getTopCreature(middlePos).uid if creature > 0 then table.insert(possible, creature) end end end end target = #possible > 0 and possible[math.random(#possible)] or target end if n < hits then addEvent(function() if isCreature(uid) and isCreature(target) then doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, (n + 1)) end end, delay) end return true end local config = { effectx = 35, --- efeito de distancia effectz = 11, --- efeito ao acertar o player percent = 100, --- porcentagem de ir pra outro target apos hitar delay = 300 --- velocidade com que se move (milisegundos) } function onCastSpell(cid, var) local maglevel, level, mana = getPlayerMagLevel(cid), getPlayerLevel(cid), getCreatureMana(cid) local axe, sword, club, distance = getPlayerSkillLevel(cid, 3), getPlayerSkillLevel(cid, 2), getPlayerSkillLevel(cid, 1), getPlayerSkillLevel(cid, 4) local shield, health = getPlayerSkillLevel(cid, 5), getCreatureHealth(cid) local formula = { min = ((level + maglevel)/5 + axe + sword + club + shield + (mana/1000))/3, --- formula de dano minimo max = ((level + maglevel)/5 + axe + sword + club + shield + ((mana + health)/1000))/3 --- formula de dano maximo } local pos = getCreaturePosition(cid) doCreatureSay(cid, "Chain Lightning", 20, false, 0, pos) hits = math.ceil(getPlayerMagLevel(cid)/10) - (math.random(0, (math.floor(getPlayerMagLevel(cid)/10))) - 1) target = getCreatureTarget(cid) doBlast(cid, target, config.delay, config.effectx, config.effectz, config.percent, formula.min, formula.max, 2, hits, getCreaturePosition(cid), nil) return true end Editado Setembro 4, 2020 4 anos por Vorkhon (veja o histórico de edições)
Postado Setembro 8, 2020 4 anos Em 06/09/2020 em 11:43, xWhiteWolf disse: algum erro no console? Nao aparece nada no console. A spell só bate algumas vezes seguidas no mesmo target. EDIT: Cara bizzarramente entrou outro GM para a gente testar as coisas e funcionou. Mas comigo sozinho não estava funcionando. Editado Setembro 9, 2020 4 anos por Vorkhon (veja o histórico de edições)
Postado Março 28, 2021 4 anos Nao deu erro podem nao foi efeito local config = { effectx = 35, --- efeito de distancia effectz = 11, --- efeito ao acertar o player percent = 70, --- porcentagem de ir pra outro target apos hitar delay = 150 --- velocidade com que se move (milisegundos) } 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 doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, n) if fromPos ~= nil and (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) then doSendDistanceShoot(fromPos, getCreaturePosition(target), effectx) fromPos = (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) and getCreaturePosition(target) or nil else fromPos = getCreaturePosition(target) end doTargetCombatHealth(uid, target, type, -min, -max, effectz) n = n or 1 if math.random(1, 10) <= (percent/10) then possible = {} for j = -3, 3 do for k = -3, 3 do middlePos = {x = getCreaturePosition(target).x + j, y = getCreaturePosition(target).y + k, z = getCreaturePosition(target).z, stackpos = 253} if isWalkable(middlePos, false, true, true) then creature = getTopCreature(middlePos).uid if creature > 0 then table.insert(possible, creature) end end end end target = #possible > 0 and possible[math.random(#possible)] or target end if n < hits then addEvent(function() if isCreature(uid) and isCreature(target) then doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, (n + 1)) end end, delay) end return true end function onCastSpell(cid, var) local maglevel, level, mana = getPlayerMagLevel(cid), getPlayerLevel(cid), getCreatureMana(cid) local axe, sword, club, distance = getPlayerSkillLevel(cid, 3), getPlayerSkillLevel(cid, 2), getPlayerSkillLevel(cid, 1), getPlayerSkillLevel(cid, 4) local shield, health = getPlayerSkillLevel(cid, 5), getCreatureHealth(cid) local formula = { min = ((level + maglevel)/5 + axe + sword + club + shield + (mana/1000))/3, --- formula de dano minimo max = ((level + maglevel)/5 + axe + sword + club + shield + ((mana + health)/1000))/3 --- formula de dano maximo } local pos = getCreaturePosition(cid) doCreatureSay(cid, "Chain Lightning", 20, false, 0, pos) hits = math.ceil(getPlayerMagLevel(cid)/10) - (math.random(0, (math.floor(getPlayerMagLevel(cid)/10))) - 1) target = getCreatureTarget(cid) doBlast(cid, target, config.delay, config.effectx, config.effectz, config.percent, formula.min, formula.max, 2, hits, getCreaturePosition(cid), nil) 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.