Hello lets start:
First we make the Boatnpc:
Save this as boat man.xml in data/npc
Than we will add the script:
Save this as boatman.lua in data/npc/scripts
Than u need to change the city names change vilesta to your city name
Than u need to change your travel coordinates change this to where he need to travel
Any questions? Bugs report? add me on msn [email protected]
Enjoy!
First we make the Boatnpc:
Save this as boat man.xml in data/npc
Code:
<?xml version="1.0"?>
<npc name="Boat Man" script="data/npc/scripts/boatman.lua" access="3" monster="1" speed="50" level="100" maglevel="100" exp="0" pushable="0" lookdir="0">
<mana now="100" max="100"/>
<health now="100" max="100"/>
<look type="134" head="78" body="61" legs="52" feet="114" corpse="2276"/>
<attack type="melee" damage="10"/>
</npc>
Than we will add the script:
Save this as boatman.lua in data/npc/scripts
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
if isPremium(cid) then
selfSay('Hello ' .. creatureGetName(cid) .. '! I can take you to New Island (100gps), Thais (100gps), Venore (100gps), Dessert (100gps), Vilesta (100gps), Ankrahmun (100gps) or Port Hope (100gps). Where do you want to go?')
focus = cid
talk_start = os.clock()
else
selfSay('Sorry, only premium players can travel by boat.')
focus = 0
talk_start = 0
end
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'vilesta') then
if pay(cid,50) then
selfSay('Let's go!')
travel(cid, 810, 884, 7)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end
elseif msgcontains(msg, 'dessert') then
if pay(cid,50) then
selfSay('Let's go!')
travel(cid, 810, 884, 7)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end
elseif msgcontains(msg, 'new island') then
if pay(cid,50) then
selfSay('Let's go!')
travel(cid, 1483, 2834, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end
elseif msgcontains(msg, 'thais') then
if pay(cid,50) then
selfSay('Let's go!')
travel(cid, 387, 1354, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end
elseif msgcontains(msg, 'venore') then
if pay(cid,50) then
selfSay('Let's go!')
travel(cid, 1137, 880, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end
elseif msgcontains(msg, 'ankrahmun') then
if pay(cid,50) then
selfSay('Let's go!')
travel(cid, 1532, 1012, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end
elseif msgcontains(msg, 'port hope') then
if pay(cid,50) then
selfSay('Let's go!')
travel(cid, 1543, 1388, 6)
focus = 0
talk_start = 0
else
selfSay('Sorry, you don't have enough money.')
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Than u need to change the city names change vilesta to your city name
Code:
if msgcontains(msg, 'vilesta') then
Than u need to change your travel coordinates change this to where he need to travel
Code:
travel(cid, 810, 884, 7)
Any questions? Bugs report? add me on msn [email protected]
Enjoy!