Zoe Skandinavia
Member
- Joined
- Jul 18, 2014
- Messages
- 193
- Solutions
- 2
- Reaction score
- 15
Hi!, i was creating a new NPC with too many answers, but when i finished and tested in game, looks like if he ignore something or i don't know because at the begin starts correctly saying: "I think you are |PLAYERNAME|", but when i say "yes" he doesn't respond me. What's wrong?
Here is the script:
Please help me!.
Thanks
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
local player = Player(cid)
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if not npcHandler:isFocused(cid) then
if msg == "hi" then
if getPlayerStorageValue(cid, 300987) == -1 then
npcHandler:say("I think you are |PLAYERNAME| eh?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, 300987) == 0 then
npcHandler:say("Again you?? Get out of here!", cid)
setPlayerStorageValue(cid, 300987, 1)
talkState[talkUser] = 1
player:popupFYI("Answers: A) No no wait, i'm sorry for said that")
end
end
if getPlayerStorageValue(cid, 300987) == 3 and msg == "hi" and getPlayerItemCount(cid, 2798, 10) then
npcHandler:say("Do you have the 10 {blood herbs}?", cid)
talkState[talkUser] = 1
player:popupFYI("Answers: A) Yes")
elseif getPlayerStorageValue(cid, 300987) == 3 and msg == "hi" then
npcHandler:say("What the hell are you doing here? Go for the 10 blood herbs!", cid)
npcHandler:releaseFocus(cid)
end
npcHandler:addFocus(cid)
else
return false
end
if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, 300987) == -1 then
npcHandler:say("Well, you remind me a great guy...", cid)
player:popupFYI("Answers: A) Which guy? / B) I don't care, just go to the point!")
talkState[talkUser] = 1
elseif msgcontains(msg, "A") and talkState[talkUser] == 1 then
npcHandler:say("A guy called Frey Stroud, maybe you heard from him", cid)
talkState[talkUser] = 2
player:popupFYI("Answers: A) Yes / B) No, who was him?")
elseif msgcontains(msg, "B") and talkState[talkUser] == 1 then
npcHandler:say("Who fuck are you to speak me like that?? Get out of here!.", cid)
talkState[talkUser] = 0
setPlayerStorageValue(cid, 300987, 0)
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "A") and talkState[talkUser] == 2 then
npcHandler:say("Well, i think you know all from him, right?", cid)
talkState[talkUser] = 3
player:popupFYI("Answers: A) No, just a little / B) In Absolute")
elseif (msgcontains(msg, "A") or msgcontains(msg, "B") and talkState[talkUser] == 3) or (msgcontains(msg, "B") and talkState[talkUser] == 2) then
npcHandler:say("Ok, Frey Stroud was a Skandinavian Citizen five years ago, leader of the clan Stroud...", cid)
talkState[talkUser] = 4
player:popupFYI("Answers: A) Clan Stroud?")
elseif msgcontains(msg, "A") and talkState[talkUser] == 4 then
npcHandler:say("Yes, conformed by him, his wife: Anya Stroud and his three brothers: Woody Stroud, Audrey Stroud and Matty Stroud. They was a powerful clan, the best of Skandinavia.", cid)
talkState[talkUser] = 5
player:popupFYI("Answers: A) Anya? / B) The best of Skandinavia?")
elseif msgcontains(msg, "A") and talkState[talkUser] == 5 then
npcHandler:say("All that i know about Anya is that she was the most powerful girl in Skandinavia, nobody can beat her...", cid)
talkState[talkUser] = 6
player:popupFYI("Answers: A) Really? / B) Some special weapon?")
elseif (msgcontains(msg, "A") and talkState[talkUser] == 6) or (msgcontains(msg, "B") and talkState[talkUser] == 5) then
npcHandler:say("Yes! You don't have idea about the power!", cid)
player:popupFYI("Answers: B) Some special weapon?")
elseif msgcontains(msg, "B") and talkState[talkUser] == 6 then
npcHandler:say("I think Frey Stroud and Anya Stroud had some special weapons... *cof* *cof*... Sorry, i can't keep talking, *cof* take this and run while you can...", cid)
talkState[talkUser] = 0
setPlayerStorageValue(cid, 300987, 1)
doPlayerAddItem(cid, 1949, 1)
doSetItemText(1949, "??????????????????????????")
npcHandler:releaseFocus(cid)
end
end
if msgcontains(msg, "A") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, 300987) == 1 then
npcHandler:say("You sorry?? That's not sufficient...", cid)
talkState[talkUser] = 2
player:popupFYI("Answers: A) Money / B) What do you want?")
elseif msgcontains(msg, "A") and talkState[talkUser] == 2 then
npcHandler:say("Money? Hahaha, you see me like a poor person or what?...", cid)
player:popupFYI("Answers: B) What do you want?")
elseif msgcontains(msg, "B") and talkState[talkUser] == 2 then
npcHandler:say("Well, i can have everything, but i don't have time. So, if you want my information, bring me 10 blood herbs for my daughter...", cid)
talkState[talkUser] = 3
player:popupFYI("Answers: A) Where can i find it? / B) Daughter?")
elseif msgcontains(msg, "A") and talkState[talkUser] == 3 then
npcHandler:say("I don't know, just go for them!", cid)
setPlayerStorageValue(cid, 300987, 3)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "B") and talkState[talkUser] == 3 then
npcHandler:say("Yes, my daughter. You can find those that i said or not?")
player:popupFYI("Answers: A) Where can i find it?")
end
end
if msgcontains(msg, "A") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, 300987) == 3 and getPlayerItemCount(cid, 2798, 10) then
npcHandler:say("Alright, come back when you're ready. I'll do like if i'd never saw you before. See ya.", cid)
doPlayerRemoveItem(cid, 2798, 10)
setPlayerStorageValue(cid, 300987, -1)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
Please help me!.
Thanks