Hello dear community.
I have been working with Limos' NPC Basic tutorial the recent days, learned alot from it, altho not much enough as it seems :/
I have made NPC script which should give you citizen addon after some talking.. anyway, it is working only until a following point:
The NPC doesn't react to 'yes'
Here is the script
I haven't added anything except this script
I am using TFS 1.3 8.6 nekiro
I hope anyone of you could help me and refer to my misstakes I have done
Thanks alot!
I have been working with Limos' NPC Basic tutorial the recent days, learned alot from it, altho not much enough as it seems :/
I have made NPC script which should give you citizen addon after some talking.. anyway, it is working only until a following point:
Code:
13:18 A: Greetings, Knight.
13:18 Knight [250]: mission
13:18 A: Sorry, the backpack I wear is not for sale. It's handmade from rare minotaur leather.
13:18 Knight [250]: minotaur leather
13:18 A: Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?
13:18 Knight [250]: yes
The NPC doesn't react to 'yes'
Here is the script
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 storage = 5003
citizen = 22001
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "addon") or msgcontains(msg, "backpack") or msgcontains(msg, "outfit") then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Sorry, the backpack I wear is not for sale. It\'s handmade from rare {minotaur leather}.", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay("Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?", cid)
talkState[talkUser] = 3
else
selfSay("You already have the backpack.", cid)
end
elseif msgcontains(msg, "minotaur leather") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though.. so good luck!", cid)
setPlayerStorageValue(cid, storage, 1)
elseif msgcontains(msg, "yes") then
if getPlayerStorageValue(cid, storage) == 1 and doPlayerRemoveItem(cid,5878,100) then
selfSay("Here you go, I hope you like it.", cid)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerAddOutfit(cid, 128, 1)
doPlayerAddOutfit(cid, 136, 1)
setPlayerStorageValue(cid,citizen,1)
setPlayerStorageValue(cid,storage,2)
else
selfSay("You do not have all the required items.", cid)
end
end
end
talkState[talkUser] = 0
elseif msgcontains(msg, "no") and talkState[talkUser] == 1 or talkState[talkUser] == 2 then
selfSay("Ok then.", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I haven't added anything except this script
I am using TFS 1.3 8.6 nekiro
I hope anyone of you could help me and refer to my misstakes I have done
Thanks alot!
Last edited: