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

need spell scroll with spell lists and action/unique id

hrex

New Member
Joined
Apr 12, 2009
Messages
27
Reaction score
2
Hello,
I remake a real map to my rpg server (9.81 CLIENT), and i need to this project script SPELL SCROLL but i want to be one item xxxx but with diffrent action/unique id and another spells according to action/unique id and in spell scroll learn few spells not one, for example:
Item id 8189 with action/unique id 14001. when player see this item look
You see a NAME ITEM.
(Spells first level for knights.)
when player use this item learn few spells:
-find person
-exura
-exana pox
-utani hur
I remember scripts from 7.6 for keys to make thhis descriptions with (numbers), and i think its possible to do that but i dont know, so my question is this script is possible ? and is there anyone who would have made a help for me ? ^^
 
I don't know what TFS version you are using, but i guess its 0.3.6
I have similar spellScroll System in my server, but i have TFS 1.0
So figure out how to make it work on your server, i know nothing about 0.3.6
Here is the script: it teaches 1 spell at the time.

What you could do to make it teach more spells is: add extra line to table:
spellname = {"exura", "exana pox", "utani hur"}

and instead of using the table key to teach spell, you loop trough all the spellnames.
change this: playerLearnInstantSpell(cid, k)
to this: playerLearnInstantSpell(cid, spell[k].spellname[x])

Code:
local spells = {
["Strike"] = {
actionID = 1100,
vocation = function(cid) return isKnight(cid) end,
vocation2 = "knight",
minL = 2
},

["Heat"] = {
actionID = 1101,
vocation = function(cid) return isDruid(cid) end,
vocation2 = "druid",
minL = 2
},

["Barrier"] = {
actionID = 1102,
vocation = function(cid) return isSorcerer(cid) end,
vocation2 = "Sorcerer",
minL = 2
}


}

function onUse(cid, item)
local itemID = item.actionid
local L = getPlayerLevel(cid)
local player = Player(cid)

    for k, v in pairs(spells) do
        if itemID == spells[k].actionID then
            if spells[k].vocation(player) then
                if L >= spells[k].minL then  
                    if  getPlayerLearnedInstantSpell(cid, k) == false then
                        playerLearnInstantSpell(cid, k)
                        player:sendTextMessage(MESSAGE_INFO_DESCR, "you learned " ..k.. " spell")
                        --possibly different text color than default green
                        doRemoveItem(item.uid, 1)
                        return true
                    else player:sendTextMessage(MESSAGE_INFO_DESCR, "You already know this spell")
                        return true
                    end
                else player:sendTextMessage(MESSAGE_INFO_DESCR, "Need level " ..spells[k].minL.. ", to learn this spell")
                    return true
                end  
            else player:sendTextMessage(MESSAGE_INFO_DESCR, "This is "..spells[k].vocation2.." spell")
                --possibly different text color than default green  
            end
        end
    end
end
 
its not worked :<
in console show problem line with local player = Player(cid)
i add to actions.xml
<action itemid="8189" script="myscripts/spellscrolls.lua"/>
its good ?
 
its not worked :<
in console show problem line with local player = Player(cid)
i add to actions.xml
<action itemid="8189" script="myscripts/spellscrolls.lua"/>
its good ?

is that line inside the function?
and does the function have: cid in it?
function onUse(cid, item) <mine has cid


and actions.xml is fine as long as your are useing items 8189 for spellscrolls

EDIT:
and like i said before its script for TFS 1.x
If you are using older version it might not work.
 
i have tfs 0.3.7, but i dont understand :< do you think can be able to do that ? can u replace for me place where i must write item id and spells in pairs to show me for exampel :< please.. :>
 
You can't dynamically create unique / action id's, since you have know what they are when you assign them to the actions.xml file.
A better solution would be to use storage values since you can create storage values on the fly, don't send me a pm asking for help it will be deleted
 
i dont understand your message, becaouse now problem is onuse function.. your idea is good to do that i think, iam not scripter i am only thinker heh and i dont pm to another users becaouse i use forum to help not pm to pity users.. bb

@UP

ok thanks
 
Back
Top