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

Solved Items for advance on each vocation.

shayenek

New Member
Joined
Jun 20, 2013
Messages
40
Reaction score
1
Location
Poland
Hello guys. I need some help creating script that gives item, different for every vocation, for advance in level. Example: on lvl 20 knight will get spike sword, on lvl 30 fire sword, druid/sorc will get rod/wand for lvl 19 at lvl 19 and then on level 33 will get rod/wand for 33lvl. Paladin some spears or bow + arrows. I tried to use this script http://otland.net/threads/reward-for-each-single-vocation-onadvance.153115/ but it doesnt work for me. So I want to ask if you guys could make something like that for me.

Edit. Forgot to mention. I use TFS 1.0.
 
Thanks you @Limos for this script :)

proposal to update only one Storage

Code:
local storage = 25000
local c = {
   [{1,5}] = {
     [15] = {items = {{itemid = 2160, count = 1}}, storage = 1},
     [30] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 3}}, storage = 2},
     [45] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 5}}, storage = 3}
   },
   [{2,6}] = {
     [15] = {items = {{itemid = 2160, count = 1}}, storage = 1},
     [30] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 3}}, storage = 2},
     [45] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 5}}, storage = 3}
   },
   [{3,7}] = {
     [15] = {items = {{itemid = 2160, count = 1}}, storage = 1},
     [20] = {items = {{itemid = 2456, count = 1}, {itemid = 2544, count = 100}}, storage = 2},
     [45] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 5}}, storage = 3}
   },
   [{4,8}] = {
     [15] = {items = {{itemid = 2160, count = 1}}, storage = 1},
     [30] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 3}}, storage = 2},
     [45] = {items = {{itemid = 2160, count = 1}, {itemid = 2160, count = 5}}, storage = 3}
   }
}

function onAdvance(cid, skill, oldlevel, newlevel)
     if skill ~= SKILL_LEVEL then
         return true
     end

     for voc, x in pairs(c) do
         if isInArray(voc, getPlayerVocation(cid)) then
             for level, z in pairs(x) do
                 if newlevel >= level and getPlayerStorageValue(cid, storage) <= z.storage then
                     local text = ""
                     for v = 1, #z.items do
                         count, info = z.items[v].count, getItemDescriptions(z.items[v].itemid)
                         local ret = ", "
                         if v == 1 then
                             ret = ""
                         elseif v == #z.items then
                             ret = " and "
                         end
                         text = text .. ret
                         text = text .. (count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name)
                         doPlayerAddItem(cid, z.items[v].itemid, z.items[v].count)
                     end
                     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you reached level "..level.." and received "..text..".")
                     doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
                     setPlayerStorageValue(cid, storage, z.storage)
                 end
             end
         end
     end
     return true
end

Yours is not working well on tfs 1.2, when the player reach xx lvl it's spaming items in his backpack or on the floor and like many items
 
Back
Top