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

Block spell

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
457
Reaction score
17
Hello guys anyone can help me in script
spell when use it block 50% from all damage ??

im use tfs 0.4

Bump

Pumb

f5

F5
 
Last edited by a moderator:
Description:
These are the Mirror and Absolute shields which protect the player from any elemental-based attacks, no matter they are direct or area-based, this defense nullifies any elemental attack. Both shields have charges, and can be recharged when the user casts the spell.

The first shield, which is for druids, reflects elemental attacks to the attacker, working as a mirror shield. The attack of the reflected attack depends of caster´s ML. The higher the druid´s ML is, more charges the druid gets. You can choose between these three counterattacks:

-'damage' : counterattacks with the same value of damage to attacker, and same element.


-'condition' : counterattacks adding a condition depending of the element-based attack by the target. The condition consists of 5 rounds of 2 seconds with -10 of damage. Burned, dazzled, poisoned, frozen, energy or cursed.

-'both' : both counterattacks just mentioned(damage and condition)


The other shield for knights just nullifies the attack. The higher the knight´s magic level is, more charges the knight gets.

spell
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
function onCastSpell(cid, var)
registerCreatureEvent(cid, "lessdmg")
  addEvent(function()
       if isPlayer(cid) then
           unregisterCreatureEvent(cid, "lessdmg")
       end
   end, 1000 * 10)
   return doCombat(cid, combat, var)
end

XML:
<event type="statschange" name="lessdmg" event="script" value="lessdmg.lua"/>
Lua:
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
dmg = math.ceil(value/2)
doTargetCombatHealth(attacker, cid, combat, -dmg, -dmg, 255)
end
return true
end
 
Last edited by a moderator:
spell
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
function onCastSpell(cid, var)
registerCreatureEvent(cid, "lessdmg")
  addEvent(function()
       if isPlayer(cid) then
           unregisterCreatureEvent(cid, "lessdmg")
       end
   end, 1000 * 10)
   return doCombat(cid, combat, var)
end

XML:
<event type="statschange" name="lessdmg" event="script" value="lessdmg.lua"/>
Lua:
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
dmg = math.ceil(value/2)
doTargetCombatHealth(attacker, cid, combat, -dmg, -dmg, 255)
end
return true
end
not work :S don't block amount of damage
 
spell
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
function onCastSpell(cid, var)
registerCreatureEvent(cid, "lessdmg")
  addEvent(function()
       if isPlayer(cid) then
           unregisterCreatureEvent(cid, "lessdmg")
       end
   end, 1000 * 10)
   return doCombat(cid, combat, var)
end

XML:
<event type="statschange" name="lessdmg" event="script" value="lessdmg.lua"/>
Lua:
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
dmg = math.ceil(value/2)
doTargetCombatHealth(attacker, cid, combat, -dmg, -dmg, 255)
end
return true
end
I'm not the best to speak on older rev's but maybe you would have to add return false in the statement containing doTargetCombatHealth in order to cancel the original stat change.
 
Lua:
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS)  then
local damage = math.ceil(value/2)
        doSendAnimatedText(getCreaturePosition(cid),damage, 108)
        doCreatureAddHealth(cid, -damage)
        return false
end
return true
end
 
Back
Top