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

Rune NPC

AnDy1990

New Member
Joined
Mar 6, 2008
Messages
104
Reaction score
0
Hi I get this when I try to buy from my rune npc..

Lua Script Error: [Npc interface]
data/npc/scripts/runes.lua:eek:nCreatureSay

luaDoCreateItem(). can not add item

Im using TFS 0.2.10

this is the runes.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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'health potion', 'health potion'}, 		7618, 180, 		'health potion')
shopModule:addBuyableItem({'mana potion', 'mana potion'}, 		7620, 55, 	7, 	'mana potion')
shopModule:addBuyableItem({'great health potion', 'great health potion'}, 		7591, 50, 	10,	'greater health potion')
shopModule:addBuyableItem({'strong health potion', 'strong health potion'}, 		7588, 500, 		'strong health potion')
shopModule:addBuyableItem({'strong mana potion', 'strong mana potion'}, 		7589, 55, 	7, 	'strong mana potion')
shopModule:addBuyableItem({'great mana potion', 'great mana potion'}, 		7590, 50, 	10,	'great mana potion')

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 				2187, 15000, 	'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 				2188, 5000, 	'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 			2189, 10000,	'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 				2190, 500, 	'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 			2191, 1000, 	'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 				2181, 10000, 	'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 				2182, 500, 	'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'}, 					2183, 15000, 	'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 				2185, 5000, 	'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 				2186, 1000,   	'moonlight rod')

function creatureSayCallback(cid, type, msg)
	if(npcHandler.focus ~= cid) then
		return FALSE
	end
	if msgcontains(msg, 'runes') then
		selfSay("I sell heavy magic missiles runes, explosion runes, great fireball runes, ultimate healing runes and sudden death runes.")
		talk_state = 0
	elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'hmm') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 15*charges
		selfSay('Do you want a heavy magic missile rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2311
	elseif msgcontains(msg, 'great fireball') or msgcontains(msg, 'gfb') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 25*charges
		selfSay('Do you want a great fireball rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2304
	elseif msgcontains(msg, 'explosion') or msgcontains(msg, 'xpl') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 40*charges
		selfSay('Do you want an explosion rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2313
	elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'uh') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 35*charges
		selfSay('Do you want an ultimate healing rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2273
	elseif msgcontains(msg, 'sudden death') or msgcontains(msg, 'sd') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 50*charges
		selfSay('Do you want a sudden death rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2268
	elseif msgcontains(msg, 'yes') and talk_state == 1 then
		if doPlayerRemoveMoney(cid, price) == TRUE then
			doPlayerGiveItem(cid, itemid, 1, charges)
			selfSay("You have bought this rune.")
			talk_state = 0
		else
			selfSay("You don't have enough money.")
			talk_state = 0
		end
	elseif msgcontains(msg, 'no') and talk_state == 1 then
		selfSay("Then not.")
		talk_state = 0
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Change "doPlayerGiveItem(cid, itemid, 1, charges)" to "doPlayerAddItem(cid, itemid, 1, charges)"
 
Last edited:
now I get this

LuadoPlayerAddItem(). Player not found


any1 know how to fix this now? :/ my server dont got a rune npc so its kinda critical :p
 
Last edited:
I'll check it out a little closer.

EDIT: Try this one:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'health potion', 'health potion'},         7618, 180,         'health potion')
shopModule:addBuyableItem({'mana potion', 'mana potion'},         7620, 55,     7,     'mana potion')
shopModule:addBuyableItem({'great health potion', 'great health potion'},         7591, 50,     10,    'greater health potion')
shopModule:addBuyableItem({'strong health potion', 'strong health potion'},         7588, 500,         'strong health potion')
shopModule:addBuyableItem({'strong mana potion', 'strong mana potion'},         7589, 55,     7,     'strong mana potion')
shopModule:addBuyableItem({'great mana potion', 'great mana potion'},         7590, 50,     10,    'great mana potion')

shopModule:addBuyableItem({'wand of inferno', 'inferno'},                 2187, 15000,     'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'},                 2188, 5000,     'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'},             2189, 10000,    'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'},                 2190, 500,     'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'},             2191, 1000,     'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'},                 2181, 10000,     'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'},                 2182, 500,     'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'},                     2183, 15000,     'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'},                 2185, 5000,     'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'},                 2186, 1000,       'moonlight rod')

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return FALSE
    end
    if msgcontains(msg, 'runes') then
        selfSay("I sell heavy magic missiles runes, explosion runes, great fireball runes, ultimate healing runes and sudden death runes.")
        talk_state = 0
    elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'hmm') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 15*charges
        selfSay('Do you want a heavy magic missile rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2311
    elseif msgcontains(msg, 'great fireball') or msgcontains(msg, 'gfb') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 25*charges
        selfSay('Do you want a great fireball rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2304
    elseif msgcontains(msg, 'explosion') or msgcontains(msg, 'xpl') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 40*charges
        selfSay('Do you want an explosion rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2313
    elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'uh') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 35*charges
        selfSay('Do you want an ultimate healing rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2273
    elseif msgcontains(msg, 'sudden death') or msgcontains(msg, 'sd') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 50*charges
        selfSay('Do you want a sudden death rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2268
    end
        
    if msgcontains(msg, 'yes') and talk_state == 1 then
        if doPlayerRemoveMoney(cid, price) == TRUE then
            doPlayerAddItem(cid, itemid, 1, charges)
            selfSay("You have bought this rune.")
            talk_state = 0
        else
            selfSay("You don't have enough money.")
            talk_state = 0
        end
    end
        
    if msgcontains(msg, 'no') and talk_state == 1 then
        selfSay("Then not.")
        talk_state = 0
    end
    return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
I'll check it out a little closer.

EDIT: Try this one:
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'health potion', 'health potion'},         7618, 180,         'health potion')
shopModule:addBuyableItem({'mana potion', 'mana potion'},         7620, 55,     7,     'mana potion')
shopModule:addBuyableItem({'great health potion', 'great health potion'},         7591, 50,     10,    'greater health potion')
shopModule:addBuyableItem({'strong health potion', 'strong health potion'},         7588, 500,         'strong health potion')
shopModule:addBuyableItem({'strong mana potion', 'strong mana potion'},         7589, 55,     7,     'strong mana potion')
shopModule:addBuyableItem({'great mana potion', 'great mana potion'},         7590, 50,     10,    'great mana potion')

shopModule:addBuyableItem({'wand of inferno', 'inferno'},                 2187, 15000,     'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'},                 2188, 5000,     'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'},             2189, 10000,    'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'},                 2190, 500,     'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'},             2191, 1000,     'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'},                 2181, 10000,     'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'},                 2182, 500,     'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'},                     2183, 15000,     'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'},                 2185, 5000,     'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'},                 2186, 1000,       'moonlight rod')

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return FALSE
    end
    if msgcontains(msg, 'runes') then
        selfSay("I sell heavy magic missiles runes, explosion runes, great fireball runes, ultimate healing runes and sudden death runes.")
        talk_state = 0
    elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'hmm') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 15*charges
        selfSay('Do you want a heavy magic missile rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2311
    elseif msgcontains(msg, 'great fireball') or msgcontains(msg, 'gfb') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 25*charges
        selfSay('Do you want a great fireball rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2304
    elseif msgcontains(msg, 'explosion') or msgcontains(msg, 'xpl') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 40*charges
        selfSay('Do you want an explosion rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2313
    elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'uh') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 35*charges
        selfSay('Do you want an ultimate healing rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2273
    elseif msgcontains(msg, 'sudden death') or msgcontains(msg, 'sd') and ShopModule:getCount(msg) <= 100 then
        charges = ShopModule:getCount(msg)
        price = 50*charges
        selfSay('Do you want a sudden death rune with '..charges..' charges for '..price..' gold coins?')
        talk_state = 1
        itemid = 2268
    end
        
    if msgcontains(msg, 'yes') and talk_state == 1 then
        if doPlayerRemoveMoney(cid, price) == TRUE then
            doPlayerAddItem(cid, itemid, 1, charges)
            selfSay("You have bought this rune.")
            talk_state = 0
        else
            selfSay("You don't have enough money.")
            talk_state = 0
        end
    end
        
    if msgcontains(msg, 'no') and talk_state == 1 then
        selfSay("Then not.")
        talk_state = 0
    end
    return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Still get this
luaDoPlayerAdditem(). Player not found.
 
Still get this
luaDoPlayerAdditem(). Player not found.

The reason why you are getting the error is that he dident define UID as u can see.
doPlayerAddItem(uid, itemid, <optional> count/subtype)


Try this

Code:
		    doPlayerGiveItem(cid, itemid, charges)


as u can see i removed the count.. Altought it dosen't matter since it automaticly says it's 1 =)
 
Last edited:
The reason why you are getting the error is that he dident define UID as u can see.
doPlayerAddItem(uid, itemid, <optional> count/subtype)


Try this

Code:
		    doPlayerGiveItem(cid, itemid, charges)


as u can see i removed the count.. Altought it dosen't matter since it automaticly says it's 1 =)

so it would look like this?

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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'health potion', 'health potion'}, 		7618, 180, 		'health potion')
shopModule:addBuyableItem({'mana potion', 'mana potion'}, 		7620, 55, 	7, 	'mana potion')
shopModule:addBuyableItem({'great health potion', 'great health potion'}, 		7591, 50, 	10,	'greater health potion')
shopModule:addBuyableItem({'strong health potion', 'strong health potion'}, 		7588, 500, 		'strong health potion')
shopModule:addBuyableItem({'strong mana potion', 'strong mana potion'}, 		7589, 55, 	7, 	'strong mana potion')
shopModule:addBuyableItem({'great mana potion', 'great mana potion'}, 		7590, 50, 	10,	'great mana potion')

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 				2187, 15000, 	'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 				2188, 5000, 	'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 			2189, 10000,	'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 				2190, 500, 	'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 			2191, 1000, 	'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 				2181, 10000, 	'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 				2182, 500, 	'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'}, 					2183, 15000, 	'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 				2185, 5000, 	'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 				2186, 1000,   	'moonlight rod')

function creatureSayCallback(cid, type, msg)
	if(npcHandler.focus ~= cid) then
		return FALSE
	end
	if msgcontains(msg, 'runes') then
		selfSay("I sell heavy magic missiles runes, explosion runes, great fireball runes, ultimate healing runes and sudden death runes.")
		talk_state = 0
	elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'hmm') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 15*charges
		selfSay('Do you want a heavy magic missile rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2311
	elseif msgcontains(msg, 'great fireball') or msgcontains(msg, 'gfb') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 25*charges
		selfSay('Do you want a great fireball rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2304
	elseif msgcontains(msg, 'explosion') or msgcontains(msg, 'xpl') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 40*charges
		selfSay('Do you want an explosion rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2313
	elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'uh') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 35*charges
		selfSay('Do you want an ultimate healing rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2273
	elseif msgcontains(msg, 'sudden death') or msgcontains(msg, 'sd') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 50*charges
		selfSay('Do you want a sudden death rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2268
	elseif msgcontains(msg, 'yes') and talk_state == 1 then
		if doPlayerRemoveMoney(cid, price) == TRUE then
		    doPlayerGiveItem(cid, itemid, charges)
			selfSay("You have bought this rune.")
			talk_state = 0
		else
			selfSay("You don't have enough money.")
			talk_state = 0
		end
	elseif msgcontains(msg, 'no') and talk_state == 1 then
		selfSay("Then not.")
		talk_state = 0
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Here is my script again
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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'health potion', 'health potion'}, 			7618, 20, 		'health potion')
shopModule:addBuyableItem({'strong health potion', 'strong health potion'}, 7588, 40, 		'strong health potion')
shopModule:addBuyableItem({'great health potion', 'great health potion'}, 	7591, 80, 		'great health potion')

shopModule:addBuyableItem({'mana potion', 'mana potion'}, 				7620, 20, 		'mana potion')
shopModule:addBuyableItem({'strong mana potion', 'mana potion'}, 		7589, 40, 		'strong mana potion')
shopModule:addBuyableItem({'great mana potion', 'mana potion'}, 		7590, 80, 		'great mana potion')

shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 				2187, 15000, 	'wand of inferno')
shopModule:addBuyableItem({'wand of plague', 'plague'}, 				2188, 5000, 	'wand of plague')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 	2189, 10000,	'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 				2190, 500, 		'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 	2191, 1000, 	'wand of dragonbreath')
shopModule:addBuyableItem({'magic wall', 'magic wall'},					2293, 40,3,		'magic wall rune')
shopModule:addBuyableItem({'blank rune', 'blank rune'},					2260, 40,1,		'magic wall rune')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'}, 				2181, 10000, 	'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 				2182, 500, 		'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'}, 					2183, 15000, 	'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'}, 				2185, 5000, 	'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 				2186, 1000,   	'moonlight rod')

function creatureSayCallback(cid, type, msg)
	if(npcHandler.focus ~= cid) then
		return FALSE
	end
	if msgcontains(msg, 'runes') then
		selfSay("I sell heavy magic missiles runes, explosion runes, great fireball runes, ultimate healing runes and sudden death runes.")
		talk_state = 0
	elseif msgcontains(msg, 'heavy magic missile') or msgcontains(msg, 'hmm') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 15*charges
		selfSay('Do you want a heavy magic missile rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2311
	elseif msgcontains(msg, 'great fireball') or msgcontains(msg, 'gfb') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 25*charges
		selfSay('Do you want a great fireball rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2304
	elseif msgcontains(msg, 'explosion') or msgcontains(msg, 'xpl') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 40*charges
		selfSay('Do you want an explosion rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2313
	elseif msgcontains(msg, 'ultimate healing') or msgcontains(msg, 'uh') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 35*charges
		selfSay('Do you want an ultimate healing rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2273
	elseif msgcontains(msg, 'sudden death') or msgcontains(msg, 'sd') and ShopModule:getCount(msg) <= 100 then
		charges = ShopModule:getCount(msg)
		price = 50*charges
		selfSay('Do you want a sudden death rune with '..charges..' charges for '..price..' gold coins?')
		talk_state = 1
		itemid = 2268
	elseif msgcontains(msg, 'yes') and talk_state == 1 then
		if doPlayerRemoveMoney(cid, price) == TRUE then
		    doPlayerGiveItem(cid, itemid, charges)
			selfSay("You have bought this rune.")
			talk_state = 0
		else
			selfSay("You don't have enough money.")
			talk_state = 0
		end
	elseif msgcontains(msg, 'no') and talk_state == 1 then
		selfSay("Then not.")
		talk_state = 0
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Still get this error;
Code:
Lua Script Error: [NPC Interface]
data/npc/scripts/runes.lua:onCreatureSay
ludaDoCreteItem(). Can not add item.
 
Back
Top