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

Permanent Magic Shield [TFS 1.2]

Heroid

Active Member
Joined
Mar 7, 2011
Messages
332
Solutions
11
Reaction score
34
Hey, I'm wondering how I can make a specific vocation get a Magic Shield automatically on login.
Thanks.
 
Solution
Take all of this and set it outside of onLogin
Lua:
local manashield = Condition(CONDITION_MANASHIELD)
manashield:setTicks(-1)
Then inside of onLogin you place something like this.
Lua:
if isInArray({1}, player:getVocation():getId()) then
    player:addCondition(manashield)
end
That {1} is a table, place all the vocation id's you want to have manashield when they login, for instance if i wanted a sorcerer and druid I would set the table to.
Lua:
if isInArray({1, 2}, player:getVocation():getId()) then
    player:addCondition(manashield)
end
Take all of this and set it outside of onLogin
Lua:
local manashield = Condition(CONDITION_MANASHIELD)
manashield:setTicks(-1)
Then inside of onLogin you place something like this.
Lua:
if isInArray({1}, player:getVocation():getId()) then
    player:addCondition(manashield)
end
That {1} is a table, place all the vocation id's you want to have manashield when they login, for instance if i wanted a sorcerer and druid I would set the table to.
Lua:
if isInArray({1, 2}, player:getVocation():getId()) then
    player:addCondition(manashield)
end
 
Solution
If you don't have isInArray for whatever reason
Lua:
function isInArray(a, f)
    for k, v in pairs(a) do
        if v == f then
            return true
        end
    end
    return false
end
 
Last edited by a moderator:
Take all of this and set it outside of onLogin
Lua:
local manashield = Condition(CONDITION_MANASHIELD)
manashield:setTicks(-1)
Then inside of onLogin you place something like this.
Lua:
if isInArray({1}, player:getVocation():getId()) then
    player:addCondition(manashield)
end
That {1} is a table, place all the vocation id's you want to have manashield when they login, for instance if i wanted a sorcerer and druid I would set the table to.
Lua:
if isInArray({1, 2}, player:getVocation():getId()) then
    player:addCondition(manashield)
end
Thank you, works perfect! :)
 
Back
Top