Zorenia
Hoster of Zorenia
Hello guys!
I working on this script for few weeks of trying. I already asked some help on this but I try to fix it by myself to learn something.. but I can't find out this problem!
The script is working.. but there is only 1 problem.
When I start a mission, he tell me he need to have fishing baits... blalb.. then I can say yes to resive the task.
But if I say bye before fully resive the task. and I say HI again.. I already got another storage number and I can not go furder.. because I didn't resive the task and I already got another storage number so I could not resive the fully task.
Could someone take a look on it!! so it still work.. but when I break contact with npc.. the npc knows where I'm so he can still give me the quest.
well I hope you guys know what I mean!
I really hope someone could help me out fast as possible so I could work on! I want to launch the rook beta this weekend XD hehe
My script:
I working on this script for few weeks of trying. I already asked some help on this but I try to fix it by myself to learn something.. but I can't find out this problem!
The script is working.. but there is only 1 problem.
When I start a mission, he tell me he need to have fishing baits... blalb.. then I can say yes to resive the task.
But if I say bye before fully resive the task. and I say HI again.. I already got another storage number and I can not go furder.. because I didn't resive the task and I already got another storage number so I could not resive the fully task.
Could someone take a look on it!! so it still work.. but when I break contact with npc.. the npc knows where I'm so he can still give me the quest.
well I hope you guys know what I mean!
I really hope someone could help me out fast as possible so I could work on! I want to launch the rook beta this weekend XD hehe
My script:
Lua:
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
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. I am the local Fisherman. Are you looking for some work? ask me for a {mission} or do you want to {report} to me?")
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, 'mission')) then
if(getPlayerStorageValue(cid,300) < 1) then
selfSay('You look like a strapping young adventurer, yes? Could you help an Elderly man out with a quick {favor?}', cid)
talkState[talkUser] = 1
setPlayerStorageValue(cid,300,1)
elseif (getPlayerStorageValue(cid,302) == 1) then
selfSay('Good job, now that i`ve got the bait, we`ll need one more thing before we can get to the waters were Ol` Salty is! In the back of my fishing shack is my trusty fishing rod. I need you to grab the for me, this old man cant walk as quick as he used to be able to! Can you grab it for me quick? ', cid)
talkState[talkUser] = 1
setPlayerStorageValue(cid,302,2)
elseif (getPlayerStorageValue(cid,303) == 1) then
selfSay('You did your last job great! Now we can go after Ol` Salty!. Are you {ready}?', cid)
setPlayerStorageValue(cid,303,2)
talkState[talkUser] = 1
elseif (getPlayerStorageValue(cid,303) == 0) then
selfSay('Your next mission will be to get 400 {green dragon scales}.', cid)
talkState[talkUser] = 1
elseif (getPlayerStorageValue(cid,303) == 6) then --zmieniac w zaleznosci od ostatniego storage!!
selfSay('You have done all missions.', cid)
talkState[talkUser] = 1
end
---------------------------------------
elseif(msgcontains(msg, 'report') and (getPlayerStorageValue(cid,301) == 1)) then
selfSay('Great! did you found my fishing baits?', cid)
elseif(msgcontains(msg, 'yes') and (getPlayerStorageValue(cid,301) == 1)) then
if(doPlayerRemoveItem(cid, 11389, 5) == TRUE) then
doPlayerAddExperience(cid,150)
selfSay('Thank you! (you received 150 points of experience) If you still looking for work ask me for a {mission}', cid)
setPlayerStorageValue(cid,300,5)
setPlayerStorageValue(cid,301,2)
setPlayerStorageValue(cid,302,1)
else
selfSay('You need more fishing bait.', cid)
end
---------------------------------------
elseif(msgcontains(msg, 'favor') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,300) == 1)) then
selfSay('Good! See, I`ve been chasing a fish, a big one! It`s eluded me for some time now...Nearly had him once i did! Anyways, i need you to gather up eight pieces of bait for me. I heard the trolls to the south have been stealing bait from the local stores. Can you get me some?', cid)
setPlayerStorageValue(cid,300,2)
elseif(msgcontains(msg, 'yes') and (getPlayerStorageValue(cid,300) == 2)) then
selfSay('Okaj, good luck. Kill the trolls to get the pieces back! {Report} when you gather the pieces.', cid)
setPlayerStorageValue(cid,300,1)
setPlayerStorageValue(cid,301,1)
setPlayerStorageValue(cid,302,1)
---------------------------------------
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,301) == 2) and (getPlayerStorageValue(cid,302) == 2)) then
selfSay(' Excellent! You`ll find my fishing shack if you follow the shore to the east about twenty paces. Be careful though, last time I was in there, a bear had snuck into the shack for the fish!. {report} if you got my rod! ', cid)
setPlayerStorageValue(cid,302,3)
elseif(msgcontains(msg, 'report') and (getPlayerStorageValue(cid,302) == 3)) then
selfSay('Did ya find the rod?', cid)
elseif(msgcontains(msg, 'yes') and (getPlayerStorageValue(cid,302) == 3)) then
if(doPlayerRemoveItem(cid, 10223, 1) == TRUE) then
doPlayerAddExperience(cid,180)
selfSay('I heard the rustling from here! Looks like you gave that old bear a run for it`s money! Good Job! Now we can go after Ol` Salty!', cid)
selfSay('Thank you! (you received 180 points of experience) If you still looking for work ask me for a {mission}', cid)
setPlayerStorageValue(cid,302,4)
setPlayerStorageValue(cid,303,1)
else
selfSay('You don`t have my fishing rod.', cid)
end
---------------------------------------
elseif(msgcontains(msg, 'ready') and talkState[talkUser] == 1 and (getPlayerStorageValue(cid,302) == 4) and (getPlayerStorageValue(cid,303) == 2)) then
selfSay('Great! Now, we`re going to go out to sea, I`ll need you to dive into the water and kill Ol` Salty for me, and bring me his heart. I`m far too old to do any diving! Are you ready to go out to sea? I can bring you there, you will get it for me?', cid)
setPlayerStorageValue(cid,303,3)
elseif(msgcontains(msg, 'yes') and (getPlayerStorageValue(cid,303) == 3)) then
local boss = {x=1092,y=1508,z=7}
doTeleportThing(cid, boss)
selfSay('Great! good luck!', cid)
setPlayerStorageValue(cid,303,4)
elseif(msgcontains(msg, 'report') and (getPlayerStorageValue(cid,303) == 4)) then
selfSay('So, have you finally done it? Were you able to avenge me and kill Ol` salty?', cid)
setPlayerStorageValue(cid,303,5)
elseif(msgcontains(msg, 'yes') and (getPlayerStorageValue(cid,303) == 5)) then
if(doPlayerRemoveItem(cid, 10553, 1) == TRUE) then
doPlayerAddExperience(cid,250)
selfSay('Thank you! My entire life`s work, finally complete thanks to you. Here, take this as a token of my appreciation. An old man like me won`t be needing it for much anymore! ', cid)
setPlayerStorageValue(cid,303,6)
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())