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

NPC Promotion

Metem

C#, C++, PHP programmer
Joined
Jun 7, 2008
Messages
38
Reaction score
0
Location
Poland
I have promotion npc but it is buged can somebody help me?

Bug:

Code:
[13/12/2008 14:44:23] Lua Script Error: [Npc interface] 
[13/12/2008 14:44:23] data/npc/scripts/promotion2.lua

[13/12/2008 14:44:23] luaGetPlayerStorageValue(). Player not found
Code:
[13/12/2008 14:44:23] Lua Script Error: [Npc interface] 
[13/12/2008 14:44:23] data/npc/scripts/promotion2.lua

[13/12/2008 14:44:23] data/npc/lib/npcsystem/npchandler.lua:576: table index is nil
[13/12/2008 14:44:23] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/promotion2.lua

Code:
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({'destiny'})

if (getPlayerStorageValue(cid, 42355) == 3) and (getPlayerStorageValue(cid, 7416) == 2) then
npcHandler:say("You made arena quest and defeat undead dragon. I can show you your destiny if you want, only for 200k.", cid) 
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now ' .. getPlayerPromotionLevel(cid) .. '.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
else
npcHandler:say("Sorry, but I do not remember you...", cid) 
end

npcHandler:addModule(FocusModule:new())
 
try

Code:
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({'destiny'})

if getPlayerStorageValue(cid, 42355) == 3 and getPlayerStorageValue(cid, 7416) == 2 then
npcHandler:say("You made arena quest and defeat undead dragon. I can show you your destiny if you want, only for 200k.", cid) 
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now ' .. getPlayerPromotionLevel(cid) .. '.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
else
npcHandler:say("Sorry, but I do not remember you...", cid) 
end

npcHandler:addModule(FocusModule:new())


Or use this the basic promotion script

Code:
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())
 
try

Code:
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({'destiny'})

if getPlayerStorageValue(cid, 42355) == 3 and getPlayerStorageValue(cid, 7416) == 2 then
npcHandler:say("You made arena quest and defeat undead dragon. I can show you your destiny if you want, only for 200k.", cid) 
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now ' .. getPlayerPromotionLevel(cid) .. '.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
else
npcHandler:say("Sorry, but I do not remember you...", cid) 
end

npcHandler:addModule(FocusModule:new())


Or use this the basic promotion script

Code:
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())

Lol?

He have to edit onCreatureSay callback.
 
Last edited by a moderator:
What he will learn from your example? All you did was to remove ( ), so it still will not work :O!
 
Back
Top