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