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

Lua King tibianus

data/npc/King Tibianus.xml

XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Tibianus" script="data/npc/scripts/promotion.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>


data/npc/scripts/promotion.lua

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

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
	node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())
 
[15/12/2010 13:14:31] data/talkactions/scripts/promote.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[15/12/2010 13:14:31] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/promote.lua)
 
ah lol, i changed it to
LUA:
<npc name="King Tibianus" script="data/npc/scripts/promote.lua" walkinterval="2000" floorchange="0">

[Error - LuaScriptInterface::loadFile] cannot open data/npc/scripts/promote.lua: No such file or directory
[15/12/2010 13:38:06] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/promote.lua
[15/12/2010 13:38:06] cannot open data/npc/scripts/promote.lua: No such file or directory

15/12/2010 13:37:35] data/talkactions/scripts/promote.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[15/12/2010 13:37:35] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/promote.lua)


LOL NVM, I DID PUT IT THE WRONG FOLDER LAWL.
 
Sorry for double post,try this:

data/npc/King Tibianus.xml

XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Tibianus" script="data/npc/scripts/Promotion.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="266" head="79" body="79" legs="79" feet="79" addons="0"/>
</npc>


data/npc/scripts/Promotion.lua

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

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())
 
well i got this now instead... with your script:

[15/12/2010 14:09:22] [Error - Npc interface]
[15/12/2010 14:09:22] data/npc/scripts/promotion.lua:onCreatureSay
[15/12/2010 14:09:22] Description:
[15/12/2010 14:09:22] data/npc/lib/npcsystem/modules.lua:80: attempt to compare nil with number
[15/12/2010 14:09:22] stack traceback:
[15/12/2010 14:09:22] data/npc/lib/npcsystem/modules.lua:80: in function 'callback'
[15/12/2010 14:09:22] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[15/12/2010 14:09:22] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[15/12/2010 14:09:22] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[15/12/2010 14:09:22] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'
[15/12/2010 14:09:22] data/npc/scripts/promotion.lua:7: in function <data/npc/scripts/promotion.lua:7>

i can't post the lib npcsystem since its to long lol
 
The Forgotten Server, version 0.3.6 (Crying Damson)


When i had the old system no errors were shown in the console, i'll show you the promotion.lua that were in use before yours.

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

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
	node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
	node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
	node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())


14:28 King Tibianus: I can promote you for 20000 gold coins. Do you want me to promote you?
14:28 Iskath [500]: yes
14:28 King Tibianus: Congratulations! You are now promoted.

i kept your King tibianus.xml and readded the first promotion.lua

it works now. Thanks man
 
Last edited:
Back
Top