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

First items

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
979
Solutions
1
Reaction score
291
Hey, im using this script
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="2.0" author="J.Dre" contact="[email protected]" enabled="yes">
<config name="firstitems_config"><![CDATA[
commonItems = {
{itemid=6103, count=1, useMessage=true}, -- a book (or whatever) with a message
{itemid=2789, count=10, inContainer = true}, -- 10 brown mushrooms
{itemid=2152, count=10, inContainer = true}, -- 10 platinum coins
{itemid=2200, count=100}, -- protection amulet
{itemid=7620, count=10, inContainer=true}, -- mana potion
{itemid=7618, count=10, inContainer=true}, -- hp potion
{itemid=2649},
{itemid=2461},
{itemid=2467},
{itemid=2643}
}
firstItems = {
{ -- Mage
{itemid=1988}, -- backpack
{itemid=2175}, -- spellbook
{itemid=2152, inContainer=true} -- wand
},
{ -- Druid
{itemid=1988}, -- backpack
{itemid=2175}, -- spellbook
{itemid=2152, inContainer=true} -- wand
},
{ -- Paladin
{itemid=1988}, -- backpack
{itemid=2456, count=1, useSlot=true, slotType=CONST_SLOT_LEFT}, -- bow
{itemid=2544, count=100, useSlot=true, slotType=CONST_SLOT_LAST}, -- 100 arrow's
{itemid=2509} -- steel shield
},
{ -- Knight
{itemid=1988}, -- backpack
{itemid=2509}, -- steel shield
{itemid=2395},
{itemid=2398, inContainer=true},
{itemid=2388, inContainer=true}
}
}
]]></config>
<event type="login" name="FirstItems" event="script"><![CDATA[
domodlib('firstitems_config')

for _, items in ipairs(firstItems) do
for _, item in ipairs(commonItems) do
table.insert(items, item)
end
end

local backpack
local storage = 30001
function onLogin(cid)
if((getPlayerAccess(cid) < 3 and getCreatureStorage(cid, storage) < 0) and firstItems[getPlayerVocation(cid)]) then
for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
if isItemContainer(v.itemid) then
backpack = doPlayerAddItem(cid, v.itemid, 1)
elseif v.inContainer then
doAddContainerItem(backpack, v.itemid, v.count or 1)
elseif v.useSlot then
doPlayerAddItem(cid, v.itemid, v.count, false, v.slotType)
elseif v.useMessage then
local t, k = {
writer = "Server Staff", date = os.time(),
text = "Welcome " .. getCreatureName(cid) .. ".\n\nOur community would like to welcome you to " .. getConfigValue('serverName') .. ". If you need help with anything, please refer to the help channel.\n\nEnjoy your time!"
}, doPlayerAddItem(cid, v.itemid, v.count or 1, false)
doSetItemText(k, t.text, t.writer, t.date)
else
doPlayerAddItem(cid, v.itemid, v.count or 1)
end
doCreatureSetStorage(cid, storage, 1)
end
end
return true
end
]]></event>
</mod>

The problem is that I don't have druid voc on my server and when I log as knight(voc3) I get paladin(voc2) items. I tried to delete druid code from script but it stops working when I do this.
Anyone could rewrite this to make it work for mage(voc1), paladin(voc2), knight(voc3)?
 
Code:
function onLogin(cid)
    local storage = 30055 -- storage value
   
    local sorcItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2190, -- Wand of vortex
            2511, -- Brass shield
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
    local druidItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2511, -- Brass shield
            2182, -- Snakebite rod
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
    local pallyItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2456, -- Bow
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
        }
    local kinaItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2511, -- Brass shield
            2412, -- Katana
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
   
    if getPlayerStorageValue(cid, storage) == -1 then
        setPlayerStorageValue(cid, storage, 1)
        if getPlayerVocation(cid) == 1 then
            -- Sorcerer
            for i = 1, table.getn(sorcItems), 1 do
                doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
            end
       
        elseif getPlayerVocation(cid) == 2 then
            -- Druid
            for i = 1, table.getn(druidItems), 1 do
                doPlayerAddItem(cid, druidItems[i], 1, FALSE)
            end
       
        elseif getPlayerVocation(cid) == 3 then
            -- Paladin
            for i = 1, table.getn(pallyItems), 1 do
                doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
            end
            -- 8 arrows
            doPlayerAddItem(cid, 2544, 8, FALSE)
       
        elseif getPlayerVocation(cid) == 4 then
            -- Knight
            for i = 1, table.getn(kinaItems), 1 do
                doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
            end
        end
       
        -- Common for all
        doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
        doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
    end
    return true
end

Use this script, post your vocations.xml to i can edit this for u.
 
@up. Your one is the creaturescipt one, my is mod one. The problem is that I have 3 main vocations on my server. Btw, I used same script before but everything goes wrong when I delete druid.
My voc:
Code:
    <vocation id="1" name="Mage" description="a Mage" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="7" gainhpamount="35" gainmanaticks="7" gainmanaamount="145" manamultiplier="1.1" attackspeed="700" soulmax="100" gainsoulticks="60" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="2" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="7" gainhpamount="135" gainmanaticks="7" gainmanaamount="145" manamultiplier="1.4" attackspeed="700" soulmax="100" gainsoulticks="60" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.3" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="3" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="5" gainhpamount="135" gainmanaticks="11" gainmanaamount="45" manamultiplier="3.0" attackspeed="700" soulmax="100" gainsoulticks="60" fromvoc="3">
        <formula meleeDamage="1.2" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
 
Last edited:
Try this:
Code:
function onLogin(cid)
    local storage = 30055 -- storage value
   
    local sorcItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2190, -- Wand of vortex
            2511, -- Brass shield
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
    local druidItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2511, -- Brass shield
            2182, -- Snakebite rod
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
    local pallyItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2456, -- Bow
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
        }
    local kinaItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2511, -- Brass shield
            2412, -- Katana
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
   
    if getPlayerStorageValue(cid, storage) == -1 then
        setPlayerStorageValue(cid, storage, 1)
        if getPlayerVocation(cid) == 1 then
            -- Sorcerer
            for i = 1, table.getn(sorcItems), 1 do
                doPlayerAddItem(cid, sorcItems[i], 1, FALSE)
            end
       
        elseif getPlayerVocation(cid) == 1 then
            -- Druid
            for i = 1, table.getn(druidItems), 1 do
                doPlayerAddItem(cid, druidItems[i], 1, FALSE)
            end
       
        elseif getPlayerVocation(cid) == 2 then
            -- Paladin
            for i = 1, table.getn(pallyItems), 1 do
                doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
            end
            -- 8 arrows
            doPlayerAddItem(cid, 2544, 8, FALSE)
       
        elseif getPlayerVocation(cid) == 3 then
            -- Knight
            for i = 1, table.getn(kinaItems), 1 do
                doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
            end
        end
       
        -- Common for all
        doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
        doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
    end
    return true
end
 
Thats a good idea, you changed druid into mage, put same voc I mean. Anyway it works, thanks for help. But if anyone could cut this script that it wouldn't contain druid it would be nice too.
 
Code:
function onLogin(cid)
    local storage = 30055 -- storage value
   
    local mageItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2190, -- Wand of vortex
            2511, -- Brass shield
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
    local pallyItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2456, -- Bow
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
        }
    local kinaItems = {
            2460, -- Brass helmet
            2465, -- Brass armor
            2511, -- Brass shield
            2412, -- Katana
            2478, -- Brass legs
            2643, -- Leather boots
            1988, -- Brown backpack
            2050 -- torch
        }
   
    if getPlayerStorageValue(cid, storage) == -1 then
        setPlayerStorageValue(cid, storage, 1)
        if getPlayerVocation(cid) == 1 then
            -- Mage
            for i = 1, table.getn(mageItems), 1 do
                doPlayerAddItem(cid, mageItems[i], 1, FALSE)
            end
       
        elseif getPlayerVocation(cid) == 2 then
            -- Paladin
            for i = 1, table.getn(pallyItems), 1 do
                doPlayerAddItem(cid, pallyItems[i], 1, FALSE)
            end
            -- 8 arrows
            doPlayerAddItem(cid, 2544, 8, FALSE)
       
        elseif getPlayerVocation(cid) == 3 then
            -- Knight
            for i = 1, table.getn(kinaItems), 1 do
                doPlayerAddItem(cid, kinaItems[i], 1, FALSE)
            end
        end
       
        -- Common for all
        doPlayerAddItem(cid, 2674, 5, FALSE) -- 5 apples
        doPlayerAddItem(cid, 2120, 1, FALSE) -- 1 rope
    end
    return true
end

Like? =]
 
Back
Top