bpm91
Intermediate OT User
- Joined
- May 23, 2019
- Messages
- 931
- Solutions
- 7
- Reaction score
- 127
- Location
- Brazil
- YouTube
- caruniawikibr
I've been trying all the ways for hours, and the npc doesn't respond to the word brooch.
already tried with talk state, topic cid
etc...
already tried with talk state, topic cid
etc...
Lua:
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 function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if msgcontains(msg, 'brooch') then
npcHandler:say('What? You want me to examine a brooch?')
npcHandler.topic[cid] = 1
elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 and getPlayerItemCount(cid,2318) >= 1 then
npcHandler:say('You have recovered my brooch! I shall forever be in your debt, my friend!')
doPlayerTakeItem(cid,2318,1)
setPlayerStorageValue(cid,25511,1)
npcHandler.topic[cid] = 2
elseif msgcontains(msg, 'passage') then
if getPlayerStorageValue(cid,25511) == 1 then
npcHandler:say('Since you are my friend now I will sail you to the isle of the kings for 10 gold. Is that okay for you?')
npcHandler.topic[cid] = 3
else
npcHandler:say('You are not my friend.')
npcHandler.topic[cid] = 0
end
elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 3 then
if getPlayerStorageValue(cid,25511) == 1 then
if getPlayerMoney(cid) >= 10 then
selfSay('Have a nice trip!')
doPlayerRemoveMoney(cid, 10)
doTeleportThing(cid, {x=32190,y=31957,z=6})
doSendMagicEffect(getCreaturePosition(cid), 10)
npcHandler.topic[cid] = 0
else
npcHandler:say('You don\'t have enough money.')
npcHandler.topic[cid] = 0
end
else
npcHandler:say('You can\'t travel without my family brooch')
npcHandler.topic[cid] = 0
end
end
return TRUE
end
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am merely a humble fisher now that nothing is left of my noble legacy."})
keywordHandler:addKeyword({'legacy'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Once my family was once noble and wealthy, but fate turned against us and threw us into poverty."})
keywordHandler:addKeyword({'fate'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "When Carlin tried to colonize the region now known as the ghostlands, my ancestors put their fortune in that project."})
keywordHandler:addKeyword({'ghosthlands'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Our family fortune was lost when the colonization of those cursed lands failed. Now nothing is left of our fame or our fortune. If I only had something as a reminder of those better times. <sigh>"})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Dalbrect Windtrouser, of the once proud windtrouser family."})
keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "To think my family used to belong to the local nobility! And now those arrogant women are in charge!"})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Adrenius."})
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye. You are welcome.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())