Tibia.net.pl
| (#?)
| [8.1][NPC]TheOracleDyskusja dotycząca tematu [8.1][NPC]TheOracle, który znajduje się w kategorii Skrypty Lua & XML (Znajdują się tutaj potwory, NPC, itd. Publikacja tylko GOTOWYCH skryptów!), na forum NPC (). Treść: 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 ... | | |
17-04-2008, 14:30
|
| | Bywalec | [8.1][NPC]TheOracle
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) | |
| | |
17-04-2008, 14:37
|
| | Maniak |
bardzo fajne 10/10 myśle że przyda się to na wielu otsach (na moim równierz)
Pozdrawiam.
Masiar
| |
| | |
17-04-2008, 20:12
|
| | Gaduła |
Dzieki bardzoo szukalem tego juz od dawana 10/10.
| |
| | |
19-04-2008, 09:39
|
| | Ekspert |
o staryyy
wielkie dzięki
szukałem tego właścnie  | |
| | |
19-04-2008, 09:41
|
| | Bywalec |
dzieki tego potrzebowalem
PS. wie ktos zeby accmanager byl na rooku nie chcial o wybor profesji??
| |
| | |
19-04-2008, 11:40
|
| | Fanatyk |
@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ć.
| |
| | |
26-04-2008, 15:58
|
| | Maniak |
@up
polecam silnik TFS. tam jest taka opcja ;d
| |
| | |
26-04-2008, 17:06
|
| | Bywalec |
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.
| |
| | |
26-04-2008, 19:14
|
| | Pro Gangsta |
Skrpypt przyda się wielu osobom. Z tego co widzę bardzo poprawny.
| |
| | |
26-04-2008, 22:34
|
| | Początkujący |
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!
| |
| | |
29-04-2008, 19:03
|
| | Nowicjusz |
Npc Mi dziala ale jak wlaczam otsa to pisze ze cos w global musze zrobic Prosze o pomoc npc dziala ale go nie ma ;/
| |
| | |
29-04-2008, 19:05
|
| | Nowicjusz | Dobre
Dobre.. gratuluje za skrycik dobra robota x)
| |
| | |
30-04-2008, 07:44
|
| | Gaduła |
Mam mały problem z tym npc ...
Chyba niechce mi silnik go w czytać ...
Oto ss :
hxxp://img212.imageshack.us/img212/4931/beztytuuid8.jpg
| |
| | |
30-04-2008, 16:48
|
| | Nowicjusz |
Mi tak samo jak u ciebie Bo mamy Devlanda trzeba cos zrobic ale sam nie wiem co ;/
| |
| | |
03-05-2008, 23:21
|
| | Nowicjusz |
bardzo dobry script napewno mi sie przyda | |
| | | Narzędzia tematu | | | | Wygląd | Wygląd liniowy | | Tibia.net.pl: NPC () Temat: [8.1][NPC]TheOracle Robimy data/npc/scripts oracle.lua
Kod:
local LEVEL = 8
local keywordHandler [...] | Czasy w strefie GMT +1. Teraz jest 05:01. | | |