• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Vocations on Firstitems mod - TFS 0.4

hanzoha

New Member
Joined
May 8, 2016
Messages
87
Reaction score
2
Hello guys.

I have a problem with this xml. When the user creates a normal account and character the xml works well.

There's an option where the player can get all the players promoted as son as there are created. For example, instead of a normal "Sorcerer, Druid, Paladin, Knight" from the start the character is "Master sorcerer, Elder Druid, Royal Paladin, Knight..."

The problem is when they get the first items. Because the weapons (I think) are only given to first promotions and I want all the promotions to get them as soon as they login.

Here's the mod firstitems.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" enabled="yes">
   <config name="firstitems_config"><![CDATA[
      config = {
         storage = 30001,
         items = {2050, 2382}
      }
   ]]></config>
   <event type="login" name="FirstItems" event="script"> <![CDATA[
      domodlib('firstitems_config')
      function onLogin(cid)
   local config = {
      voc_items = {
         { -- 
            {2190} -- Wand of vortex
         },
         { -- 
            {2182} -- Snakebit Rod
         },
         { -- 
            {2389, 5} -- Spears
         },
         { -- 
            {2383} -- Spike Sword
         }
      },
      all_items = {
         {2511}, -- 
         {2460}, -- 
         {2478}, -- 
         {2465}, -- 
         {2643} -- 
      },
      extra_items = {
         {2152, 5}, -- 
         {2789, 30}, -- 
         {7620, 5}, -- 
         {7618, 5}, --
         {2120}, --
         {2554} -- 
      },
      knight_weapons = {
         {2428}, -- 
         {2417} -- 
      },
      paladin_weapons = {
         {2456}, -- 
         {1294, 5} -- 
      }

   }
   if getPlayerGroupId(cid) < 3 then
      if getPlayerStorageValue(cid, storage) == -1 then
         local common = config.voc_items[getPlayerVocation(cid)]
         if common ~= nil then
            for _, v in ipairs(common) do
               doPlayerAddItem(cid, v[1], v[2] or 1)
            end
         end
         local all = config.all_items
         if all ~= nil then
            for _, v in ipairs(all) do
               doPlayerAddItem(cid, v[1], v[2] or 1)
            end
         end
         local extra = config.extra_items
         local bp = doPlayerAddItem(cid, 1988, 1)
         if extra ~= nil then
            for _, v in ipairs(extra) do
               doAddContainerItem(bp, v[1], v[2] or 1)
            end
         end
         local weapons = config.knight_weapons
         if weapons ~= nil then
            for _, w in ipairs(weapons) do
               if isKnight(cid) then
                  doAddContainerItem(bp, w[1], w[2] or 1)
               end
            end
         end

         local weapons2 = config.paladin_weapons
         if weapons2 ~= nil then
            for _, w in ipairs(weapons2) do
               if isPaladin(cid) then
                  doAddContainerItem(bp, w[1], w[2] or 1)
               end
            end
         end

         setPlayerStorageValue(cid, storage, 1)
      end
   end
   return true
end
   ]]></event>
</mod>


Thanks!
 
Just change this line
Code:
local common = config.voc_items[getPlayerVocation(cid)]
To
Code:
local vocation = getPlayerVocation(cid)
local common = config.voc_items[vocation > 4 and vocation - 4 or vocation]
 
Back
Top