Va na pasta mod crie um arquivo XML com o nome de boatsystem e bote isso:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="BoatSystem" enabled="yes" author="MatheusMkalo" forum="XTibia.com">
<config name="BoatSystemLib"><![CDATA[
mydirs= {
[1] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, -1}},
[2] = {type = 2, ids = {3592, 3595, 3596}, xy = {1, 0}},
[3] = {type = 1, ids = {3587, 3590, 3591}, xy = {0, 1}},
[4] = {type = 2, ids = {3592, 3595, 3596}, xy = {-1, 0}}
}
allids = {3587, 3590, 3591, 3592, 3595, 3596}
function newEndb(endb, dir)
local xx = endb.x
local yy = endb.y
for i = 1, #dir do
xx = xx+mydirs[dir[i]].xy[1]
yy = yy+mydirs[dir[i]].xy[2]
end
return {x=xx, y=yy, z=endb.z}
end
function doMoveBoat(post, dir, cid)
local newboat = {}
for i,s in ipairs(post) do
local backu = getThingPos(s)
doRemoveItem(s, 1)
doCreateItem(mydirs[dir].ids[i], 1, {x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z})
table.insert(newboat, getThingFromPos({x=backu.x+mydirs[dir].xy[1], y=backu.y+mydirs[dir].xy[2], z=backu.z, stackpos=1}).uid)
end
if mydirs[dir].type ~= post.type and mydirs[dir].type == 1 then
doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x+1, y=getThingPos(newboat[1]).y-1, z=getThingPos(newboat[1]).z})
doRemoveItem(newboat[1], 1)
doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x-1, y=getThingPos(newboat[3]).y+1, z=getThingPos(newboat[3]).z})
doRemoveItem(newboat[3], 1)
elseif mydirs[dir].type ~= post.type and mydirs[dir].type == 2 then
doCreateItem(getThing(newboat[1]).itemid, 1, {x=getThingPos(newboat[1]).x-1, y=getThingPos(newboat[1]).y+1, z=getThingPos(newboat[1]).z})
doRemoveItem(newboat[1], 1)
doCreateItem(getThing(newboat[3]).itemid, 1, {x=getThingPos(newboat[3]).x+1, y=getThingPos(newboat[3]).y-1, z=getThingPos(newboat[3]).z})
doRemoveItem(newboat[3], 1)
end
if cid then
doTeleportThing(cid, {x=getCreaturePosition(cid).x+mydirs[dir].xy[1], y=getCreaturePosition(cid).y+mydirs[dir].xy[2], z=getCreaturePosition(cid).z}, false)
end
end
function getPosBoat(cid, pos)
local pcid = not pos and getCreaturePosition(cid) or pos
local check = getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).itemid == mydirs[1].ids[2] and 1 or 2
if check == 1 then
return {getThingFromPos({x=pcid.x, y=pcid.y-1, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y+1, z=pcid.z, stackpos=1}).uid, type = check}
elseif check == 2 then
return {getThingFromPos({x=pcid.x-1, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x, y=pcid.y, z=pcid.z, stackpos=1}).uid, getThingFromPos({x=pcid.x+1, y=pcid.y, z=pcid.z, stackpos=1}).uid, type = check}
end
return false
end
function reverse(t)
local result = {}
for i = #t, 1, -1 do
table.insert(result, t[i] == 1 and 3 or t[i] == 2 and 4 or t[i] == 3 and 1 or t[i] == 4 and 2)
end
return result
end
]]></config>
<movevent type="StepIn" actionid="6616" event="script"><![CDATA[
domodlib("BoatSystemLib")
local t = {4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}
local postart = {x=968, y=1001, z=7, stackpos=1}
local posback = {x=994, y=978, z=7, stackpos=1}
local delay = 350
if toPosition.x == posback.x and toPosition.y == posback.y then
doCreatureSetNoMove(cid, true)
for i = 1, #reverse(t) do
addEvent(function() doMoveBoat(getPosBoat(cid), reverse(t)[i], cid) end, i*delay)
end
addEvent(doCreatureSetNoMove, delay*#reverse(t)+100, cid, false)
addEvent(function() doItemSetAttribute(getThingFromPos(postart).uid, "aid", 6616) end, delay*#t+100)
elseif toPosition.x == postart.x and toPosition.y == postart.y then
doCreatureSetNoMove(cid, true)
for i = 1, #t do
addEvent(function() doMoveBoat(getPosBoat(cid), t[i], cid) end, i*delay)
end
addEvent(doCreatureSetNoMove, delay*#t+100, cid, false)
addEvent(function() doItemSetAttribute(getThingFromPos(posback).uid, "aid", 6616) end, delay*#t+100)
end
]]></movevent>
<movevent type="StepIn" actionid="6617" event="script"><![CDATA[
domodlib("BoatSystemLib")
if not isInArray(allids, getThingFromPos({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}).itemid) then
doTeleportThing(cid, fromPosition, false)
end
]]></movevent>
</mod>
Agora configurando o script:
No local t, sao todas as direçoes que o barco vai andar, em sentido horario:
1 = norte
2 = leste
3 = sul
4 = oeste
No local postart eh a posiçao que o meio do barco vai estar quando ele estiver indo para algum lugar.
No local posback eh a posiçao que o meio do barco vai estar quando ele estiver voltando.
O delay eh o tempo em milesegundos que demora pra o barco andar.
Adicionando no Map editor:
Faça 3 sqms do id 4820.
Adicione o actionid 6617 nesses sqms.
Faça 3 ids de barco, voce escolhe se eh o virado para cima ou para o lado.
Bote o actionid 6616 no meio do barco.
Fica assim:
O vermemlho indica que tem o id 4820 e o actionid 6617.
O verde indica o actionid 6616
Na pos que ele vai chegar soh faça o negocio na agua, nao precisa fazer outro bote.
OBS: PONHA OS SQMS DA ROTA PARA NAO PODER LOGA SE ALGUEM LOGA NO BARCO VAI DAR BUG
Esse script mostra a quantidade de frags que o player tem quando voce da look nele exemplo: You see Theax. He is a Royal Paladin.[frags:43]
Crie na pasta Data/Creaturescripts/script o arquivo fraglook.lua
e cole isso
--Script By Theax ""
function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {
day = table.maxn(contents.day),
week = table.maxn(contents.week),
month = table.maxn(contents.month)
}
return size.day + size.week + size.month
end
function onLogin(cid)
registerCreatureEvent(cid, "fraglook")
return true
end
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and thing.uid ~= cid then
doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..']')
return true
elseif thing.uid == cid then
doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..']')
local string = 'You see yourself.'
if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
string = string..' You are '.. getPlayerGroupName(cid) ..'.'
elseif getPlayerVocation(cid) ~= 0 then
string = string..' You are '.. getPlayerVocationName(cid) ..'.'
else
string = string..' You have no vocation.'
end
string = string..getPlayerSpecialDescription(cid)..''
if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
end
if getPlayerGuildId(cid) > 0 then
string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
return false
end
return true
end
Agora no Data/Creaturescripts/creaturescripts.xml
adicione essas tags:
em creaturescripts/scripts crie um arquivo chamado levelitem.lua e cole o seguinte código:
local configlvl = {
[600] = {id = 2525, count = 1},
[700] = {id = 2525, count = 1}
}
function onAdvance(cid, skill, oldLevel, newLevel)
if skill == 8 then
local tb = configlvl[newLevel]
if tb then
doPlayerAddItem(cid, tb.id, tb.count)
doPlayerSendTextMessage(cid, 27, "Parabéns você atingiu o level "..newLevel.." e ganhou "..tb.count.." "..getItemNameById(tb.id)..".")
end
end
return true
end
depois na mesma pasta procure o login.lua e registre o evento como
registerCreatureEvent(cid, "LevelItem")
na pasta anterior no arquivo creaturescripts.xml adc a seguinte tag: