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

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

This should help but dunno you must change things :p
 
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

This should help but dunno you must change things :p

That doesn't help him, read his request. :p

@Erikurr:

I'll try to make it! It's a nice deal.
 
@Archez
Thank you so much mate.

@Rizz
Will do, in like 3 days, as soon as i get home :)

Rizz got the help i needed, thanks to Rizz! Ill put something on youtube in a couple of days :)
 
Last edited:
Back
Top