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

Spell Scroll Issues

Demon Overlord

Yep. Thats me.
Joined
May 6, 2009
Messages
177
Reaction score
22
Location
Yeh
I've been trying to make a spell scroll that gives you a spell, depending on the item that's used. So far I'm using Tfs 1.x

Lua:
local spells = {
    [6087] = "Exori Hur",
    [6088] = "Exura Sio",
    [6089] = "Exori Con",
       [6090] = "Exori Flam",
}
function onUse(cid, item, frompos, itemEx, topos)
    if(spells[item.itemid]) then
        if(not(getPlayerLearnedInstantSpell(cid, spells[item.itemid]))) then
            doPlayerLearnInstantSpell(cid, spells[item.itemid])
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
            doPlayerSendTextMessage(cid, 20, "You have successfully learned " .. spells[item.itemid])
            doRemoveItem(cid, item.uid, 1)
        else
            doPlayerSendCancel(cid, "You already know this spell.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end
    return true
end

as the actions/scripts/Spell Scroll.lua and

XML:
    <action itemid="6087" script="other/Spell Scrolls.lua" />

for the actions .xml

The error I'm getting in my console is
Screenshot_42.png

Is there a different function for players to learn spells in 1.x?
 
Last edited:
Your script is made for tfs 0.4 if im not wrong "doPlayerSend" = 0.4 / player:send = 1.0 ( or something like that, forgot XD )
 
I figured it out!

It's
Lua:
        player:learnSpell(spellName)

Spell name also refers to the NAME of the spell, not the literal words to cast it. Only way I figured it out!
 
Back
Top