Rielx
FOOL
- Joined
- Aug 23, 2010
- Messages
- 67
- Reaction score
- 1
Haven't shared anything for a long time, so here's some cool spell i made yesterday, to buff up my pal vocation on the server;
Spell is basically much like stronger version of eternal spear, tho you cant use it without target, and main thing about it, its lawful and you cannot strike killing blows to the players or the monsters with it.
lawful_grace.lua
spells.xml
Instead of killing a rat, leaves it with 1 hp. Same goes for players...
Spell is basically much like stronger version of eternal spear, tho you cant use it without target, and main thing about it, its lawful and you cannot strike killing blows to the players or the monsters with it.
lawful_grace.lua
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
function onTargetCreature(cid, target)
local maglevel = getPlayerMagLevel(cid)
local level = getPlayerLevel(cid)
local dist = getPlayerSkillLevel(cid, 4)
local mini = (level/6 * (dist * 2 + maglevel*2)) * 0.1
local maxi = (level/6 * (dist * 2 + maglevel*2)) * 0.15
local damage = math.random(mini, maxi)
if isPlayer(target) then
if getCreatureHealth(target) < damage/2 then
doSendMagicEffect(creatureGetPosition(target), CONST_ME_HOLYAREA)
doTargetCombatHealth(cid, target, COMBAT_HOLYDAMAGE,-getCreatureHealth(target)*2+1,-getCreatureHealth(target)*2+1, CONST_ME_HOLYDAMAGE)
else
doTargetCombatHealth(cid, target, COMBAT_HOLYDAMAGE,-damage,-damage, CONST_ME_HOLYDAMAGE)
end
else
if getCreatureHealth(target) < damage then
doSendMagicEffect(creatureGetPosition(target), CONST_ME_HOLYAREA)
doTargetCombatHealth(cid, target, COMBAT_HOLYDAMAGE,-getCreatureHealth(target)+1,-getCreatureHealth(target)+1, CONST_ME_HOLYDAMAGE)
else
doTargetCombatHealth(cid, target, COMBAT_HOLYDAMAGE,-damage,-damage, CONST_ME_HOLYDAMAGE)
end
end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
spells.xml
Code:
<instant name="lawful grace" words="exori venia fas" lvl="60" mana="300" prem="1" range="3" needtarget="1" exhaustion="2000" blockwalls="1" needlearn="0" event="script" value="customspells/lawful_grace.lua">
<vocation id="3"/>
</instant>
Instead of killing a rat, leaves it with 1 hp. Same goes for players...