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

[7.4] Avesta

Does anyone have a guide to compile this in Linux?
 
Does anyone have a guide to compile this in Linux?

It's just about the same as compiling any other distro in linux, there are some nice guides around the forums here, I don't have the bookmarks on this computer, sorry about that.
 
Someone here know how fix the problems with the npcs? only work 1 script for all npcs wtf
 
Npcs works fine. Mastercores doh, doesn't. Unless you modify the sources. There is info in the mastercores thread.
 
Npcs works fine. Mastercores doh, doesn't. Unless you modify the sources. There is info in the mastercores thread.

lol I wonder what do you mean with "npcs don't work with mastercores".
 
Masterwhat? xD

My qquestion is refered with this problem posted by Peonso

#1 - If my map has more then one NPC, it doens't matter, the server seams to load just one script, and all the NPCs on the map behave like they are the same. In my case, all the NPCs talk/sell like they are tom.lua, even if they are related to other script. I couldn't found an error on my scripts, please someone give me some light.

Im using the rev94 why the server only load the same script to the rest of the npc?
 
Masterwhat? xD

My qquestion is refered with this problem posted by Peonso

Im using the rev94 why the server only load the same script to the rest of the npc?

Post 2 NPCs with there XML scripts.
 
I try to use the default npcs what come with the subversion i only change the name and the coordenates of the destination.

Jack work fine with their script, but steven work with the jack script not with "steven.lua" and the rest of the npcs load jack.lua not the own scripts

first npc
XML:
<?xml version="1.0"?>
<npc name="Jack" script="jack.lua" walkinterval="2000" floorchange="0" idleinterval="30">
	<health now="100" max="100"/>
	<look type="129" head="49" body="19" legs="17" feet="50"/>
</npc>

Script

Lua:
_state = 0
_index = 0
_delay = 750

destinations = {}
destinations[0] = {name = 'ankrah', pos = {x = 536, y = 523, z = 7}, price = 60}

function getNext()
	nextPlayer = getQueuedPlayer()
	if (nextPlayer ~= nil) then
		if (getDistanceToCreature(nextPlayer) <= 4) then
			updateNpcIdle()
			setNpcFocus(nextPlayer)
			greet(nextPlayer, _delay * 2)
			return
		else
			getNext()
		end
	end
	
	setNpcFocus(0)
	resetNpcIdle()
end

function _selfSay(message)
	selfSay(message, _delay)
	updateNpcIdle()
end

local function greet(cid, delay)
	local title = 'Sir'
	if (getPlayerSex(cid) == 0) then
		title = 'Madam'
	end
	
	selfSay('Welcome on board, ' .. title .. ' ' .. getCreatureName(cid) .. '.', delay)
end

function onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
	if (getNpcFocus() == cid) then
		selfSay('Good bye. Recommend us, if you were satisfied with our service.')
		getNext()
	else
		unqueuePlayer(cid)
	end
end

function onCreatureMove(cid, oldPos, newPos)
	if (getNpcFocus() == cid) then
		faceCreature(cid)
		
		if (oldPos.z ~= newPos.z or getDistanceToCreature(cid) > 4) then
			selfSay('Good bye. Recommend us, if you were satisfied with our service.', _delay)
			getNext()
		end
	else
		if (oldPos.z ~= newPos.z or getDistanceToCreature(cid) > 4) then
			unqueuePlayer(cid)
		end
	end
end

function onCreatureSay(cid, type, msg)
	if (getNpcFocus() == 0) then
		if ((msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and getDistanceToCreature(cid) <= 4) then
			updateNpcIdle()
			setNpcFocus(cid)
			greet(cid, _delay)
		end
		
	elseif (getNpcFocus() ~= cid) then
		if ((msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and getDistanceToCreature(cid) <= 4) then
			selfSay('Just wait, ' .. getCreatureName(cid) .. '.', _delay)
			queuePlayer(cid)
		end
		
	else
		if (msgcontains(msg, 'bye')) then
			selfSay('Good bye. Recommend us, if you were satisfied with our service.', _delay)
			getNext()
		
		elseif (msgcontains(msg, 'name')) then
			_selfSay('My name is Captain Bluebear from the Royal Tibia Line.')
		
		elseif (msgcontains(msg, 'job') or msgcontains(msg, 'captain')) then
			_selfSay('I am the captain of this sailing-ship.')
		
		elseif (msgcontains(msg, 'ship') or msgcontains(msg, 'line') or
				msgcontains(msg, 'company') or msgcontains(msg, 'route') or
				msgcontains(msg, 'tibia')) then
			_selfSay('The Royal Tibia Line connects all seaside towns of Tibia.')
		
		elseif (msgcontains(msg, 'good')) then
			_selfSay('We can transport everything you want.')
		
		elseif (msgcontains(msg, 'passenger')) then
			_selfSay('We would like to welcome you on board.')
		
		elseif (msgcontains(msg, 'trip') or msgcontains(msg, 'passage') or
				msgcontains(msg, 'town') or msgcontains(msg, 'destinantion') or
				msgcontains(msg, 'sail') or msgcontains(msg, 'go')) then
			_selfSay('Where do you want to go? To Carlin, Ab\'Dendriel, Venore, Port Hope or Edron?')
		
		elseif (msgcontains(msg, 'ice') or msgcontains(msg, 'senja') or
				msgcontains(msg, 'folda') or msgcontains(msg, 'vega')) then
			_selfSay('I\'m sorry, but we don\'t serve the routes to the Ice Islands.')
		
		elseif (msgcontains(msg, 'darashia') or msgcontains(msg, 'darama')) then
			_selfSay('I\'m not sailing there. This route is afflicted by a ghostship! However I\'ve heard that Captain Fearless from Venore sails there.')
		
		elseif (msgcontains(msg, 'ghost')) then
			_selfSay('Many people who sailed to Darashia never returned because they were attacked by a ghostship! I\'ll never sail there!')
			
		elseif (msgcontains(msg, 'thais')) then
			_selfSay('This is Thais. Where do you want to go?')
			
		elseif (_state == 1) then
			if (msgcontains(msg, 'yes')) then
				if (not(hasCondition(cid, CONDITION_INFIGHT) == true)) then
					if (getPlayerMoney(cid) >= destinations[_index].price) then
						doPlayerRemoveMoney(cid, destinations[_index].price)
						_selfSay('Set the sails!')
						doSendMagicEffect(getCreaturePosition(cid), CONST_ME_ENERGYAREA)
						doTeleportThing(cid, destinations[_index].pos)
						doSendMagicEffect(getCreaturePosition(cid), CONST_ME_ENERGYAREA)
						getNext()
					else
						_selfSay('You don\'t have enough money.')
					end
				else
					_selfSay('First get rid of those blood stains! You are not going to ruin my vehicle!')
					getNext()
				end
			else
				selfSay('We would like to serve you some time.', _delay)
			end
			
			_state = 0
			
		else
			for n = 0, table.getn(destinations) do
				if (msgcontains(msg, destinations[n].name)) then
					_index = n
					_state = 1
					
					_selfSay('Do you seek a passage to ' .. destinations[_index].name .. ' for ' .. destinations[_index].price .. ' gold?')
					break
				end
			end
		end
	end
end

function onThink()
	if (getNpcFocus() ~= 0) then
		if (isNpcIdle()) then
			selfSay('Good bye. Recommend us, if you were satisfied with our service.', _delay)
			getNext()
		end
	end
end


Second NPC (is the same shit of the first npc xP)

XML:
<?xml version="1.0"?>
<npc name="Steven" script="steven.lua" walkinterval="2000" floorchange="0" idleinterval="30">
	<health now="100" max="100"/>
	<look type="129" head="19" body="69" legs="107" feet="50"/>
</npc>

Script
Lua:
_state = 0
_index = 0
_delay = 750

destinations = {}
destinations[0] = {name = 'celeste', pos = {x = 506, y = 490, z = 7}, price = 60}

function getNext()
	nextPlayer = getQueuedPlayer()
	if (nextPlayer ~= nil) then
		if (getDistanceToCreature(nextPlayer) <= 4) then
			updateNpcIdle()
			setNpcFocus(nextPlayer)
			greet(nextPlayer, _delay * 2)
			return
		else
			getNext()
		end
	end
	
	setNpcFocus(0)
	resetNpcIdle()
end

function _selfSay(message)
	selfSay(message, _delay)
	updateNpcIdle()
end

local function greet(cid, delay)
	local title = 'Sir'
	if (getPlayerSex(cid) == 0) then
		title = 'Madam'
	end
	
	selfSay('Welcome on board, ' .. title .. ' ' .. getCreatureName(cid) .. '.', delay)
end

function onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
	if (getNpcFocus() == cid) then
		selfSay('Good bye. Recommend us, if you were satisfied with our service.')
		getNext()
	else
		unqueuePlayer(cid)
	end
end

function onCreatureMove(cid, oldPos, newPos)
	if (getNpcFocus() == cid) then
		faceCreature(cid)
		
		if (oldPos.z ~= newPos.z or getDistanceToCreature(cid) > 4) then
			selfSay('Good bye. Recommend us, if you were satisfied with our service.', _delay)
			getNext()
		end
	else
		if (oldPos.z ~= newPos.z or getDistanceToCreature(cid) > 4) then
			unqueuePlayer(cid)
		end
	end
end

function onCreatureSay(cid, type, msg)
	if (getNpcFocus() == 0) then
		if ((msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and getDistanceToCreature(cid) <= 4) then
			updateNpcIdle()
			setNpcFocus(cid)
			greet(cid, _delay)
		end
		
	elseif (getNpcFocus() ~= cid) then
		if ((msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and getDistanceToCreature(cid) <= 4) then
			selfSay('Just wait, ' .. getCreatureName(cid) .. '.', _delay)
			queuePlayer(cid)
		end
		
	else
		if (msgcontains(msg, 'bye')) then
			selfSay('Good bye. Recommend us, if you were satisfied with our service.', _delay)
			getNext()
		
		elseif (msgcontains(msg, 'name')) then
			_selfSay('My name is Captain Bluebear from the Royal Tibia Line.')
		
		elseif (msgcontains(msg, 'job') or msgcontains(msg, 'captain')) then
			_selfSay('I am the captain of this sailing-ship.')
		
		elseif (msgcontains(msg, 'ship') or msgcontains(msg, 'line') or
				msgcontains(msg, 'company') or msgcontains(msg, 'route') or
				msgcontains(msg, 'tibia')) then
			_selfSay('The Royal Tibia Line connects all seaside towns of Tibia.')
		
		elseif (msgcontains(msg, 'good')) then
			_selfSay('We can transport everything you want.')
		
		elseif (msgcontains(msg, 'passenger')) then
			_selfSay('We would like to welcome you on board.')
		
		elseif (msgcontains(msg, 'trip') or msgcontains(msg, 'passage') or
				msgcontains(msg, 'town') or msgcontains(msg, 'destinantion') or
				msgcontains(msg, 'sail') or msgcontains(msg, 'go')) then
			_selfSay('Where do you want to go? To Carlin, Ab\'Dendriel, Venore, Port Hope or Edron?')
		
		elseif (msgcontains(msg, 'ice') or msgcontains(msg, 'senja') or
				msgcontains(msg, 'folda') or msgcontains(msg, 'vega')) then
			_selfSay('I\'m sorry, but we don\'t serve the routes to the Ice Islands.')
		
		elseif (msgcontains(msg, 'darashia') or msgcontains(msg, 'darama')) then
			_selfSay('I\'m not sailing there. This route is afflicted by a ghostship! However I\'ve heard that Captain Fearless from Venore sails there.')
		
		elseif (msgcontains(msg, 'ghost')) then
			_selfSay('Many people who sailed to Darashia never returned because they were attacked by a ghostship! I\'ll never sail there!')
			
		elseif (msgcontains(msg, 'thais')) then
			_selfSay('This is Thais. Where do you want to go?')
			
		elseif (_state == 1) then
			if (msgcontains(msg, 'yes')) then
				if (not(hasCondition(cid, CONDITION_INFIGHT) == true)) then
					if (getPlayerMoney(cid) >= destinations[_index].price) then
						doPlayerRemoveMoney(cid, destinations[_index].price)
						_selfSay('Set the sails!')
						doSendMagicEffect(getCreaturePosition(cid), CONST_ME_ENERGYAREA)
						doTeleportThing(cid, destinations[_index].pos)
						doSendMagicEffect(getCreaturePosition(cid), CONST_ME_ENERGYAREA)
						getNext()
					else
						_selfSay('You don\'t have enough money.')
					end
				else
					_selfSay('First get rid of those blood stains! You are not going to ruin my vehicle!')
					getNext()
				end
			else
				selfSay('We would like to serve you some time.', _delay)
			end
			
			_state = 0
			
		else
			for n = 0, table.getn(destinations) do
				if (msgcontains(msg, destinations[n].name)) then
					_index = n
					_state = 1
					
					_selfSay('Do you seek a passage to ' .. destinations[_index].name .. ' for ' .. destinations[_index].price .. ' gold?')
					break
				end
			end
		end
	end
end

function onThink()
	if (getNpcFocus() ~= 0) then
		if (isNpcIdle()) then
			selfSay('Good bye. Recommend us, if you were satisfied with our service.', _delay)
			getNext()
		end
	end
end
 
Nottinghster put it somewhere on Otland. I think he's an author or this files is just copied from others version of Avesta.

Indeed they are from Avesta 0.2 or whatever version it was, and it was for Tibia 7.6 too with many bug fixes. This version can be found somewhere around an OpenTibia like websaite containing lots of Old Servers.
 
Back
Top