• 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 spell scroll tfs 1.1?

zerghel

Tsuni
Joined
Jul 1, 2008
Messages
299
Reaction score
9
Hello guys
im trying to use this script for spell learning
i think is kinda messy 'cause somehow it can be used by other vocations

Code:
local spell = "sharp light"
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not getPlayerLearnedInstantSpell(cid, spell) then
        Item(item.uid):remove(1)
        playerLearnInstantSpell(cid, spell)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned spell " .. spell .. "!")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    elseif getPlayerVocation(cid) ~= 5 then
        doCreatureSay(cid, "Only Master sorcerers can learn " .. spell .. " spell.", TALKTYPE_ORANGE_1)
    else
        doCreatureSay(cid, "You already know " .. spell .. " spell!", TALKTYPE_ORANGE_1)
    end
    return true
end
can u throw me some light?
 
The if statements' order matters, try this:

Code:
local spell = "sharp light"
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerVocation(cid) ~= 5 then
        doCreatureSay(cid, "Only Master sorcerers can learn " .. spell .. " spell.", TALKTYPE_ORANGE_1)
        return true
    end

    if not getPlayerLearnedInstantSpell(cid, spell) then
        Item(item.uid):remove(1)
        playerLearnInstantSpell(cid, spell)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned spell " .. spell .. "!")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
    else
        doCreatureSay(cid, "You already know " .. spell .. " spell!", TALKTYPE_ORANGE_1)
    end
   
    return true
end
 
Back
Top