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

100% protection spell

Edroniasty

New Member
Joined
Oct 2, 2015
Messages
84
Reaction score
1
Hello, looking for 100% protection spell from elements like physical,fire etc.. working for 10 seconds then stop, someone have spell like this foron tfs 1.2+?

bump
 
Last edited by a moderator:
Solution
You can try something like this(not tested).

Creaturescript(don't forget to also register it in login.lua)
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    if primaryType == COMBAT_HEALING or secondaryType == COMBAT_HEALING then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    if creature and creature:isPlayer() then
            if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 56) then
                creature:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY)
                primaryDamage = 0
                secondaryDamage = 0
            end
    end
return primaryDamage, primaryType, secondaryDamage...
I might be out biking, but can't you just set the player group to a custom-made group that ignores damage, and add an event that decrease the group value down to normal player after x seconds? I'm not home when it comes to TFS >: (
 
I might be out biking, but can't you just set the player group to a custom-made group that ignores damage, and add an event that decrease the group value down to normal player after x seconds? I'm not home when it comes to TFS >: (
That seems pretty janky.

Does TFS 1.2+ not have a creaturescript function "onStatsChange" or similar?
Then you can just give them a storage value for 10 seconds, and return false all damage during that time-period.
 
You can try something like this(not tested).

Creaturescript(don't forget to also register it in login.lua)
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    if primaryType == COMBAT_HEALING or secondaryType == COMBAT_HEALING then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    if creature and creature:isPlayer() then
            if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 56) then
                creature:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY)
                primaryDamage = 0
                secondaryDamage = 0
            end
    end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Spell
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local protect = Condition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT)
protect:setParameter(CONDITION_PARAM_SUBID, 56)
protect:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
protect:setParameter(CONDITION_PARAM_TICKS, 10 * 1000)
combat:setCondition(protect)

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
 
Last edited:
Solution
You can try something like this(not tested).

Creaturescript(don't forget to also register it in login.lua)
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if creature and creature:isPlayer() then
        if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, 56) then
            creature:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY)
            primaryDamage = 0
            secondaryDamage = 0
        return primaryDamage, primaryType, secondaryDamage, secondaryType
        end
    end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end

Spell
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local protect = Condition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT)
protect:setParameter(CONDITION_PARAM_SUBID, 56)
protect:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
protect:setParameter(CONDITION_PARAM_TICKS, 10 * 1000)
combat:setCondition(protect)

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end

no error in console, its look like spell works but when I use it I only see green puf 1 sqm from me and nothing happens.. I put register event:
Code:
    registerCreatureEvent(cid, "shield1")
or
Code:
player:registerEvent("shield1")
 
no error in console, its look like spell works but when I use it I only see green puf 1 sqm from me and nothing happens.. I put register event:
Code:
    registerCreatureEvent(cid, "shield1")
or
Code:
player:registerEvent("shield1")
I've edited script a bit, try now.

its look like spell works but when I use it I only see green puf 1 sqm from me and nothing happens..
Can you see an attribute condition on you?

player:registerEvent("shield1")
This one. Did you write event's name correctly?
 
That seems pretty janky.

Does TFS 1.2+ not have a creaturescript function "onStatsChange" or similar?
Then you can just give them a storage value for 10 seconds, and return false all damage during that time-period.
wow I feel stupid now >:s
 
So.. I don't realy know what I must put in login.lua, I put this
Code:
registerCreatureEvent(cid, "sks")
(name of script located in creaturescripts\scripts\sks.

I don't see any changes after code update but when I use it I can still see puf 1 sqm from me, when other player stand on it he will get condition (u are strenghtened) but this don't give me immortality for 10 s.

2z66kqd.jpg


then.. Buba gets strenghtened (not god)

2d17qmp.jpg


and I hope Buba is immortal but..

21cwbwp.jpg


:(
 
So.. I don't realy know what I must put in login.lua, I put this (name of script located in creaturescripts\scripts\sks.
The name under which you registered this script in creaturescripts.xml.
And use 'player:registerEvent("shield1")'.

About weird effect. I guess you have it registered wrong in spells.xml.
Post this line here.
 
Okay so my spells.xml
Code:
    <instant group="healing" spellid="159" name="sks" words="sks" lvl="1" mana="0" prem="1" aggressive="0" casterTargetOrDirection="1" blockwalls="1" exhaustion="600" groupcooldown="2000" needlearn="0" script="healing/sks.lua">
        <vocation name="Elder Druid"/>
        <vocation name="Druid"/>
        <vocation name="Knight"/>
    </instant>

and login.lua

Code:
    registerCreatureEvent(cid, "sks")
 
This one to login.lua
player:registerEvent("shield1")

This one to creaturescripts.xml
Code:
<event type="healthchange" name="shield1" script="shield1.lua"/> -- set proper directory


Names must be the same.
 
I'm using a downgraded version of tfs 1.5, I get the spell buff but I don't get any protection.. Any ideas?
Have you registered the script in data/creaturescripts/creaturescripts.xml and also at the bottom of data/creaturescripts/scripts/login.lua?
 
Have you registered the script in data/creaturescripts/creaturescripts.xml and also at the bottom of data/creaturescripts/scripts/login.lua?
Yes, this is what I have in data/creaturescripts/creaturescripts.xml:
Lua:
<event type="healthchange" name="absorb" script="absorb.lua"/>

and in data/creaturescripts/scripts/login.lua:
Code:
    player:registerEvent("PlayerDeath")
    player:registerEvent("DropLoot")
    player:registerEvent("absorb")

Maybe I am making some kind of rookie mistake?
 
Yes, this is what I have in data/creaturescripts/creaturescripts.xml:
Lua:
<event type="healthchange" name="absorb" script="absorb.lua"/>

and in data/creaturescripts/scripts/login.lua:
Code:
    player:registerEvent("PlayerDeath")
    player:registerEvent("DropLoot")
    player:registerEvent("absorb")

Maybe I am making some kind of rookie mistake?
Nope. Just outdated code.

Change your spell, line 9
Lua:
combat:setCondition(protect)
to this
Lua:
combat:addCondition(protect)
 
Nope. Just outdated code.

Change your spell, line 9
Lua:
combat:setCondition(protect)
to this
Lua:
combat:addCondition(protect)
I have just now noticed that the script doesn't reduce damage done on a target with mana shield activated. I am guessing because neither the primary or secondary damage counts against mana shield? Any ideas?
 
I have just now noticed that the script doesn't reduce damage done on a target with mana shield activated. I am guessing because neither the primary or secondary damage counts against mana shield? Any ideas?
You would need to create an onManaChange function as well
 
Back
Top