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

[8.22] Potrzebuje dzialajacego oracle

nurgiel

New Member
Joined
Jul 5, 2008
Messages
43
Solutions
2
Reaction score
1
Location
Poland
otoz na najnowszym TFS nie dziala oracle,gdy mowi koncowa kwestie typu "jestes zdecydowany itp." mowie "yes" to on znow wraca do momentu jakie miasto wybieram.oto 2 skrypty ktore nie dzialaja

HTML:
<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-->
			<keywordss>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: CARLIN, EDRON, THAIS, OR VENORE?">
				<action name="topic" value="2"/>
			</response>

			<!--Normal account-->
			<response text="IN WHICH TOWN DO YOU WANT TO LIVE: CARLIN, THAIS, OR VENORE?">
				<action name="topic" value="2"/>
			</response>
		</interact>

		<interact keywords="carlin" topic="2">
			<response text="IN CARLIN! 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 = 1
						_state.topic = 3
					]]>
				</action>
			</response>
		</interact>

		<interact keywords="thais" topic="2">
			<response text="IN THAIS! 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 = 2
						_state.topic = 3
					]]>
				</action>
			</response>
		</interact>

		<interact keywords="venore" topic="2">
			<response text="IN VENORE! 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>

		<interact keywords="edron" 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="CARLIN, EDRON, THAIS, OR VENORE?"/>
			<response text="CARLIN, EDRON, THAIS, OR VENORE?"/>
		</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 = 17
						_state.topic = 1
					]]>
				</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 = carlin, 2 = edron, 3 = thais, 4 = venore-->
				<!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid-->
				<action name="script">
					<![CDATA[
						local pos = 0
						if(_state.n1 == 1) then
							pos = {x=60, y=60, z=7}
						elseif(_state.n1 == 2) then
							pos = {x=180, y=233, z=7}
						elseif(_state.n1 == 3) then
							pos = {x=180, y=233, z=7}
						elseif(_state.n1 == 4) then
							pos = {x=180, y=233, z=7}
						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>

HTML:
local LEVEL = 8

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 						npcHandler:onThink() end
-- OTServ event handling functions end


function oracle(cid, message, keywords, parameters, node)
	if(cid ~= npcHandler.focus) then
		return false
	end
	
	local cityNode = node:getParent():getParent()
	local vocNode = node:getParent()
	
	local destination = cityNode:getParameters().destination
	local townid = cityNode:getParameters().townid
	local voc = vocNode:getParameters().voc
	
	if(destination ~= nil and voc ~= nil and townid ~= nil) then
		if(getPlayerLevel(cid) < parameters.level) then
			npcHandler:say('You must first reach level ' .. parameters.level .. '!')
		else
			doPlayerSetVocation(cid,voc)
			doPlayerSetTown(cid,townid)
			--doPlayerSetMasterPos(cid,destination)
        	doTeleportThing(cid,destination, 0)
        end
	else
		error('Destination:', destination, 'Vocation:', vocation, 'Townid:', townid)
	end
	npcHandler:resetNpc()
	return true
end


function greetCallback(cid)
	if(getPlayerLevel(cid) < LEVEL) then
		npcHandler:say('CHILD! COME BACK WHEN YOU HAVE GROWN UP!')
		return false
	else
		return true
	end
end

-- Set the greeting callback function
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

-- Set the greeting message.
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Are you prepared to face your destiny?')

-- Pre-create the yes/no nodes.
local yesNode = KeywordNode:new({'yes'}, oracle, {level = LEVEL})
local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what vocation do you want to become?'})

-- Create the actual keyword structure...
local node1 = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'What city do you wish to live in? Thais, Carlin, Edron, Venore?'})
	local node2 = node1:addChildKeyword({'ogrimmar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 6, destination = {x=17, y=97, z=7}, text = 'Thais, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
		local node3 = node2:addChildKeyword({'thief'}, StdModule.say, {npcHandler = npcHandler, voc = 17, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)

keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then come back when you are ready.'})

-- Make it react to hi/bye etc.
npcHandler:addModule(FocusModule:new())

problem nie rozwiazany,lecz nie wazny
 
Last edited:
Back
Top