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

Lua TFS 1.2 Spells , Storage , Vocation

MadaraTajima

God Of Konoha " Hidden Leaf "
Joined
Aug 7, 2016
Messages
6
Reaction score
1
Location
Konoha " Hidden Leaf "
Hello OTLand ..
I've this question about if i can add storage value to spell

I want to create a server with rebirths and change vocations
Ex: i'm knight and i will rebirth to druid , so instead of making many vocations can i use storage on spells
so Ex: if you get rebirth from knight to druid " storage 1234 will be 1 "
but can i make spell knight can use and this storage can use

Ex: spell annihilation for knight i want druid can use it if he has storage 1234 = 1
so if i did this in annihilation.lua
Code:
function onCastSpell(creature, variant)
    if player:getStorageValue(1234) == 1 or not isInArray({4, 8}, player:getVocation():getId()) then
    return combat:execute(creature, variant)
        else player:sendTextMessage(MESSAGE_INFO_DESCR, "You maybe not Knight or has been Rebirthed yet.")
    end
end
not tested yet , but i ask lua expert if this will work xD
 
Hello OTLand ..
I've this question about if i can add storage value to spell

I want to create a server with rebirths and change vocations
Ex: i'm knight and i will rebirth to druid , so instead of making many vocations can i use storage on spells
so Ex: if you get rebirth from knight to druid " storage 1234 will be 1 "
but can i make spell knight can use and this storage can use

Ex: spell annihilation for knight i want druid can use it if he has storage 1234 = 1
so if i did this in annihilation.lua
Code:
function onCastSpell(creature, variant)
    if player:getStorageValue(1234) == 1 or not isInArray({4, 8}, player:getVocation():getId()) then
    return combat:execute(creature, variant)
        else player:sendTextMessage(MESSAGE_INFO_DESCR, "You maybe not Knight or has been Rebirthed yet.")
    end
end
not tested yet , but i ask lua expert if this will work xD
Im not 100% experienced with tfs 1.2, but try this.

Code:
function onCastSpell(creature, variant)
    local voc = player:getVocation():getId()

    if player:getStorageValue(1234) >= 1 or (isInArray({4,8}, voc)) then
        return combat:execute(creature, variant)
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you cannot use this spell.")
    end
 
Im not 100% experienced with tfs 1.2, but try this.

Code:
function onCastSpell(creature, variant)
    local voc = player:getVocation():getId()

    if player:getStorageValue(1234) >= 1 or (isInArray({4,8}, voc)) then
        return combat:execute(creature, variant)
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you cannot use this spell.")
    end
well i will try , but i think your script same as mine :D
i will try it :) thx
 
It is, but better tabbed and idk why you would use "or not" but it might be different in tfs 1.2
woops i just noticed from your words my script is wrong -_-
my script should make spell able to be used by storage and knights :D and my script make knight not able to use spell
 
what vocations can use which spells are defined in spells.xml, trying to change the spell scripts without changing xml is pointless
either you set all spells to every vocation in spells.xml, and set needlearn=1, then onLogin if x storage == -1 then learn all for the vocation, and when rebirthing learn all spells for the new vocation
or you set needlearn=0, and have the vocation/storage checks in the spell (like you're trying to do now, but every voc has to be on every spell in spells.xml then aswell)

if you go with needlearn=0 way, i would set the storage to 1/2/3/4 (depending on which voc you rebirth into), then in spells check if either storage or players normal vocation == X (required for that spell, EK for berserk for example)

also saving player vocation id in its own separate variable when its only used once is pointless
 
Back
Top