• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua NPC MIssion Error!

Bntz

Dprethor!
Joined
Mar 16, 2009
Messages
102
Reaction score
1
Location
México
In the third part when it should send to "local boss = {x=1092,y=1508,z=7}" It does not work, what happened?


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())

PS: This is not my npc I found surfing Otland

in this link, but do not write the solution

http://otland.net/f83/npc-mission-script-114195/#post1131074
 
Back
Top