andypsylon
be be
for this query
in data\creaturescripts\creaturescripts.xml insert:
create data\creaturescripts\scripts\firstItems.lua and insert:
or mod
as in the title
in data\creaturescripts\creaturescripts.xml insert:
XML:
<event type="login" name="firstItems" event="script" value="firstItems.lua"/>
create data\creaturescripts\scripts\firstItems.lua and insert:
Lua:
-- ver. 2.3 2012-01-06
-- author tfs, otland.net/members/andypsylon
-- with a welcome letter
local c = {
freeDays = nil, -- paste nr, for ex. 3 if you will 3 free premium days for players
addLevel = nil, -- paste nr, for ex. 7 if you will 8 start level for players
-- letter
text = "Hi ".. getCreatureName(cid) ..". WarOTS Blabla bla. BlaaaBlabla Bla bla bla :) bla.",
writer = "Andy, (name of your ots)",
date = os.time()
--/letter
}
local commonItems = { -- items for all vocs
{2120}, -- rope
{2789, 100}, -- brown mushrooms
{2305}, -- fire bomb rune
{2261}, -- destroy field rune
{2274} -- avalanche rune
}
local firstItems = {
{ -- items for sorcerer
{2323}, -- hat of the mad
{8871}, -- focus cape
{7730}, -- blue legs
{2195}, -- boots of haste
{8902}, -- spellbook of mind control
{2187}, -- wand of inferno
{2268}, -- sd
{2273}, -- uh
{7590}, -- gmp
{2293} -- mw
},
{ -- items for druid
{2323}, -- hat of the mad
{8871}, -- focus cape
{7730}, -- blue legs
{2195}, -- boots of haste
{8902}, -- spellbook of mind control
{2183}, -- hailstorm rod
{2268}, -- sd
{2273}, -- uh
{7590}, -- gmp
{2293}, -- mw
{2269}, -- wg
{2278} -- para
},
{ -- items for palladin
{2493}, -- demon helmet
{8891}, -- paladin armor
{7730}, -- blue legs
{2195}, -- boots of haste
{2514}, -- mastermind shield
{7368, 10}, -- assassin stars
{2268}, -- sd
{2273}, -- uh
{8472}, -- gsp
{7589}, -- smp
{7588}, -- shp
{2293} -- mw
},
{ -- items for knight
{2493}, -- demon helmet
{2472}, -- magic plate armor
{2470}, -- golden legs
{2195}, -- boots of haste
{2514}, -- mastermind shield
{2400}, -- magic sword
{2431}, -- Stonecutter Axe
{7620}, -- mp
{8473}, -- uhp
{2313}, -- explosion
{2293} -- mw
}
}
for _, fitems in ipairs(firstItems) do
for _, citems in ipairs(commonItems) do
table.insert(fitems, citems)
end
end
function onLogin(cid)
if getPlayerGroupId(cid) < 2 then
local hasReceivedFirstItems = getCreatureStorage(cid, 30001) -- 30001 - is standard storage in tfs ots, you can change for another one
if hasReceivedFirstItems == -1 then
local bp = doPlayerAddItem(cid, 2000, 1)
local giveItems = firstItems[getPlayerVocation(cid)]
if giveItems ~= nil then
for _, v in ipairs(giveItems) do
doAddContainerItem(bp, v[1], v[2] or 1)
end
end
-- letter
local item = doCreateItemEx(2598, 1)
doSetItemText(item, c.text, c.writer, c.date)
doPlayerAddItemEx(cid, item, true)
doShowTextDialog(cid, 2598, c.text)
--/letter
if c.freeDays ~= nil then
doPlayerAddPremiumDays(cid, c.freeDays) -- how many free premium days? 3?
end
if c.addLevel ~= nil then
doPlayerAddLevel(cid, c.addLevel) -- Level 8
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved your first equipment")
doCreatureSetStorage(cid, 30001, 1)
end
end
return true
end
or mod
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="2.3" author="andy" contact="otland.net/members/andypsylon" enabled="yes">
<event type="login" name="firstItems" event="script"><![CDATA[
local c = {
freeDays = nil -- paste nr, for ex. 3 if you will 3 free premium days for players
addLevel = nil -- paste nr, for ex. 7 if you will 8 start level for players
-- letter
text = "Hi ".. getCreatureName(cid) ..". WarOTS Blabla bla. BlaaaBlabla Bla bla bla :) bla.",
writer = "Andy, (name of your ots)",
date = os.time()
--/letter
}
local commonItems = { -- items for all vocs
{2120}, -- rope
{2789, 100}, -- brown mushrooms
{2305}, -- fire bomb rune
{2261}, -- destroy field rune
{2274} -- avalanche rune
}
local firstItems = {
{ -- items for sorcerer
{2323}, -- hat of the mad
{8871}, -- focus cape
{7730}, -- blue legs
{2195}, -- boots of haste
{8902}, -- spellbook of mind control
{2187}, -- wand of inferno
{2268}, -- sd
{2273}, -- uh
{7590}, -- gmp
{2293} -- mw
},
{ -- items for druid
{2323}, -- hat of the mad
{8871}, -- focus cape
{7730}, -- blue legs
{2195}, -- boots of haste
{8902}, -- spellbook of mind control
{2183}, -- hailstorm rod
{2268}, -- sd
{2273}, -- uh
{7590}, -- gmp
{2293}, -- mw
{2269}, -- wg
{2278} -- para
},
{ -- items for palladin
{2493}, -- demon helmet
{8891}, -- paladin armor
{7730}, -- blue legs
{2195}, -- boots of haste
{2514}, -- mastermind shield
{7368, 10}, -- assassin stars
{2268}, -- sd
{2273}, -- uh
{8472}, -- gsp
{7589}, -- smp
{7588}, -- shp
{2293} -- mw
},
{ -- items for knight
{2493}, -- demon helmet
{2472}, -- magic plate armor
{2470}, -- golden legs
{2195}, -- boots of haste
{2514}, -- mastermind shield
{2400}, -- magic sword
{2431}, -- Stonecutter Axe
{7620}, -- mp
{8473}, -- uhp
{2313}, -- explosion
{2293} -- mw
}
}
for _, fitems in ipairs(firstItems) do
for _, citems in ipairs(commonItems) do
table.insert(fitems, citems)
end
end
function onLogin(cid)
if getPlayerGroupId(cid) < 2 then
local hasReceivedFirstItems = getCreatureStorage(cid, 30001) -- 30001 - is standard storage in tfs ots, you can change for another one
if hasReceivedFirstItems == -1 then
local bp = doPlayerAddItem(cid, 2000, 1)
local giveItems = firstItems[getPlayerVocation(cid)]
if giveItems ~= nil then
for _, v in ipairs(giveItems) do
doAddContainerItem(bp, v[1], v[2] or 1)
end
end
-- letter
local item = doCreateItemEx(2598, 1)
doSetItemText(item, c.text, c.writer, c.date)
doPlayerAddItemEx(cid, item, true)
doShowTextDialog(cid, 2598, c.text)
--/letter
if c.freeDays ~= nil then
doPlayerAddPremiumDays(cid, c.freeDays) -- how many free premium days? 3?
end
if c.addLevel ~= nil then
doPlayerAddLevel(cid, c.addLevel) -- Level 8
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved your first equipment")
doCreatureSetStorage(cid, 30001, 1)
end
end
return true
end
]]></event>
</mod>
Last edited: