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

Boat Script request

Erikurr

New Member
Joined
May 5, 2009
Messages
8
Reaction score
0
Location
Stockholm, Sweden
Hello, me and a couple of friends are making an Harry Potter based OTs, if you dont like the idea, thats ok because we do. Its going to be 7 main quests (for each year) where you get to fight your way through that years main challange.

hp1.png


Here's where you start, taking the boat to school, just like in the books/movies. And i found this on youtube: YouTube - Barco Que Navega - Dream World

Could someone help me make a script that works the same way as in the youtube clip, it only has to move east and if possible id like it to be activated by stepping on a tile next to the boat.
 
put that in data/npc/scripts and save as Griffindor

LUA:
 cities    = {}
cities[0] = {'vega','senja','tibia'}
cities[1] = {x=305,y=502,z=7,cost=10,prem=0}
cities[2] = {x=403,y=477,z=7,cost=10,prem=0}
cities[3] = {x=575,y=497,z=7,cost=0,prem=0}

dest=0
focus = 0
talk_start = 0

citylist = ''
i=1
while (cities[0][i] ~= nil) do
  citylist = citylist .. cities[0][i]..' '
  i=i+1
end

function ucfirst(str)
result=''
    for word in string.gfind(str, "%S+") do          
        local first = string.sub(word,1,1) --get the first char of each word, uppercase        
        result = result .. string.upper(first) .. string.lower(string.sub(word,2)) .. ' '
    end    
    return result
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 onThingMove(creature, thing, oldpos, oldstackpos) 
end 

function onCreatureDisappear(cid, pos)
 	if focus == cid then
         selfSay('Good bye then.')
         focus = 0
         talk_start = 0
	 dest = 0
	
 	end
end

function onCreatureAppear(creature) 
end 

function onCreatureTurn(creature) 
end 

function onCreatureChangeOutfit(creature)
end

function onCreatureSay(cid, type, msg)

if getDistanceToCreature(cid) >= 3 then
return
end

msg = string.lower(msg)

if msgcontains(msg, 'hi') or msgcontains(msg, 'hello') then
 if focus == 0 then
  selfSay('Welcome on board, ' .. creatureGetName(cid) .. '! What\'s your destination?')
  focus = cid
  
 elseif focus ~= cid and focus ~= 0 then
  
  selfSay(creatureGetName(cid) .. ', wait for your turn.')
 elseif focus == cid and focus ~= 0 then
  selfSay(creatureGetName(cid) .. ', I am already talking to you.')
 end
end

if focus == cid and focus ~= 0 then 

 if dest~= 0 then
  if string.find(msg, 'yes') then
	if (isPremium(cid) and cities[dest].prem == 1) or cities[dest].prem == 0 then
    		if pay(cid,cities[dest].cost) then
			selfSay('Let\'s go!')
			selfSay('/send ' .. creatureGetName(cid) .. ', '..cities[dest].x..' '..cities[dest].y..' '..cities[dest].z)
			focus = 0
			talk_start = 0
		else
			selfSay('Sorry, you don\'t have enough money.')
			talk_start = os.clock()
		end
	else
			selfSay('Sorry, you are not premium.')
			talk_start = os.clock()
	end

  else
   selfSay('Where do you want to go then?')  
  end
 dest=0
 end

 talk_start = os.clock() 
 

 if msgcontains(msg, 'bye') or msgcontains(msg, 'farewell') then
  selfSay('Good bye, ' .. creatureGetName(focus) .. '.')
  focus = 0
  talk_start = 0
  dest=0
 elseif msgcontains(msg, 'job')  then
  selfSay('I\'m a captain of this ship.') 
 elseif string.find(msg, 'destination') then
  selfSay('I can take you to: '..ucfirst(citylist)..'. Arrg!') 
 elseif msgcontains(msg, 'about') then
  selfSay('Script made by Nicaw.')
 else
 i=1
 while (cities[0][i] ~= nil and dest==0) do
  if msgcontains(msg,cities[0][i]) then dest = i end
  i=i+1
  end
 end

 if dest ~= 0 then
  selfSay('Do you seek a passage to '..ucfirst(cities[0][dest])..'for '..cities[dest].cost..' gold?')
 end
 
end

end

function onThink()

if focus > 0 then
 selfLook(focus)
 if getDistanceToCreature(focus) > 5 then
  focus = 0
  selfSay('Good bye then.')
 end
end

if (os.clock() - talk_start) > 40 then
 if focus > 0 then
 selfSay('Next Please...')
end
focus = 0
end

end

Put this in data/npc save as Griffindor

LUA:
<?xml version="1.0"?>
<npc name="Pegrid" script="data/npc/scripts/Griffindor.lua" access="4" lookdir="2">
	<mana now="800" max="800"/>
	<health now="200" max="200"/>
	<look type="129" head="84" body="119" legs="94" feet="114"/>
</npc>


This should help but dunno you must change things :p


rep++ plx ;D
 
Last edited:
put that in data/npc/scripts and save as Griffindor

LUA:
 cities    = {}
cities[0] = {'vega','senja','tibia'}
cities[1] = {x=305,y=502,z=7,cost=10,prem=0}
cities[2] = {x=403,y=477,z=7,cost=10,prem=0}
cities[3] = {x=575,y=497,z=7,cost=0,prem=0}

dest=0
focus = 0
talk_start = 0

citylist = ''
i=1
while (cities[0][i] ~= nil) do
  citylist = citylist .. cities[0][i]..' '
  i=i+1
end

function ucfirst(str)
result=''
    for word in string.gfind(str, "%S+") do          
        local first = string.sub(word,1,1) --get the first char of each word, uppercase        
        result = result .. string.upper(first) .. string.lower(string.sub(word,2)) .. ' '
    end    
    return result
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 onThingMove(creature, thing, oldpos, oldstackpos) 
end 

function onCreatureDisappear(cid, pos)
 	if focus == cid then
         selfSay('Good bye then.')
         focus = 0
         talk_start = 0
	 dest = 0
	
 	end
end

function onCreatureAppear(creature) 
end 

function onCreatureTurn(creature) 
end 

function onCreatureChangeOutfit(creature)
end

function onCreatureSay(cid, type, msg)

if getDistanceToCreature(cid) >= 3 then
return
end

msg = string.lower(msg)

if msgcontains(msg, 'hi') or msgcontains(msg, 'hello') then
 if focus == 0 then
  selfSay('Welcome on board, ' .. creatureGetName(cid) .. '! What\'s your destination?')
  focus = cid
  
 elseif focus ~= cid and focus ~= 0 then
  
  selfSay(creatureGetName(cid) .. ', wait for your turn.')
 elseif focus == cid and focus ~= 0 then
  selfSay(creatureGetName(cid) .. ', I am already talking to you.')
 end
end

if focus == cid and focus ~= 0 then 

 if dest~= 0 then
  if string.find(msg, 'yes') then
	if (isPremium(cid) and cities[dest].prem == 1) or cities[dest].prem == 0 then
    		if pay(cid,cities[dest].cost) then
			selfSay('Let\'s go!')
			selfSay('/send ' .. creatureGetName(cid) .. ', '..cities[dest].x..' '..cities[dest].y..' '..cities[dest].z)
			focus = 0
			talk_start = 0
		else
			selfSay('Sorry, you don\'t have enough money.')
			talk_start = os.clock()
		end
	else
			selfSay('Sorry, you are not premium.')
			talk_start = os.clock()
	end

  else
   selfSay('Where do you want to go then?')  
  end
 dest=0
 end

 talk_start = os.clock() 
 

 if msgcontains(msg, 'bye') or msgcontains(msg, 'farewell') then
  selfSay('Good bye, ' .. creatureGetName(focus) .. '.')
  focus = 0
  talk_start = 0
  dest=0
 elseif msgcontains(msg, 'job')  then
  selfSay('I\'m a captain of this ship.') 
 elseif string.find(msg, 'destination') then
  selfSay('I can take you to: '..ucfirst(citylist)..'. Arrg!') 
 elseif msgcontains(msg, 'about') then
  selfSay('Script made by Nicaw.')
 else
 i=1
 while (cities[0][i] ~= nil and dest==0) do
  if msgcontains(msg,cities[0][i]) then dest = i end
  i=i+1
  end
 end

 if dest ~= 0 then
  selfSay('Do you seek a passage to '..ucfirst(cities[0][dest])..'for '..cities[dest].cost..' gold?')
 end
 
end

end

function onThink()

if focus > 0 then
 selfLook(focus)
 if getDistanceToCreature(focus) > 5 then
  focus = 0
  selfSay('Good bye then.')
 end
end

if (os.clock() - talk_start) > 40 then
 if focus > 0 then
 selfSay('Next Please...')
end
focus = 0
end

end

Put this in data/npc save as Griffindor

LUA:
<?xml version="1.0"?>
<npc name="Pegrid" script="data/npc/scripts/Griffindor.lua" access="4" lookdir="2">
	<mana now="800" max="800"/>
	<health now="200" max="200"/>
	<look type="129" head="84" body="119" legs="94" feet="114"/>
</npc>


This should help but dunno you must change things :p


rep++ plx ;D

Thanks, the only thing is im not sure about what the npc is for, because it looks like a boat npc, please be patient, ill be gone for 3 days so you'll have some time to respond :) Ofcourse ill rep++ you :)
 
Back
Top