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

[Help] One Npc doesnt work on Tfs 0.3

tarjei

Necronian Engineer
Joined
May 25, 2008
Messages
505
Reaction score
126
Location
Poland
When I want to 'summon' him by /s 'nick' then:

Bug
Code:
[09/10/2008  16:13:37] data/npc/lib/npcsystem/npchandler.lua:285: table index is nil
[09/10/2008  16:13:37] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/oldrak.lua

And i dont know what should I do beacouse on tfs 0.2 it is working :p

Npc code.
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
function creatureSayCallback(cid, type, msg)


	if(not npcHandler:isFocused(cid)) then
      	      return false
  	  end

		if msgcontains(msg, 'hallowed axe') then
			if isPlayer(cid) then
				if getPlayerItemCount(cid,2386) >= 1 and player_money >= 1000 then
					selfSay('Do you want me to enchant this Axe to Hallowed Axe?', cid)
					talk_state = 1
				else
					selfSay('You have to bring me an axe and 1000 gp and axe first.', cid)
					talk_state = 0
				end
			else
				selfSay('You need premium to buy this axe from me.', cid)
				talk_state = 0
			end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,2386) >= 1 and getPlayerMoney(cid) >= 1000 then
					if doPlayerTakeItem(cid,2386,1) and doPlayerRemoveMoney(cid,1000) then
						selfSay('Here you are. You can now defeat the demon oak with this axe.', cid)
						talk_state = 2
						doPlayerAddItem(cid,8293,1)

------------------------------------------------confirm no
------------------------------------------------
		elseif msgcontains(msg, 'no') and talk_state == 1 then
			talk_state = 0
			selfSay('Ok then.', cid)

					end
			end

		elseif msgcontains(msg, 'tible') then
			if isPlayer(cid) then
				if getPlayerMoney(cid) >= 1000 then
					selfSay('Do you want to buy this Holy Tible from me?', cid)
					talk_state = 3
				else
					selfSay('You have to bring me an axe and 1000 gold first.', cid)
					talk_state = 0
				end
			else
				selfSay('You need premium to buy this axe from me.', cid)
				talk_state = 0
			end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 3 then
			talk_state = 0
			if getPlayerMoney(cid) >= 1000 then
					if  doPlayerRemoveMoney(cid,1000) then
						selfSay('Here you are. You can now enter to Pits of Inferno.', cid)
						doPlayerAddItem(cid,1970,1)

					end
			end
------------------------------------------------confirm no
------------------------------------------------
		elseif msgcontains(msg, 'no') and talk_state == 3 then
			talk_state = 0
			selfSay('Ok then.', cid)


		elseif msgcontains(msg, 'demon oak') then
			if isPlayer(cid) then
				if getPlayerItemCount(cid,2386) >= 1 and player_money >= 3500000 then
					selfSay('Did you defeat the demon oak?', cid)
					talk_state = 2
				else
					selfSay('Go defeat the demon oak.', cid)
					talk_state = 0
				end
			else
				selfSay('You need premium to buy this axe from me.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 2 then
			talk_state = 0
			if getPlayerStorageValue(cid,21545) == 1 then
				selfSay('Good job!', cid)
				setPlayerStorageValue(cid,21545,2)
			end
------------------------------------------------ confirm no ------------------------------------------------
		elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
			selfSay('Ok thanks.', cid)
			talk_state = 0
		end

	return true
end

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