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

Small fix for my Oracle

Sir MoX

New Member
Joined
Jan 14, 2009
Messages
285
Reaction score
1
Hello, I have a problem on my oracle I have modified and put the cities of my otserver but when I start the server all are working except the first one that is thais( when I says thais and the profession happens nothing) I hope sameone say me the problem =/ ok here the script:(I wish if someone can transform it to the new system of NPCs chat =)

<npc name="The Oracle" floorchange="0" walkinterval="0">
<health now="150" max="150"/>
<look typeex="1448"/>
<interaction range="3" idletime="30">
<interact keywords="hi" focus="1">
<!--These are the keywords will trigger this interaction-->
<keywords>hello</keywords>
<keywords>greet</keywords>

<response>
<action name="script">
<![CDATA[
if(getPlayerLevel(cid)) >= 8 then
selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?")
_state.b1 = (isPremium(cid) == TRUE)
_state.topic = 1
else
selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!")
_state.isidle = true
end
]]>
</action>
</response>
</interact>

<interact keywords="yes" topic="1">
<!--Premium account, b1 is set in above-->
<response b1="1" text="IN WHICH TOWN DO YOU WANT TO LIVE: Thais, Kosiji, Siria, Venriel or Asgard?">
<action name="topic" value="2"/>
</response>

<!--Normal account-->
<response text="IN WHICH TOWN DO YOU WANT TO LIVE: Thais, Kosiji, Siria, Venriel or Asgard?">
<action name="topic" value="2"/>
</response>
</interact>

<interact keywords="thais" topic="2">
<response text="iN The Misterious Thais! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
<!--n1: 1 = thais, 2 = kosiji, 3 = siria, 4 = venriel, 5 = Asgard-->
<action name="script">
<![CDATA[
_state.n1 = 1
_state.topic = 3
]]>
</action>
</response>
</interact>

<interact keywords="venriel" topic="2">
<response text="in the swapms of Venriel! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
<!--n1: 1 = thais, 2 = kosiji, 3 = siria, 4 = venriel, 5 = Asgard-->
<action name="script">
<![CDATA[
_state.n1 = 4
_state.topic = 3
]]>
</action>
</response>
</interact>

<interact keywords="siria" topic="2">
<response text="in the desert of Siria! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
<!--n1: 1 = thais, 2 = kosiji, 3 = siria, 4 = venriel, 5 = Asgard-->
<action name="script">
<![CDATA[
_state.n1 = 3
_state.topic = 3
]]>
</action>
</response>
</interact>

<interact keywords="kosiji" topic="2">
<response text="in the jungles of kosiji! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
<!--n1: 1 = thais, 2 = kosiji, 3 = siria, 4 = venriel, 5 = Asgard-->
<action name="script">
<![CDATA[
_state.n1 = 2
_state.topic = 3
]]>
</action>
</response>
</interact>


<interact keywords="Asgard" topic="2">
<response text="in the snow of Asgard! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
<!--n1: 1 = thais, 2 = kosiji, 3 = siria, 4 = venriel, 5 = Asgard-->
<action name="script">
<![CDATA[
_state.n1 = 5
_state.topic = 3
]]>
</action>
</response>
</interact>

<interact keywords="sexo analtopper" topic="2">
<response text="YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!">
<!--Set the topic back to 2, ie. choose a new town.-->
<action name="topic" value="2"/>
</response>
<!--b1: premium account, see <interact keywords="hi" focus="1"> where _state.b1 is is set.-->
<response b1="1" text="IN EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
<!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
<action name="script">
<![CDATA[
_state.n1 = 3
_state.topic = 3
]]>
</action>
</response>
</interact>

<!--If the player does not say any city, repeat our question-->
<interact keywords="|*|" topic="2">
<response b1="1" text="thais, Kosiji, siria, venriel or Asgard?"/>
<response text="thais, Kosiji, siria, Venriel or Asgard?"/>
</interact>

<interact keywords="sorcerer" topic="3">
<response text="A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 1
_state.topic = 4
]]>
</action>
</response>
</interact>

<interact keywords="druid" topic="3">
<response text="A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 2
_state.topic = 4
]]>
</action>
</response>
</interact>

<interact keywords="paladin" topic="3">
<response text="A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 3
_state.topic = 4
]]>
</action>
</response>
</interact>

<interact keywords="knight" topic="3">
<response text="A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 4
_state.topic = 4
]]>
</action>
</response>
</interact>

<!--If the player does not say any profession, repeat our question-->
<interact keywords="|*|" topic="3">
<response text="KNIGHT, PALADIN, SORCERER, OR DRUID?"/>
</interact>

<interact keywords="yes" topic="4">
<response>
<!--n1: 1 = thais, 2 = Kosiji, 3 = siria, 4 = venriel, 5 = Asgard-->
<!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid-->
<action name="script">
<![CDATA[
local pos = 0
if(_state.n1 == 1) then
pos = {x=1929, y=1385, z=7}
elseif(_state.n1 == 2) then
pos = {x=1206, y=1056, z=8}
elseif(_state.n1 == 3) then
pos = {x=1122, y=1514, z=6}
elseif(_state.n1 == 4) then
pos = {x=1085, y=1126, z=7}
elseif(_state.n1 == 5) then
pos = {x=1235, y=957, z=6}
else
selfSay("I DO NOT KNOW WHAT PROFESSION THAT IS, ASK THE GODS FOR GUIDANCE!")
return
end

selfSay("SO BE IT!")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

if(doTeleportThing(cid, pos) == 0) then
doPlayerSetTown(cid, _state.n1)
doPlayerSetVocation(cid, _state.n2)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
]]>
</action>
<action name="idle" value="1"/>
</response>
</interact>

<interact keywords="bye" focus="0">
<keywords>farewell</keywords>
<response text="Good bye. Recommend us, if you were satisfied with our service."/>
</interact>

<interact event="onBusy">
<response text="WAIT UNTIL IT IS YOUR TURN!">
<action name="addqueue" value="|PLAYER|"/>
</response>
</interact>

<!--This event triggers if the player goes to far away from the npc/logout/idle timeout-->
<interact event="onPlayerLeave" focus="0">
<response text="COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!"/>
</interact>
</interaction>
</npc>
 
A exemple of oracle .LUA:
Code:
 local internalCustomerQueue = {}
 local keywordHandler = KeywordHandler:new({root = {}})
 local npcHandler = ShopNpcHandler:new({})
 local customerQueue = CustomerQueue:new({customers = internalCustomerQueue, handler = npcHandler})
npcHandler:init(customerQueue, keywordHandler)
npcHandler.walkDistance = 0
 local voc = 0

function onThingMove(creature, thing, oldpos, oldstackpos)		npcHandler:onThingMove(creature, thing, oldpos, oldstackpos) end
function onCreatureAppear(creature)		npcHandler:onCreatureAppear(creature) end
function onCreatureDisappear(id)		npcHandler:onCreatureDisappear(id) end
function onCreatureTurn(creature)		npcHandler:onCreatureTurn(creature) end
function onCreatureSay(cid, type, msg)		npcHandler:onCreatureSay(cid, type, msg) end
function onCreatureChangeOutfit(creature)		npcHandler:onCreatureChangeOutfit(creature) end
function onThink()		npcHandler:onThink() end
function sayMessage(cid, message, keywords, parameters)		return npcHandler:defaultMessageHandler(cid, message, keywords, parameters) end

function greet(cid, message, keywords, parameters)
	if npcHandler.focus == cid then
	   selfSay('I am already talking to you.')
npcHandler.talkStart = os.clock()
	 elseif npcHandler.focus > 0 or not(npcHandler.queue:isEmpty()) then
	   selfSay('Please, ' .. creatureGetName(cid) .. '. Wait for your turn!.')
	if(not npcHandler.queue:isInQueue(cid)) then
npcHandler.queue:pushBack(cid)
end
	 elseif(npcHandler.focus == 0) and (npcHandler.queue:isEmpty()) then
	   selfSay(creatureGetName(cid) .. '! Are you prepared you face your destiny?')
npcHandler.focus = cid
 voc = 0
npcHandler.talkStart = os.clock()
 end
 return TRUE
end

function farewell(cid, message, keywords, parameters)		return npcHandler:defaultFarewellHandler(cid, message, keywords, parameters) end

function confirmAction(cid, message, keywords, parameters)
	if(cid ~= npcHandler.focus) then
 return FALSE
end
	if(keywords[1] == 'yes') then
	if(getPlayerLevel(cid) < 8) then
	   selfSay('You are not yet worthy. Come back when you are ready!')
npcHandler:resetNpc()
 voc = 0
 return TRUE
end
	if(voc == 0) then
	   selfSay('Allright then. What vocation do you wish to become? A sorcerer, druid, paladin or knight?')
    else
	   doPlayerSetVocation(npcHandler.focus,voc)
 local pos = { x=939, y=263, z=7 }
	   doPlayerSetMasterPos(npcHandler.focus,pos)
	   doTeleportThing(npcHandler.focus,pos)
 voc = 0
end
	 elseif(keywords[1] == 'no') then
	if(voc == 0) then
	   selfSay('Then come back when you are ready!')
npcHandler.focus = 0
 voc = 0
	if not(queue[1] == nil) then
greetNextCostumer(queue)
end
    else
	   selfSay('Allright then. What vocation do you wish to become? A sorcerer, druid, paladin or knight?')
 voc = 0
  end
 end
  return TRUE
end

function selectVocation(cid, message, keywords, parameters)
	if(cid ~= npcHandler.focus) then
	return FALSE
end
	   selfSay('Are you sure that you wish to become a ' .. keywords[1] .. '? This decition is irreversible!')
 voc = parameters.voc
 return TRUE
end

keywordHandler:addKeyword({'sorcerer'}, selectVocation, {voc = 1})
keywordHandler:addKeyword({'druid'}, selectVocation, {voc = 2})
keywordHandler:addKeyword({'paladin'}, selectVocation, {voc = 3})
keywordHandler:addKeyword({'knight'}, selectVocation, {voc = 4})
keywordHandler:addKeyword({'yes'}, confirmAction)
keywordHandler:addKeyword({'no'}, confirmAction)
keywordHandler:addKeyword({'hi'}, greet, nil)
keywordHandler:addKeyword({'hello'}, greet, nil)
keywordHandler:addKeyword({'hey'}, greet, nil)
keywordHandler:addKeyword({'bye'}, farewell, nil)
keywordHandler:addKeyword({'farewell'}, farewell, nil)
 
ok thanks bomba but how can i put the positions of the cities and all that in that or can you do it for me please or other?
 
I only need to someone fix or say me why when I say thais and the profession and then yes I happens nothing because I have view it and I dont unerstand why dont happens anything =/
 
Back
Top