• 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 Not working. New system = reason ? o.O

Serp

/* No comment */
Joined
Mar 23, 2008
Messages
249
Reaction score
1
I'm very bad at writing NPC scripts. But all of my NPCS written in this way. have stopped working. When say 'adept' or whatever needs to be said. the NPC doesn't say anything back.

Is this because of the new system? if so. can someone help me out please xD
i SUCK at NPCS


PHP:
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

npcHandler:addModule(FocusModule:new())

function creatureSayCallback(cid, type, msg)
		if(npcHandler.focus ~= cid) then
		return false
		end

	if (msgcontains(msg, 'yes') and talk_state == 1 then
		doPlayerSetVocation(cid, 1)
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You are now an \'Adept\' type \!info or \!help.")
				doTeleportThing(cid, newtemplepos1, TRUE)
					doPlayerSetTown(cid, 2)
						doSendMagicEffect(newtemplepos1, CONST_ME_GIFT_WRAPS)
							doSendMagicEffect(newtemplepos1, CONST_ME_FIREWORK_YELLOW)
								talk_state = 0
	end

	if msgcontains(msg, 'Adept') or msgcontains(msg, 'adept') or msgcontains(msg, 'Adept') or msgcontains(msg, 'adept') then
		npcHandler:say("Do you want to become an \'Adept\'\? Or do you need more \'information\'?")
			talk_state = 1
	end

	if msgcontains(msg, 'no') and talk_state > 0 then
		npchandler:say("Very well")
			talk_state = 0
	end
return true
end



P.S

Please don't leave stupid comments like 'OMG THATS SUCH A MESS!' and then not help. i already know its not written very well. and i'd prefer help not criticism
 
Just refreshing this post... cmon if anyone knows how to fix this please help. Bet many people are confused about the new NPC scripts and dont know what or where to change stuff to make the old scripts work. Most NPCs are working just changin some stuff in the .xml part... But the ones that need keywords in .lua files are not working at all, they just say the greetings par but do not respond to any keyword. This post is a good example of what many people are going nuts about in this new updates... including me:p

So common help us out a little please! ^_^
 
The msgcontains function has been removed, download the latest TFS and enter the folder called 'Doc', if you scroll down in the file called LUA_Functions you can see all the current functions.

Assuming you were talking about TFS, otherwise I have no idea why. :p
 
Back
Top