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

TFS 1.X+ [TFS1.2] Use item to learn spell

Requice

New Member
Joined
Jul 30, 2019
Messages
13
Reaction score
1
Depending on vocation, and remove item when successful. I've looked in several posts with scripts for this but they don't work with TFS1.2, any help would be massively appreciated, willing to paypal a small amount of money to someone willing to script this for me!
 
Lua:
 local t = {
        [29001] = {{"Ultimate Arcane Beam"},{1, 5}},
        [29002] = {{"Divine Bless"},{2, 6}},

        }

        function onUse(player, item, fromPosition, target, toPosition, isHotkey)
        local v = t[item.actionid]
        if v then
        if player:hasLearnedSpell(v[1]) then
        return player:sendCancelMessage("You already know this spell!"), toPosition:sendMagicEffect(CONST_ME_PURPLEENERGY), false


        end
        
        if isInArray(v[2], player:getVocation()) then
        return player:sendCancelMessage("Vocation Not found!"), toPosition:sendMagicEffect(CONST_ME_PURPLEENERGY), false


        end

        player:learnSpell(v[1])
        toPosition:sendMagicEffect(CONST_ME_PURPLEENERGY)
        player:say("You learned the spell " .. v[1] ..".", TALKTYPE_MONSTER_SAY)

        end
        return true
        end
 
Change item.actionid to item:getId() and player:getVocation() to player:getVocation():getId()
 
Change isInArray(...) to not isInArray(...) and it should be item:getId() not item.getid()
 
local v = t[item:getId()] 👀
am I being blind? isn't this what you said to put? 😂 thank you for your patience btw
Post automatically merged:

I have just now seen the colon, I am so blind
Post automatically merged:

1675298880367.png
1675298860796.png
we're getting somewhere at least! It displays the correct message if wrong vocation, and if the item has already been used, but it doesn't actually teach the spell
 
Last edited:
am I being blind? isn't this what you said to put? 😂 thank you for your patience btw
Post automatically merged:

I have just now seen the colon, I am so blind
Post automatically merged:

View attachment 73145
View attachment 73144
we're getting somewhere at least! It displays the correct message if wrong vocation, and if the item has already been used, but it doesn't actually teach the spell
change table for
Lua:
local t = {
    [26410] = {"Arcane Burst", {1, 5}} -- I assume sorc and master sorc is 1 & 5
}
 
you were right! I had done it like this, guess my brain is completely fried 😂 or I am just stupid. Works now, would it be easy to also remove the item on use? thank you kindly for all the help
EDIT: removing item was easy enough even for me! feel free to post your paypal and I will send a small amount of money as promised
1675306003345.png
 
Last edited:
you were right! I had done it like this, guess my brain is completely fried 😂 or I am just stupid. Works now, would it be easy to also remove the item on use? thank you kindly for all the help
EDIT: removing item was easy enough even for me! feel free to post your paypal and I will send a small amount of money as promised
View attachment 73146
This is the support board.
No monetary compensation should ever be required to exchange hands here.

Post as many questions as you want, free of charge.
 
Back
Top