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(not npcHandler:isFocused(cid)) 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)
doTeleportThing(cid,destination,1)
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!', cid)
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? Edron?'})
local node2 = node1:addChildKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 1, destination = {x=248, y=114, z=8}, text = 'The city of Edron, 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())
----------------------------------------------------------Made By MokerHamer----------------------------------------------
--------------------Special Thanks to: Talaturen and Jiddo without them i coulden't have done this!------------------
------------------------------------------NOTE* THIS SCRIPT MAY ONLY BE RELEASED ON WWW.OTLAND.NET ONLY---------------------
------------------------------------This Script is specialde made for World Of Tramon V8.0-----------------------------
-----------------------------------------------------World Of Tramon Link: None Yet--------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
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
---------Begin-Dont--Tough!--Noob--censative
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local count = (getCount(msg))
local oldcount = getPlayerStorageValue(cid, 300)
if(oldcount == -1) then
oldcount = 0
end
---------End-Dont--Tough!--Noob--censative
---------------Begin Crap that u can change it if u want-----------------------
bank_need_premium = 'Sorry, You need premium account to use the bank.'
low_money_deposit = 'You do not have enough money in your deposit to withdraw, '..count..' Gold Pieces. '
lost_track = 'Huh, What are you talking about?'
if msgcontains(msg, 'banker') then
selfSay('Hello. How can I help you? If you need some help just say information')
elseif msgcontains(msg, 'information') then
selfSay('Hello i am the city banker, you can do many things here like, Check your balance deposit and even withdraw!')
---------------End Crap that u can change it if u want
-------------------------------------------------------------Begin of the Banker script---------------------------------------
------------------------Begin!--deposit--Crap----
elseif msgcontains(msg, 'deposit') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('How mutch would u like to deposit?')
talk_state = 1
else
selfSay(bank_need_premium)
talk_state = 0
end
---deposit--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 1 then
talk_state = 0
if doPlayerRemoveMoney(cid, count) == TRUE then
setPlayerStorageValue(cid,300, oldcount+count)
selfSay('You have successfully deposit '..count..' Gold Pieces')
else
selfSay(lost_track)
end
------------------------End!--deposit--Crap----
------------------------Begin!--Balance--Crap----
elseif msgcontains(msg, 'balance') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('do u want to check your balance?')
talk_state = 2
else
selfSay(bank_need_premium)
talk_state = 0
end
---Balance--Confurm--Yes
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,300, oldcount) then
if(oldcount == -1) then
oldcount = 0
end
selfSay('You have '..oldcount..' Gold Pieces deposit.')
else
selfSay(lost_track)
end
------------------------End!--Balance--Crap----
------------------------Begin!--withdraw--Crap----
elseif msgcontains(msg, 'withdraw') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('How mutch would u like to withdraw?')
talk_state = 3
else
selfSay(bank_need_premium)
talk_state = 0
end
---withdraw--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 3 then
talk_state = 0
if count <= oldcount then
setPlayerStorageValue(cid,300, oldcount-count)
doPlayerAddMoney(cid, count)
selfSay('You have successfully withdrawed '..count..' Gold Pieces.')
else
selfSay(low_money_deposit)
end
------------------------End!--withdraw--Crap----
---No--To--All
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
selfSay('Why the fuck dit you start this conversation anywais?')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
The thing is that i don't get a error.. The icicles doesn't show up on the trade window ;/Don't send only the line, send the complete loop or file.
<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">
<!--
if(getPlayerVocation(cid) ~= 0) then
selfSay("SORRY, YOU HAVE ALREADY MADE YOUR CHOICE IN LIFE!")
_state.isidle = true
return
end
-->
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">
_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">
_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">
_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">
_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">
_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">
_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">
_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">
_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">
local pos = 0
if(_state.n1 == 1) then
pos = {x=180, y=233, 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
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>
<!--
If the event onBusy exists, the npc will make a queue like Tibia, if the event is removed
the npc will be able to talk to all customers at the same time without problems.
-->
<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>
[14/08/2008 10:33:36] The Forgotten Server - Version 0.2 (Mystic Spirit).
[14/08/2008 10:33:36] A server developed by Talaturen, Kiper, Kornholijo, Jonern, Lithium & Elf.
[14/08/2008 10:33:36] Visit our forum for updates, support and resources: http://otland.net/.
[14/08/2008 10:33:36] >> Loading config
[14/08/2008 10:33:36] >> Loading RSA key
[14/08/2008 10:33:36] >> Testing SQL connection... MySQL.
[14/08/2008 10:33:37] >> Loading bans
[14/08/2008 10:33:37] >> Loading vocations
[14/08/2008 10:33:37] >> Loading commands
[14/08/2008 10:33:37] >> Loading items
[14/08/2008 10:33:38] >> Loading script systems
[14/08/2008 10:33:40] >> Loading monsters
[14/08/2008 10:33:46] >> Loading outfits
[14/08/2008 10:33:46] >> Loading admin protocol config
[14/08/2008 10:33:46] >> Loading experience stages
[14/08/2008 10:33:46] >> Using plaintext passwords
[14/08/2008 10:33:46] >> Checking world type... PVP
[14/08/2008 10:33:46] >> Loading map
[14/08/2008 10:33:47] > Map size: 1000x1000.
[14/08/2008 10:33:47] Warning: [OTBM loader] Moveable item in house id = 30 Item type = 1728
[14/08/2008 10:33:47] Warning: [OTBM loader] Moveable item in house id = 30 Item type = 1616
[14/08/2008 10:33:47] Warning: [OTBM loader] Moveable item in house id = 30 Item type = 1736
[14/08/2008 10:33:47] Warning: [OTBM loader] Moveable item in house id = 30 Item type = 1650
[14/08/2008 10:33:48] Warning: [OTBM loader] Moveable item in house id = 1 Item type = 1714
[14/08/2008 10:33:48] Warning: [OTBM loader] Moveable item in house id = 4 Item type = 1716
[14/08/2008 10:33:48] Warning: [OTBM loader] Moveable item in house id = 2 Item type = 1714
[14/08/2008 10:33:48] Warning: [OTBM loader] Moveable item in house id = 20 Item type = 1714
[14/08/2008 10:33:48] Warning: [OTBM loader] Moveable item in house id = 5 Item type = 1716
[14/08/2008 10:33:48] Warning: [OTBM loader] Moveable item in house id = 24 Item type = 1716
[14/08/2008 10:33:49] > Map loading time: 2.474 seconds.
[14/08/2008 10:33:50] >> Setting gamestate to: GAME_STATE_INIT
[14/08/2008 10:33:50] Lua Script Error: [Npc interface]
[14/08/2008 10:33:50] data/npc/scripts/loot.luanCreatureAppear
[14/08/2008 10:33:50] data/npc/scripts/loot.lua:8: attempt to call global 'npcHandlerOnCreatureAppear' (a nil value)
[14/08/2008 10:33:51] stack traceback:
[14/08/2008 10:33:51] data/npc/scripts/loot.lua:8: in function <data/npc/scripts/loot.lua:8>
[14/08/2008 10:33:51] >> All modules has been loaded, server starting up...
[14/08/2008 10:33:51] >> Pluto Server Online!
[14/08/2008 10:33:51] Lua Script Error: [Npc interface]
[14/08/2008 10:33:51] data/npc/scripts/loot.luanThink
[14/08/2008 10:33:52] data/npc/scripts/loot.lua:11: attempt to call global 'npcHandlerOnThink' (a nil value)
[14/08/2008 10:33:52] stack traceback:
[14/08/2008 10:33:52] data/npc/scripts/loot.lua:11: in function <data/npc/scripts/loot.lua:11>
I get an error when loading my loot script NPC.
----------------------------------------------------------Made By MokerHamer----------------------------------------------
--------------------Special Thanks to: Talaturen and Jiddo without them i coulden't have done this!------------------
------------------------------------------NOTE* THIS SCRIPT MAY ONLY BE RELEASED ON WWW.OTLAND.NET ONLY---------------------
------------------------------------This Script is specialde made for World Of Tramon V8.0-----------------------------
-----------------------------------------------------World Of Tramon Link: None Yet--------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
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
---------Begin-Dont--Tough!--Noob--censative
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local count = (getCount(msg))
local oldcount = getPlayerStorageValue(cid, 300)
if(oldcount == -1) then
oldcount = 0
end
---------End-Dont--Tough!--Noob--censative
---------------Begin Crap that u can change it if u want-----------------------
bank_need_premium = 'Sorry, You need premium account to use the bank.'
low_money_deposit = 'You do not have enough money in your deposit to withdraw, '..count..' Gold Pieces. '
lost_track = 'Huh, What are you talking about?'
if msgcontains(msg, 'banker') then
selfSay('Hello. How can I help you? If you need some help just say information')
elseif msgcontains(msg, 'information') then
selfSay('Hello i am the city banker, you can do many things here like, Check your balance deposit and even withdraw!')
---------------End Crap that u can change it if u want
-------------------------------------------------------------Begin of the Banker script---------------------------------------
------------------------Begin!--deposit--Crap----
elseif msgcontains(msg, 'deposit') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('How mutch would u like to deposit?')
talk_state = 1
else
selfSay(bank_need_premium)
talk_state = 0
end
---deposit--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 1 then
talk_state = 0
if doPlayerRemoveMoney(cid, count) == TRUE then
setPlayerStorageValue(cid,300, oldcount+count)
selfSay('You have successfully deposit '..count..' Gold Pieces')
else
selfSay(lost_track)
end
------------------------End!--deposit--Crap----
------------------------Begin!--Balance--Crap----
elseif msgcontains(msg, 'balance') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('do u want to check your balance?')
talk_state = 2
else
selfSay(bank_need_premium)
talk_state = 0
end
---Balance--Confurm--Yes
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,300, oldcount) then
if(oldcount == -1) then
oldcount = 0
end
selfSay('You have '..oldcount..' Gold Pieces deposit.')
else
selfSay(lost_track)
end
------------------------End!--Balance--Crap----
------------------------Begin!--withdraw--Crap----
elseif msgcontains(msg, 'withdraw') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('How mutch would u like to withdraw?')
talk_state = 3
else
selfSay(bank_need_premium)
talk_state = 0
end
---withdraw--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 3 then
talk_state = 0
if count <= oldcount then
setPlayerStorageValue(cid,300, oldcount-count)
doPlayerAddMoney(cid, count)
selfSay('You have successfully withdrawed '..count..' Gold Pieces.')
else
selfSay(low_money_deposit)
end
------------------------End!--withdraw--Crap----
---No--To--All
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
selfSay('Why the fuck dit you start this conversation anywais?')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
[14/08/2008 12:17:54] Lua Script Error: [Npc interface]
[14/08/2008 12:17:54] data/npc/scripts/addons.luanCreatureSay
[14/08/2008 12:17:54] data/npc/lib/npcsystem/npchandler.lua:563: table index is nil
[14/08/2008 12:17:54] stack traceback:
[14/08/2008 12:17:54] data/npc/lib/npcsystem/npchandler.lua:563: in function 'say'
[14/08/2008 12:17:54] data/npc/scripts/addons.lua:49: in function 'callback'
[14/08/2008 12:17:54] data/npc/lib/npcsystem/npchandler.lua:365: in function 'onCreatureSay'
[14/08/2008 12:17:54] data/npc/scripts/addons.lua:7: in function <data/npc/scripts/addons.lua:7>
got much problems with the npc system.
Would it be still save, when I use the old npc system (8.00)?