D
Deleted member 49793
Guest
Hey as the title says im looking for a working oracle script, the one i have doesnt work (basic comes with tfs) anyone got one?
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic, vocation = {}, {}
local town = 2 -- ID of the town
local destination = {x=100, y=100, z=7}
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
function greetCallback(cid)
if(getPlayerLevel(cid) < 8) then
npcHandler:say("CHILD! COME BACK WHEN YOU HAVE GROWN UP!", cid)
return false
else
Topic[cid], vocation[cid] = 0, 0
return true
end
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "yes") and Topic[cid] == 0 then
npcHandler:say("WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
Topic[cid] = 1
elseif msgcontains(msg, "sorcerer") and Topic[cid] == 1 then
npcHandler:say("A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
Topic[cid] = 2
vocation[cid] = 1
elseif msgcontains(msg, "druid") and Topic[cid] == 1 then
npcHandler:say("A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
Topic[cid] = 2
vocation[cid] = 2
elseif msgcontains(msg, "paladin") and Topic[cid] == 1 then
npcHandler:say("A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
Topic[cid] = 2
vocation[cid] = 3
elseif msgcontains(msg, "knight") and Topic[cid] == 1 then
npcHandler:say("A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
Topic[cid] = 2
vocation[cid] = 4
elseif Topic[cid] == 1 then
npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
Topic[cid] = 2
elseif msgcontains(msg, "yes") and Topic[cid] == 2 then
npcHandler:say("SO BE IT!", cid)
Topic[cid] = nil
doPlayerSetVocation(cid, vocation[cid])
doPlayerSetTown(cid, town)
npcHandler:releaseFocus(cid)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, destination)
doSendMagicEffect(destination, CONST_ME_TELEPORT)
elseif Topic[cid] == 3 then
npcHandler:unGreet(cid)
Topic[cid] = nil
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|, ARE YOU PREPARED TO FACE YOUR DESTINY?")
npcHandler:setMessage(MESSAGE_WALKAWAY, "COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!")
npcHandler:setMessage(MESSAGE_FAREWELL, "COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!")
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())