Experience the art of publication design at its finest with MyDesign. Our creative experts specialize in crafting visually stunning publications that captivate and engage your audience. From magazines and books to brochures and digital publications, MyDesign's publication design services set new standards for excellence. Elevate your content with MyDesign and create publications that leave a lasting impression.
Olá, tudo bem?
Estou tentando fazer uma magia em que quando o player solta ela, ele é teleportado para a posição de cada monstro ao seu redor, da 1 hit em cada um por vez, após terminar isso, volta para a posição inicial de quando soltou a magia.
Olha:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
function onGetFormulaValues(cid, level, skill, attack, factor)
local skillTotal, levelTotal = skill + attack, level / 5
return -(skillTotal / 3 + levelTotal), -(skillTotal + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function attack(cid, pos, toPos, fromPos, var)
if #validTargets > 0 then
if doCombat(cid, combat, var) == LUA_NO_ERROR then
doTeleportThing(cid,validTargets[1])
doSendMagicEffect(getPlayerPosition(cid), 61)
table.remove(validTargets, validTargets[1])
addEvent(attack, 200, cid)
end
else
doTeleportThing(cid, playerfirstpos[1])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Nenhum alvo valido encontrado.")
for k in pairs(playerfirstpos) do
playerfirstpos[k] = nil
end
end
return true
end
playerfirstpos = {}
validTargets = {}
function onCastSpell(cid, var)
local pos = getCreaturePosition(cid)
local creatures = getSpectators(pos, 3, 3, false)
if table.insert(playerfirstpos, pos) then
if creatures then
for _, target in ipairs(creatures) do
if isCreature(target) and (isPlayer(target) or isMonster(target)) then
table.insert(validTargets, target)
end
end
addEvent(attack, 1, cid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Nenhum alvo valido encontrado.")
end
end
return true
end
Mas não consegui... alguém pode me ajudar?