• 01-04.05.2026 - DOUBLE EXP / SKILL EVENT!

TheOracle [8.1][NPC]

Status
Zamknięty.

edziopedzio

User
Zarejestrowany
Dołączył
Kwiecień 15, 2008
Posty
21
Liczba reakcji
0
Robimy data/npc/scripts oracle.lua
Kod:
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)
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? Carlin, Thais or Venore.'})
local node2 = node1:addChildKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 5, destination = {x=703, y=600, z=7}, text = 'The carlin, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, 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)
local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)

local node2 = node1:addChildKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 3, destination = {x=712, y=1059, z=7}, text = 'The thais, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, 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)
local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)

local node2 = node1:addChildKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 4, destination = {x=1300, y=894, z=7}, text = 'The venore, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, 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)
local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
node3:addChildKeywordNode(yesNode)
node3:addChildKeywordNode(noNode)
local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? 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())


-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
i the oracle w data/npc/
Kod:
<npc name="The Oracle" script="data/npc/scripts/oracle.lua" autowalk="0" floorchange="0" access="5" level="1" maglevel="0">
<health now="150" max="150"/>
<look typeex="1448" corpse="2212"/>
<parameters>

</parameters>
</npc>
Skrypt by me (gg 10106053)
 
bardzo fajne 10/10 my?le ?e przyda si? to na wielu otsach (na moim r?wnierz)
Pozdrawiam.
Masiar
 
Dzieki bardzoo szukalem tego juz od dawana 10/10. Do tej poty nie mog?em tego nigdzie znale?? nawet jak wpisywa?em w "google" czy na tej stronie w obpcji "szukaj".
 
Ostatnia edycja:
dzieki tego potrzebowalem
PS. wie ktos zeby accmanager byl na rooku nie chcial o wybor profesji??
 
@up
Nieda rady chyba tego zrobi? ?eby AccManager nie chiac? wyboru profesji. Da si? chyba tylko przez AccMakera ale nie wiem jak przypuszczam ?e trzeba by?o by poszpera? w plikach serverowych albo w plikach od stronki.
@Topic
Ja powiem tak jak moi poprzednicy te? tego potrzebowa?em ale musze najpierw pomy?le? jak to zrobi?.
 
@up
polecam silnik TFS. tam jest taka opcja ;d
 
Dzi?ki za npc. Bardzo mi si? przyda?, bo zrobi?em niedawno rook na swoim ots i teraz umieszcze tam npc i bedzi? si? ju? mo?na przenosi? na main.
 
Skrpypt przyda si? wielu osobom. Z tego co widz? bardzo poprawny.
 
gratulacj?, naprawd? bardzo przydatny skrypcik. Ju? dodaje do otsika ;) 10/10

#Edit

Przechwali?em :-/ nie dzia?a mi w RME :-( pisze The Oracle klikam a nic si? nie pojawia. Help Me PLX!
 
Ostatnia edycja:
Npc Mi dziala ale jak wlaczam otsa to pisze ze cos w global musze zrobic Prosze o pomoc npc dziala ale go nie ma ;/
 
Mam ma?y problem z tym npc ...
Chyba niechce mi silnik go w czyta? ...
Oto ss :
hxxp://img212.imageshack.us/img212/4931/beztytuuid8.jpg
 
Mi tak samo jak u ciebie Bo mamy Devlanda trzeba cos zrobic ale sam nie wiem co ;/
 
gratulacj?, naprawd? bardzo przydatny skrypcik. Ju? dodaje do otsika ;) 10/10

#Edit

Przechwali?em :-/ nie dzia?a mi w RME :-( pisze The Oracle klikam a nic si? nie pojawia. Help Me PLX!
Bo RME nie jest najlepszym map edytorem ... sam wole tego zwyklego
Poza tym skrypcik dobry.dalem go mojemu koledze bo ja rooka nie mam ;);););););););)
 
Ja nie umiem tego robi?, jak kto? mo?e mi pom?c to niech pisze na gg 8827236.
 
A jak zmienic w nim zeby pisal inne miasta i do niego przenosil ???

pls o fast odp :)
 
Na wielu real otsach ten skrypt juz jest na reputa nie zasluzyles ale dla pustych ots moze sie pszydac scenografia fatalna ale dzianki temu masz punkt opis zero wychodzi na 5/10
 
Status
Zamknięty.
Back
Do góry