Ezzz
Developer of Nostalrius and The Violet Project
Does anyone have a guide to compile this in Linux?
Does anyone have a guide to compile this in Linux?
Npcs works fine. Mastercores doh, doesn't. Unless you modify the sources. There is info in the mastercores thread.
#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.
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?
<?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>
_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
<?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>
_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
lol I wonder what do you mean with "npcs don't work with mastercores".
Mastercores NPC's are using JIttos npc system.
Is source bug right?
When did I ever say it's bad?With my modified Avesta I use Jiddo's NPC System, what's so BAD about it? lol
Just compile your server with this files: npc.cpp & npc.hCan you give me info where i can get a compatible version? i have this version and isn't compatible NPC system for OpenTibia servers
Just compile your server with this files: npc.cpp & npc.h
SCAN: scan
And after it Jiddo NPC system will work fine.
Regards~
Nottinghster put it somewhere on Otland. I think he's an author or this files is just copied from others version of Avesta.Can I ask who made those NPC CPP files?
Nottinghster put it somewhere on Otland. I think he's an author or this files is just copied from others version of Avesta.
Probably someone in the mastercores team. As those files are from that release.Can I ask who made those NPC CPP files?