Criei esse script pra mim usar no meu ot, mais resolvi compartilhar com quem deseja.
Muito simples, mais tem muita gente que precisa.
primeiro vá em data / creaturescripts / scripts ..
Apaga o arquivo firstitems.lua.
e remova a tag em creaturescripts.xml ...
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
Vamos para o script...
vá em data / movements / scripts.
cria um arquivo.lua e coloca isso dentro:
--[[ Script by DuuhCarvalho ]]--
function onStepIn(cid, item, pos)
local items = {
[0] = {id = 2160, count = 20}, -- crystal coins
[1] = {id = 7618, count = 20}, -- health potions
[2] = {id = 7620, count = 20}, -- mana potions
[3] = {id = 2554, count = 1}, -- shovel
[4] = {id = 2120, count = 1}, -- rope
[5] = {id = 2460, count = 1}, -- brass helmet
[6] = {id = 2465, count = 1}, -- brass armor
[7] = {id = 2478, count = 1}, -- brass legs
[8] = {id = 2525, count = 1}, -- dwarven shield
[9] = {id = 2643, count = 1}, -- leather boots
}
local storage = 1010
local pos = {x=292, y=161, z=7} -- posição para onde o player será teleportado
local bpId = 1988 -- id da backpack
if getPlayerStorageValue(cid, storage) <= 0 then
if getPlayerVocation(cid) == 1 then -- vocação id 1 (master sorcerer)
if getPlayerFreeCap(cid) >= 373 then
local bp = doPlayerAddItem(cid, bpId, 1)
for i = 0, #items do
doAddContainerItem(bp, items[i].id, items[i].count)
end
doPlayerAddItem(cid, 2190, 1) -- Wand .
doTeleportThing(cid, pos)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendCancel(cid, "Você não tem capacidade, remova algum item da sua BackPack.")
end
elseif getPlayerVocation(cid) == 2 then -- vocação id 2 (elder druid)
if getPlayerFreeCap(cid) >= 397 then
local bp = doPlayerAddItem(cid, bpId, 1)
for i = 0, #items do
doAddContainerItem(bp, items[i].id, items[i].count)
end
doPlayerAddItem(cid, 2182, 1) -- Rod.
doTeleportThing(cid, pos)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendCancel(cid, "Você não tem capacidade, remova algum item da sua BackPack.")
end
elseif getPlayerVocation(cid) == 3 then -- vocação id 3 (royal paladin)
if getPlayerFreeCap(cid) >= 359 then
local bp = doPlayerAddItem(cid, bpId, 1)
for i = 0, #items do
doAddContainerItem(bp, items[i].id, items[i].count)
end
doPlayerAddItem(cid, 2410, 1) -- item de distance (no caso, throwing knife)
doTeleportThing(cid, pos)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendCancel(cid, "Você não tem capacidade, remova algum item da sua BackPack.")
end
elseif getPlayerVocation(cid) == 4 then -- vocação id 4 (elite knight)
if getPlayerFreeCap(cid) >= 377 then
local bp = doPlayerAddItem(cid, bpId, 1)
for i = 0, #items do
doAddContainerItem(bp, items[i].id, items[i].count)
end
doPlayerAddItem(cid, 2392, 1) -- sword, axe ou club
doTeleportThing(cid, pos)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendCancel(cid, "Você não tem capacidade, remova algum item da sua BackPack.")
end
end
else
doPlayerSendCancel(cid, "Você já ganhou seus items.")
end
return true
end
agora vá em data / movements / movements.Xml.. e coloque a tag :
<movevent type="StepIn" uniqueid="UniqueId" event="script" value="NomedoArquivo.lua"/>
uniqueid ="coloca qualquer um que não esteja sendo usado".
Agora é só abrir o RME e colocar o uniqueid no teleporte ou tile !
Bem simples mais compartilhei na intenção de ajudar os iniciantes.