steviemongolin
New Member
- Joined
- Feb 28, 2016
- Messages
- 21
- Reaction score
- 0
Hello everybody, can someone help me fix this spell. The spell reflects the damage taken to the attacker but if the attacker has a manashield it will remove his health instead of mana. I have no idea how to fix , if someone could help me I would really appreciate it. Thank you
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Reflection" version="1.0" author="Snake Royal" contact="otland.net" enabled="yes">
<instant name="Reflection" words="exori ion" lvl="50" mana="140" prem="1" aggressive="0" selftarget="1" exhaustion="7000" needlearn="0" event="script">
<vocation id="4"/>
<vocation id="8"/>
<![CDATA[
function onCastSpell(cid, var)
registerCreatureEvent(cid, "Reflection/statschange001")
doCreatureSetStorage(cid, 2000, os.time() + 5)
doSendMagicEffect(getThingPosition(cid), CONST_ME_HOLYDAMAGE)
return true
end
]]>
</instant>
<event type="statschange" name="Reflection/statschange001" event="script"><![CDATA[
function onStatsChange(cid, attacker, type, combat, value)
if (getCreatureStorage(cid, 2000) > os.time() and type == STATSCHANGE_HEALTHLOSS) then
local absorb = math.ceil(value * 0.5)
doSendMagicEffect(getThingPosition(attacker), CONST_ME_HOLYDAMAGE)
doSendAnimatedText(getThingPosition(attacker), absorb, COLOR_RED)
doCreatureAddHealth(attacker, -absorb)
doCreatureAddHealth(cid, absorb)
end
return true
end
]]></event>
</mod>