• 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:
You mean a buff that enhances the protection against multiple elements? I don't think there is a function key that calls to improve element protection or damage avoiding. I think this needs source editing, but I'm not really sure about this.
 
You mean a buff that enhances the protection against multiple elements? I don't think there is a function key that calls to improve element protection or damage avoiding. I think this needs source editing, but I'm not really sure about this.

i need spell when use it block 50% from all damage

example
player hit me 1000 and when use spell same player hit me 500 for 10 seconds
 
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, "Protection")
   addEvent(function()
       if isPlayer(cid) then
           unregisterCreatureEvent(cid, "Protection")
       end
   end, 1000 * 10)
   return doCombat(cid, combat, var)
end
Creaturescripts, Protection.lua:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
   if(type == STATSCHANGE_HEALTHLOSS or STATSCHANGE_MANALOSS) then
       value = value / 2
       doTargetCombatHealth(attacker, cid, combat, -value, -value, 2)
       doSendAnimatedText(getCreaturePosition(cid), "-50% DMG", TEXTCOLOR_GREEN)
       return false
   end
   return true
end
Creaturescripts.xml:
XML:
<event type="statschange" name="Protection" event="script" value="Protection.lua"/>
 
Last edited:
Spell:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

function onCastSpell(cid, var)
   registerCreatureEvent(cid, "Protection")
   addEvent(function()
       if isPlayer(cid) then
           unregisterCreatureEvent(cid, "Protection")
       end
   end, 1000 * 10)
   return doCombat(cid, combat, var)
end
Creaturescripts, Protection.lua:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
   if(type == STATSCHANGE_HEALTHLOSS or STATSCHANGE_MANALOSS) then
       value = value / 2
       doTargetCombatHealth(attacker, cid, combat, -value, -value, 2)
       doSendAnimatedText(getCreaturePosition(cid), "-50% DMG", TEXTCOLOR_GREEN)
       return true
   end
   return true
end
Creaturescripts.xml:
XML:
<event type="statschange" name="Protection" event="script" value="Protection.lua"/>
not work always say
-50% DMG
 
  1. now fixed skull but don't block 50% from damage.
    i use sd on player for 140 and when use ur spells still hit player 140 by sd
    Try This
    Code:
    [LIST=1]
    [*]<?xml version="1.0" encoding="UTF-8"?>
    [*]<mod name="Shield" tfs="0.3.6pl1" author="Cybermaster" web="otland.net" enabled="yes">
    [*]<config name="shield_setup"><![CDATA[
    [*]   energy = createConditionObject(CONDITION_ENERGY)
    [*]   setConditionParam(energy, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(energy, 5, 2000, -10)
    [*]
    
    [*]   poison = createConditionObject(CONDITION_POISON)
    [*]   setConditionParam(poison, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(poison, 5, 2000, -10)
    [*]
    
    [*]   fire = createConditionObject(CONDITION_FIRE)
    [*]   setConditionParam(fire, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(fire, 5, 2000, -10)
    [*]
    
    [*]   freezing = createConditionObject(CONDITION_FREEZING)
    [*]   setConditionParam(freezing, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(freezing, 5, 2000, -10)
    [*]
    
    [*]   dazzled = createConditionObject(CONDITION_DAZZLED)
    [*]   setConditionParam(dazzled, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(dazzled, 5, 2000, -10)
    [*]
    
    [*]   cursed = createConditionObject(CONDITION_CURSED)
    [*]   setConditionParam(cursed, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(cursed, 5, 2000, -10)
    [*]
    
    [*]   mirrorCounterAttack = 'condition'
    [*]   e,d,k = { --combat type and distance shoot effect, and condition
    [*]           [COMBAT_ENERGYDAMAGE]   =   {35,energy  },
    [*]           [COMBAT_EARTHDAMAGE]    =   {29,poison  },
    [*]           [COMBAT_POISONDAMAGE]   =   {14,poison  },
    [*]           [COMBAT_FIREDAMAGE]     =   {3, fire    },
    [*]           [COMBAT_ICEDAMAGE]      =   {28,freezing},
    [*]           [COMBAT_HOLYDAMAGE]     =   {30,dazzled },
    [*]           [COMBAT_DEATHDAMAGE]    =   {31,cursed  }
    [*]           },
    [*]       1361, --storage to store druid's shield charges
    [*]       1362  --storage to store knight's shield charges
    [*]   --array of the shields charges (Magic Level, Charges)
    [*]   kina_array =    {
    [*]                       {2, 1}, {6, 2}, {10, 3}
    [*]                   }
    [*]   mage_array =    {
    [*]                       {20, 1}, {60, 2}, {100, 3}
    [*]                   }
    [*]   function doKnightShield(p, effect)
    [*]       local pos = {   --do not modify
    [*]           {x=p.x+1,y=p.y,z=p.z  },
    [*]           {x=p.x+1,y=p.y+1,z=p.z},
    [*]           {x=p.x,y=p.y+1,z=p.z  },
    [*]           {x=p.x-1,y=p.y+1,z=p.z},
    [*]           {x=p.x-1,y=p.y,z=p.z  },
    [*]           {x=p.x-1,y=p.y-1,z=p.z},
    [*]           {x=p.x,y=p.y-1,z=p.z  },
    [*]           {x=p.x+1,y=p.y-1,z=p.z}
    [*]       }
    [*]       for i = 1, #pos do
    [*]           doSendDistanceShoot(p, pos[i], effect)
    [*]       end
    [*]   end
    [*]   function getShieldCharges(cid, array)
    [*]       table.sort(array, function(a, b) return a[1] > b[1] end)
    [*]       for _, t in ipairs(array) do    
    [*]           if getPlayerMagLevel(cid) >= t[1] then
    [*]               return t[2]
    [*]           end
    [*]       end
    [*]       return array[1][2]
    [*]   end
    [*]]]></config>
    [*]       
    [*]<event type="login" name="shield_register" event="script"><![CDATA[
    [*]   function onLogin(cid)
    [*]       registerCreatureEvent(cid,'shield')
    [*]   return true
    [*]   end]]>
    [*]</event>
    [*]       
    [*]<event type="statschange" name="shield" event="script"><![CDATA[
    [*]   domodlib('shield_setup')
    [*]   function onStatsChange(cid, attacker, type, combat, value)
    [*]       if isDruid(cid) and isCreature(attacker) and e[combat] and getCreatureStorage(cid, d) > 0 then
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    [*]           doCreatureSetStorage(cid, d, getCreatureStorage(cid, d)-1)      
    [*]           doSendDistanceShoot(getThingPos(cid), getThingPos(attacker), e[combat][1])
    [*]           doPlayerSendCancel(cid, 'Your mirror shield has '.. (getCreatureStorage(cid,d) > 0 and getCreatureStorage(cid,d) or 'no') ..' charges left.')
    [*]           if mirrorCounterAttack == 'condition' then
    [*]               doTargetCombatCondition(cid, attacker, e[combat][2], CONST_ME_MAGIC_RED)
    [*]           elseif mirrorCounterAttack == 'damage' then
    [*]               doTargetCombatHealth(cid, attacker, combat, -value, -value, CONST_ME_MAGIC_RED)
    [*]           elseif mirrorCounterAttack == 'both' then
    [*]               doTargetCombatCondition(cid, attacker, e[combat][2], CONST_ME_MAGIC_RED)
    [*]               doTargetCombatHealth(cid, attacker, combat, -value, -value, CONST_ME_MAGIC_RED)
    [*]           end
    [*]           return false
    [*]       elseif isKnight(cid) and isCreature(attacker) and e[combat] and getCreatureStorage(cid, k) > 0 then
    [*]           doKnightShield(getThingPos(cid), e[combat][1])
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    [*]           doCreatureSetStorage(cid, k, getCreatureStorage(cid, k)-1)
    [*]           doPlayerSendCancel(cid, 'Your ultimate shield has '.. (getCreatureStorage(cid,k) > 0 and getCreatureStorage(cid,k) or 'no') ..' charges left.')
    [*]           return false
    [*]       end
    [*]       return true
    [*]   end]]>
    [*]</event>
    [*]         
    [*]<instant name="Ultimate Shield" words="utamo max" lvl="60" mana="100" soul="3" exhaustion="2000" event="script">
    [*]    <text><![CDATA[
    [*]       domodlib('shield_setup')
    [*]       function onCastSpell(cid, var)
    [*]           if getCreatureStorage(cid, k) > 0 then
    [*]               doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    [*]               doPlayerSendCancel(cid,'Your ultimate shield still has '.. getCreatureStorage(cid, k) ..' charges.')
    [*]               return false
    [*]           end
    [*]           doCreatureSetStorage(cid, k, getShieldCharges(cid, kina_array))
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
    [*]           doPlayerSendCancel(cid,'You have just enabled your ultimate shield with '.. getCreatureStorage(cid, k) ..' charges.')
    [*]           return true
    [*]       end]]>
    [*]    </text><vocation id="1;8"/>
    [*]</instant>
    [*]
    
    [*]<instant name="Mirror Shield" words="utamo gran" lvl="60" mana="300" soul="3" exhaustion="2000" event="script"><text>
    [*]    <![CDATA[
    [*]       domodlib('shield_setup')
    [*]       function onCastSpell(cid, var)
    [*]           if getCreatureStorage(cid, d) > 0 then
    [*]               doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    [*]               doPlayerSendCancel(cid,'Your mirror shield still has '.. getCreatureStorage(cid, d) ..' charges.')
    [*]               return false
    [*]           end
    [*]           doCreatureSetStorage(cid, d, getShieldCharges(cid, mage_array))
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
    [*]           doPlayerSendCancel(cid,'You have just enabled your mirror shield with '.. getCreatureStorage(cid, d) ..' charges.')
    [*]           return true
    [*]       end]]>
    [*]    </text><vocation id="1;8"/>
    [*]</instant>
    [*]</mod>
[/LIST]
 

  1. Try This
    Code:
    [LIST=1]
    [*]<?xml version="1.0" encoding="UTF-8"?>
    [*]<mod name="Shield" tfs="0.3.6pl1" author="Cybermaster" web="otland.net" enabled="yes">
    [*]<config name="shield_setup"><![CDATA[
    [*]   energy = createConditionObject(CONDITION_ENERGY)
    [*]   setConditionParam(energy, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(energy, 5, 2000, -10)
    [*]
    
    [*]   poison = createConditionObject(CONDITION_POISON)
    [*]   setConditionParam(poison, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(poison, 5, 2000, -10)
    [*]
    
    [*]   fire = createConditionObject(CONDITION_FIRE)
    [*]   setConditionParam(fire, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(fire, 5, 2000, -10)
    [*]
    
    [*]   freezing = createConditionObject(CONDITION_FREEZING)
    [*]   setConditionParam(freezing, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(freezing, 5, 2000, -10)
    [*]
    
    [*]   dazzled = createConditionObject(CONDITION_DAZZLED)
    [*]   setConditionParam(dazzled, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(dazzled, 5, 2000, -10)
    [*]
    
    [*]   cursed = createConditionObject(CONDITION_CURSED)
    [*]   setConditionParam(cursed, CONDITION_PARAM_DELAYED, 1)
    [*]   addDamageCondition(cursed, 5, 2000, -10)
    [*]
    
    [*]   mirrorCounterAttack = 'condition'
    [*]   e,d,k = { --combat type and distance shoot effect, and condition
    [*]           [COMBAT_ENERGYDAMAGE]   =   {35,energy  },
    [*]           [COMBAT_EARTHDAMAGE]    =   {29,poison  },
    [*]           [COMBAT_POISONDAMAGE]   =   {14,poison  },
    [*]           [COMBAT_FIREDAMAGE]     =   {3, fire    },
    [*]           [COMBAT_ICEDAMAGE]      =   {28,freezing},
    [*]           [COMBAT_HOLYDAMAGE]     =   {30,dazzled },
    [*]           [COMBAT_DEATHDAMAGE]    =   {31,cursed  }
    [*]           },
    [*]       1361, --storage to store druid's shield charges
    [*]       1362  --storage to store knight's shield charges
    [*]   --array of the shields charges (Magic Level, Charges)
    [*]   kina_array =    {
    [*]                       {2, 1}, {6, 2}, {10, 3}
    [*]                   }
    [*]   mage_array =    {
    [*]                       {20, 1}, {60, 2}, {100, 3}
    [*]                   }
    [*]   function doKnightShield(p, effect)
    [*]       local pos = {   --do not modify
    [*]           {x=p.x+1,y=p.y,z=p.z  },
    [*]           {x=p.x+1,y=p.y+1,z=p.z},
    [*]           {x=p.x,y=p.y+1,z=p.z  },
    [*]           {x=p.x-1,y=p.y+1,z=p.z},
    [*]           {x=p.x-1,y=p.y,z=p.z  },
    [*]           {x=p.x-1,y=p.y-1,z=p.z},
    [*]           {x=p.x,y=p.y-1,z=p.z  },
    [*]           {x=p.x+1,y=p.y-1,z=p.z}
    [*]       }
    [*]       for i = 1, #pos do
    [*]           doSendDistanceShoot(p, pos[i], effect)
    [*]       end
    [*]   end
    [*]   function getShieldCharges(cid, array)
    [*]       table.sort(array, function(a, b) return a[1] > b[1] end)
    [*]       for _, t in ipairs(array) do    
    [*]           if getPlayerMagLevel(cid) >= t[1] then
    [*]               return t[2]
    [*]           end
    [*]       end
    [*]       return array[1][2]
    [*]   end
    [*]]]></config>
    [*]       
    [*]<event type="login" name="shield_register" event="script"><![CDATA[
    [*]   function onLogin(cid)
    [*]       registerCreatureEvent(cid,'shield')
    [*]   return true
    [*]   end]]>
    [*]</event>
    [*]       
    [*]<event type="statschange" name="shield" event="script"><![CDATA[
    [*]   domodlib('shield_setup')
    [*]   function onStatsChange(cid, attacker, type, combat, value)
    [*]       if isDruid(cid) and isCreature(attacker) and e[combat] and getCreatureStorage(cid, d) > 0 then
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    [*]           doCreatureSetStorage(cid, d, getCreatureStorage(cid, d)-1)      
    [*]           doSendDistanceShoot(getThingPos(cid), getThingPos(attacker), e[combat][1])
    [*]           doPlayerSendCancel(cid, 'Your mirror shield has '.. (getCreatureStorage(cid,d) > 0 and getCreatureStorage(cid,d) or 'no') ..' charges left.')
    [*]           if mirrorCounterAttack == 'condition' then
    [*]               doTargetCombatCondition(cid, attacker, e[combat][2], CONST_ME_MAGIC_RED)
    [*]           elseif mirrorCounterAttack == 'damage' then
    [*]               doTargetCombatHealth(cid, attacker, combat, -value, -value, CONST_ME_MAGIC_RED)
    [*]           elseif mirrorCounterAttack == 'both' then
    [*]               doTargetCombatCondition(cid, attacker, e[combat][2], CONST_ME_MAGIC_RED)
    [*]               doTargetCombatHealth(cid, attacker, combat, -value, -value, CONST_ME_MAGIC_RED)
    [*]           end
    [*]           return false
    [*]       elseif isKnight(cid) and isCreature(attacker) and e[combat] and getCreatureStorage(cid, k) > 0 then
    [*]           doKnightShield(getThingPos(cid), e[combat][1])
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    [*]           doCreatureSetStorage(cid, k, getCreatureStorage(cid, k)-1)
    [*]           doPlayerSendCancel(cid, 'Your ultimate shield has '.. (getCreatureStorage(cid,k) > 0 and getCreatureStorage(cid,k) or 'no') ..' charges left.')
    [*]           return false
    [*]       end
    [*]       return true
    [*]   end]]>
    [*]</event>
    [*]         
    [*]<instant name="Ultimate Shield" words="utamo max" lvl="60" mana="100" soul="3" exhaustion="2000" event="script">
    [*]    <text><![CDATA[
    [*]       domodlib('shield_setup')
    [*]       function onCastSpell(cid, var)
    [*]           if getCreatureStorage(cid, k) > 0 then
    [*]               doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    [*]               doPlayerSendCancel(cid,'Your ultimate shield still has '.. getCreatureStorage(cid, k) ..' charges.')
    [*]               return false
    [*]           end
    [*]           doCreatureSetStorage(cid, k, getShieldCharges(cid, kina_array))
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
    [*]           doPlayerSendCancel(cid,'You have just enabled your ultimate shield with '.. getCreatureStorage(cid, k) ..' charges.')
    [*]           return true
    [*]       end]]>
    [*]    </text><vocation id="1;8"/>
    [*]</instant>
    [*]
    
    [*]<instant name="Mirror Shield" words="utamo gran" lvl="60" mana="300" soul="3" exhaustion="2000" event="script"><text>
    [*]    <![CDATA[
    [*]       domodlib('shield_setup')
    [*]       function onCastSpell(cid, var)
    [*]           if getCreatureStorage(cid, d) > 0 then
    [*]               doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    [*]               doPlayerSendCancel(cid,'Your mirror shield still has '.. getCreatureStorage(cid, d) ..' charges.')
    [*]               return false
    [*]           end
    [*]           doCreatureSetStorage(cid, d, getShieldCharges(cid, mage_array))
    [*]           doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
    [*]           doPlayerSendCancel(cid,'You have just enabled your mirror shield with '.. getCreatureStorage(cid, d) ..' charges.')
    [*]           return true
    [*]       end]]>
    [*]    </text><vocation id="1;8"/>
    [*]</instant>
    [*]</mod>
[/LIST]
why [*] ??? anyway give me error i don't know if this error from [*] or no
 
Back
Top