• 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!

It would be awesome if you could choose max % a fatal hit could damage you.

For an example 50%.

Player [1200 HP]
SD - 250
Player [700 HP]
UE - 750
Player [100 HP] {50% of 1200HP [max hp]}


Right now I assume it is more like:

Player [180 HP]
UE - 400

Player [1 HP]

Just had an idea D: Some sort of "mana shield" spell, that takes 50% of health loss and turn it into mana loss.

Etc:

Player [100 HP][75 Mana]
SD - 100

Player [50 HP][25 Mana]
(the 100 damage is split 50/50 between health/mana).

Would be great for paladin blockers who use spirit potions. D:
 
i havent played warcraft ever =/
 
Very nice spell. Will probably add it to my server, with creds and alredy rep++ ed;)
 
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

đź‘Ť Hope it works for you
Post automatically merged:

Thats an awesome spell, could it work for X number of hits?
Or for X number of hit/ X number of seconds?
 
Didnt work TFS 0.4.
Code:
[21:6:16.536] [Error - LuaInterface::loadFile] cannot open data/spells/scripts/safeguard.lua: No such file or directory
[21:6:16.545] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/safeguard.lua)
[21:6:16.552] cannot open data/spells/scripts/safeguard.lua: No such file or directory
[21:6:16.851] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/login.lua:58: 'end' expected (to close 'function' at line 7) near 'registerCreatureEvent'
[21:6:16.897] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/login.lua)
[21:6:16.924] data/creaturescripts/scripts/login.lua:58: 'end' expected (to close 'function' at line 7) near 'registerCreatureEvent'
[21:6:16.972] [Error - LuaInterface::loadFile] cannot open data/creaturescripts/scripts/safeguard.lua: No such file or directory
[21:6:17.005] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/safeguard.lua)
[21:6:17.032] cannot open data/creaturescripts/scripts/safeguard.lua: No such file or directory
 
Didnt work TFS 0.4.
Code:
[21:6:16.536] [Error - LuaInterface::loadFile] cannot open data/spells/scripts/safeguard.lua: No such file or directory
[21:6:16.545] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/safeguard.lua)
[21:6:16.552] cannot open data/spells/scripts/safeguard.lua: No such file or directory
[21:6:16.851] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/login.lua:58: 'end' expected (to close 'function' at line 7) near 'registerCreatureEvent'
[21:6:16.897] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/login.lua)
[21:6:16.924] data/creaturescripts/scripts/login.lua:58: 'end' expected (to close 'function' at line 7) near 'registerCreatureEvent'
[21:6:16.972] [Error - LuaInterface::loadFile] cannot open data/creaturescripts/scripts/safeguard.lua: No such file or directory
[21:6:17.005] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/safeguard.lua)
[21:6:17.032] cannot open data/creaturescripts/scripts/safeguard.lua: No such file or directory

1 - Make sure the file is in the "data/spells/scripts/safeguard.lua" path
2 - Post your login.lua
 
Back
Top