Fala galera, tudo bem?
Venho trazer pra vocês uma nova magia que fiz. Ela é basicamente um puxão que da um pouco de dano.
Gif
Em spells.xml coloque essa tag:
<instant name="Energy Grab" words="exori grab vis" needtarget="1" lvl="40" mana="20" prem="1" range="5" blockwalls="1" exhaustion="2000" groups="1,2000" icon="122" needlearn="0" event="script" value="attack/energy grab.lua"> <vocation id="3"/> <vocation id="7"/> </instant>
Em scripts/attack crie um arquivo chamado energy grab.lua e coloque o conteúdo abaixo:
local grab_time = 350 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1) function onTargetCreature(cid, target) addEvent(executeGrab, grab_time, cid, target) end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") function executeGrab(cid, target, param) d = param or -1 if not isPlayer(cid) then return false end if not isCreature(target) then return false end local cpos, ppos = getCreaturePosition(target), getCreaturePosition(cid) local dir = getDirectionTo2(cpos, ppos) if d == -1 then doSendDistanceShoot(cpos, ppos, CONST_ANI_ENERGYBALL) end if getDistanceBetween(cpos, ppos) > 1 then doMoveCreature(target, dir) end if (d > 1 or d == -1) then addEvent(executeGrab, 30, cid, target, getDistanceBetween(cpos, ppos)) end return true end function performCombat(cid, combat, var) return doCombat(cid, combat, var) end function onCastSpell(cid, var) return doCombat(cid, combat, setSpellTarget(cid, var)) end