CorpseDude
Member
- Joined
- Jan 22, 2021
- Messages
- 20
- Solutions
- 1
- Reaction score
- 5
Im trying to implement a custom quest on a 1.4 server. I cant find much documentation on the PlayerStorageKeys usage and im pretty dumb with code.
This is what I have so far but its giving me an error.
I had the NPC working okay as just a basic chat NPC but trying to make it so the NPC remembers the conversation has broken the NPC.
Im trying to make it so you say:
Hi
her
meet
xantera
then the character will need to go to another NPC
IF returning to the first NPC they should say something along the lines of
P:hi
NPC:Oh its you again
P: Her
NPC: Yes I know you are her go see the hunter!
This is what I have so far but its giving me an error.
I had the NPC working okay as just a basic chat NPC but trying to make it so the NPC remembers the conversation has broken the NPC.
Im trying to make it so you say:
Hi
her
meet
xantera
then the character will need to go to another NPC
IF returning to the first NPC they should say something along the lines of
P:hi
NPC:Oh its you again
P: Her
NPC: Yes I know you are her go see the hunter!
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/His_Thoughts.lua
data/npc/lib/npc.lua:8: attempt to index local 'message' (a nil value)
stack traceback:
[C]: in function '__index'
data/npc/lib/npc.lua:8: in function 'msgcontains'
data/npc/scripts/His_Thoughts.lua:29: in main chunk
[C]: in function 'createNpc'
data/talkactions/scripts/place_npc.lua:11: in function <data/talkactions/scripts/place_npc.lua:1>
[Warning - NpcScript::NpcScript] Can not load script: His_Thoughts.lua
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 voices = {
{ text = '<mumbles> He said this was her favorite hunting grounds... Where is she?'}
}
npcHandler:addModule(VoiceModule:new(voices))
keywordHandler:addKeyword({'her'}, StdModule.say, {npcHandler = npcHandler, text = "Just someone a good friend would talk about. He said she used to brave the harsh cold and battle large beast as a pass time. Can you believe that? HERE as a pass time?! If only I could {meet} her"})
keywordHandler:addKeyword({'meet'}, StdModule.say, {npcHandler = npcHandler, text = "You're her? No way. I dont believe it. What was the name of your world before the multiverse merged? I think he said it started with an X? Xan something?"})
keywordHandler:addKeyword({'rot'}, StdModule.say, {npcHandler = npcHandler, text = "YOU .. YOU .. You are as good as dead! I will get you! Do you hear me? I will have your head! On a platter!"})
-- keywordHandler:addKeyword({'xantera'}, StdModule.say, {npcHandler = npcHandler,
-- text = {
--'OH YES! Thats it! You are her! ...',
--'I never thought I would be here today with you...',
--'Oh dear...',
--'I think maybe you should head to the town of port hope. Theres a hunter there that may want to hear from you. ...',
--'He has a guild of hunters that keep the creature population in control. You will find him Im sure. Tell him {H.T. sent} you.',
--}}
--)
if msgcontains(msg, "Xantera") then
if player:getStorageValue(PlayerStorageKeys.HerHome.Mission02) >= 1 and player:getStorageValue(PlayerStorageKeys.HerHome.Mission02) < 3 then
npcHandler:say({
'OH YES! Thats it! You are her! ...',
'I never thought I would be here today with you...',
'Oh dear...',
'I think maybe you should head to the town of port hope. Theres a hunter there that may want to hear from you. ...',
'He has a guild of hunters that keep the creature population in control. You will find him Im sure. Tell him {H.T. sent} you.',
}, cid)
npcHandler.topic[cid] = 1
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 1 then
npcHandler:say("Thank you, I appreciate it. Don't forget to mention the package to Snake.", cid)
player:setStorageValue(PlayerStorageKeys.HerHome.Mission02, player:getStorageValue(PlayerStorageKeys.HerHome.Mission02) + 1)
npcHandler.topic[cid] = 0
end
end
npcHandler:setMessage(MESSAGE_GREET, "Oh, |PLAYERNAME|, You're not {her}.")
npcHandler:addModule(FocusModule:new())