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

[MOD] First Items

Collz

Pandas Go RAWR!!!
Joined
Oct 10, 2008
Messages
2,091
Reaction score
57
Location
New York
This script was originally created by JDB. I converted it into a Mod. So all credits goes to the original scripter.

Make a new file(or replace original) in the Mods folder called firstitems.xml and add this.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" 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 = {
			{ -- SORC
				{2190}, -- wand of vortex
				{2175}, -- spellbook
				{8820}, -- mage hat
				{8819} -- mage robe
			},
			{ -- DRUID
				{2182}, -- snakebite rod
				{2175}, -- spellbook
				{8820}, -- mage hat
				{8819} -- mage robe
			},
			{ -- PALADIN
				{2410}, -- throwing knife
				{2530}, -- copper shield
				{2480}, -- legion helmet
				{2464} -- chain armor
			},
			{ -- KNIGHT
				{2409}, -- serpent sword
				{2530}, -- copper shield
				{2480}, -- legion helmet
				{2464} -- chain armor
			}
		},
		all_items = {
			{2468}, -- studded legs
			{2643} -- leather boots
		},
		extra_items = {
			{2789, 15},
			{2120},
			{5710}
		},
		knight_weapons = {
			{2423}, -- clerical mace
			{2429} -- barbarian axe
		}
	}
	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
			
			setPlayerStorageValue(cid, storage, 1)
		end
	end
	return true
end
	]]></event>
</mod>
And that's it.

Original Script
This mod was tested using TFS 0.3.6!
 
Last edited:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		STORAGE = 30001
		commonItems = {
			{itemid=2152, count=25, inContainer = true}, -- 25 platinum coins
			{itemid=2643}, -- leather boots
			{itemid=2173} -- aol
		}
		firstItems = {
			{ -- Sorcerer	
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2190}, -- wand of vortex
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=2648} -- chain legs
			},
			{ -- Druid
				{itemid=1988}, -- backpack
				{itemid=2175}, -- spellbook
				{itemid=2182}, -- snakebite rod
				{itemid=8819}, -- magician's robe
				{itemid=8820}, -- mage hat
				{itemid=2648} -- chain legs
			},
			{ -- Paladin
				{itemid=1988}, -- backpack
				{itemid=2525}, -- dwarven shield
				{itemid=2389, count=3}, -- 3 spears
				{itemid=2463}, -- plate armor
				{itemid=2457}, -- steel helmet
				{itemid=2647} -- plate legs
			},
			{ -- Knight
				{itemid=1988}, -- backpack
				{itemid=2525}, -- dwarven shield
				{itemid=2383}, -- spike sword
				{itemid=2463}, -- plate armor
				{itemid=2457}, -- steel helmet
				{itemid=2647} -- plate legs
			}
		}
	]]></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
 
		function onLogin(cid)
			if getPlayerGroupId(cid) < 4 and getPlayerStorageValue(cid, STORAGE) < 1 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)
					else
						doPlayerAddItem(cid, v.itemid, v.count or 1)
					end
				end
				setPlayerStorageValue(cid, STORAGE, 1)
			end
			return true
		end
	]]></event>
</mod>
 
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" enabled="yes">
    <config name="firstitems_config"><![CDATA[
        STORAGE = 30001
        commonItems = {
            {itemid=2152, count=25, inContainer = true}, -- 25 platinum coins
            {itemid=2643}, -- leather boots
            {itemid=2173} -- aol
        }
        firstItems = {
            { -- Sorcerer   
                {itemid=1988}, -- backpack
                {itemid=2175}, -- spellbook
                {itemid=2190}, -- wand of vortex
                {itemid=8819}, -- magician's robe
                {itemid=8820}, -- mage hat
                {itemid=2648} -- chain legs
            },
            { -- Druid
                {itemid=1988}, -- backpack
                {itemid=2175}, -- spellbook
                {itemid=2182}, -- snakebite rod
                {itemid=8819}, -- magician's robe
                {itemid=8820}, -- mage hat
                {itemid=2648} -- chain legs
            },
            { -- Paladin
                {itemid=1988}, -- backpack
                {itemid=2525}, -- dwarven shield
                {itemid=2389, count=3}, -- 3 spears
                {itemid=2463}, -- plate armor
                {itemid=2457}, -- steel helmet
                {itemid=2647} -- plate legs
            },
            { -- Knight
                {itemid=1988}, -- backpack
                {itemid=2525}, -- dwarven shield
                {itemid=2383}, -- spike sword
                {itemid=2463}, -- plate armor
                {itemid=2457}, -- steel helmet
                {itemid=2647} -- plate legs
            }
        }
    ]]></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
 
        function onLogin(cid)
            if getPlayerGroupId(cid) < 4 and getPlayerStorageValue(cid, STORAGE) < 1 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)
                    else
                        doPlayerAddItem(cid, v.itemid, v.count or 1)
                    end
                end
                setPlayerStorageValue(cid, STORAGE, 1)
            end
            return true
        end
    ]]></event>
</mod>
where i can add this script in my otx It's my first time using otx so I don't know how to use it
 
i dont have mods folder you mean creaturescripts?
If you're still using the same OTX2 as your previous requests then you should have mods folder under data folder, You need to look better next time, or else people will stop helping you as you're not doing enough effort.
mods.PNG
What does his country have to do with this?
 
I don't have a mods folder. Even when I created it, tfs didn't read it. What should I do ?


f86b20fe93720b53med.jpg
 
Back
Top