• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Spell Safeguard Protection against Fatal HITS!

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
Author: Cybermaster
Storage: 9008

Description
This spell protects the player from fatal hits. When a player is attacked and the attack is equal or higher than player's health, the safeguard reduces the value of attack to -1 to avoid player from dying instantly.

Setup
creaturescripts/creaturescripts.xml
Lua:
<event type="statschange" name="safeguard" event="script" value="safeguard.lua"/>

register @ Login.lua:
Lua:
registerCreatureEvent(cid,'safeguard')

creaturescripts/scripts/safeguard.lua
Lua:
local storage = 9008

function onStatsChange(cid, attacker, type, combat, value)    
    if isPlayer(cid) and getCreatureStorage(cid,storage) > 0 and type == STATSCHANGE_HEALTHLOSS then
        if value >= getCreatureHealth(cid) and getCreatureHealth(cid) > 1 then
            value = getCreatureHealth(cid)-1
            doCreatureSetStorage(cid, storage, 0)
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
            doPlayerSendCancel(cid,'You are no longer protected against fatal hits!')
            doTargetCombatHealth(attacker, cid, combat, -value, -value, CONST_ME_MAGIC_GREEN)
            return false
        end
    end
    return true
end


spells/spells.xml
Lua:
<instant name="Safeguard" words="utamo mort" lvl="60" mana="100" prem="1" exhaustion="3000" needlearn="0" enabled="1" event="script" value="safeguard.lua">
    <vocation id="2"/>
    <vocation id="4"/>
    <vocation id="6"/>
    <vocation id="8"/>
</instant>

spells/scripts/safeguard.lua

Lua:
local storage =  9008
 
function onCastSpell(cid, var)
    if getCreatureStorage(cid, storage) == 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid,'You are already protected against fatal hits.')
        return false
    end
    
    doCreatureSetStorage(cid, storage, 1)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
    doPlayerSendCancel(cid,'You are protected against fatal hits.')
return true
end

:thumbup: Hope it works for you
 
Last edited:
uoowh!!
realy nice script man!! Oo'

This spell is cool to hard pvp or bosses x]

thanks
 
Nice one, but does it only protect against 1 attack or forever?
 
Cybershot@autohealing bot. :D
 
o'glad to hear
 
Author: Cybermaster
Storage: 9008

Description
This spell protects the player from fatal hits. When a player is attacked and the attack is equal or higher than player's health, the safeguard reduces the value of attack to -1 to avoid player from dying instantly.

Setup
creaturescripts/creaturescripts.xml
Lua:
<event type="statschange" name="safeguard" event="script" value="safeguard.lua"/>

register @ Login.lua:
Lua:
registerCreatureEvent(cid,'safeguard')

creaturescripts/scripts/safeguard.lua
Lua:
local storage = 9008

function onStatsChange(cid, attacker, type, combat, value)    
    if isPlayer(cid) and getCreatureStorage(cid,storage) > 0 and type == STATSCHANGE_HEALTHLOSS then
        if value >= getCreatureHealth(cid) and getCreatureHealth(cid) > 1 then
            value = getCreatureHealth(cid)-1
            doCreatureSetStorage(cid, storage, 0)
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
            doTargetCombatHealth(attacker, cid, combat, -value, -value, CONST_ME_MAGIC_GREEN)
            return false
        end
    end
    return true
end


spells/spells.xml
Lua:
<instant name="Safeguard" words="utamo mort" lvl="60" mana="100" prem="1" exhaustion="1000" needlearn="0" enabled="1" event="script" value="safeguard.lua">
    <vocation id="2"/>
    <vocation id="4"/>
    <vocation id="6"/>
    <vocation id="8"/>
</instant>

spells/scripts/safeguard.lua

Lua:
local storage = 9008

function onCastSpell(cid, var)
    if getCreatureStorage(cid,storage) < 1 then
        doCreatureSetStorage(cid, storage, 1)
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
        doPlayerSendCancel(cid,'You are protected against fatal hits.')
        return true
    elseif getCreatureStorage(cid, storage) == 1 then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid,'You are already protected against fatal hits.')
        return false
    end
return true
end

:thumbup: Hope it works for you



And if a player using bots to give Utamo mort c'mon to take a fatal hit he will be immortal? which is to protect against this? :peace:
 
ehm inmortal? just increase the exhaustion?
player is not inmortal, once he uses the spell again, hell get a exhaustion long enough to be killed if thats what ure asking
 
Last edited:
bump for an epic spell
 
i love this spell. im definitely going to be adding this to my server
 
*added warning message when player is fatally wounded and loses protection
 
No bad... no bad... You're full of interesing ideas :)
 
Back
Top