• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC mission script.

Zorenia

Hoster of Zorenia
Joined
Jan 21, 2009
Messages
588
Reaction score
61
Location
The Netherlands
Hello guys!

I'm already fighting a few days with a script! I tryed everything by myself but well I'm not a PRO scripter so I hope anyone could help me out!!

So what I want is, A NPC Script mission script;

Player says: hi, mission.
Npc: give mission 1.
--
Well you have to do a few things.. collecting items, killing monsters.
--
Come back.. say mission again, the script will look for hes storage number, well npc see hes already started the mission 1 and hes on part 3.. so he says you collect the items? you say yes.. he give the reward.

And now the part I can't let it work!!

If I say mission again the script must see.. hee he already did mission 1 now I give him mission 2..
when I say the same word 'mission'.

Well I Hope anyone can help me out, I'm getting stuck on this for 4 days an tryed really to let it work by myself.
Well hope anyone could make some time for me to help me out!
Peace,
Zorenia.


PS: I can read script!! haha I got enough skillz to edit, paste scripts but I don't have the skills to know witch functions etc I have to use! (A)

btw 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.") 
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	
	
setPlayerStorageValue(cid,300,1)
if(msgcontains(msg, 'mission')) and (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)
setPlayerStorageValue(cid,301,1)
end
if(msgcontains(msg, 'favor')) and (getPlayerStorageValue(cid,301) == 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,302,1)
end
if(msgcontains(msg, 'yes')) and getPlayerStorageValue(cid,302) == 1 then
selfSay('Okaj, good luck. Kill the trolls to get the pieces back! {Report} when you gather the pieces.', cid)
talkState[talkUser] = 1
setPlayerStorageValue(cid,303,1)
elseif(msgcontains(msg, 'report') and talkState[talkUser] == 1) then
if(getPlayerStorageValue(cid,307) == 1) then
selfSay('Hey, it`s you.. you already helped me out!.', cid)
else
if getPlayerStorageValue(cid,304) < 1 then
if(doPlayerRemoveItem(cid, 11389, 5) == TRUE) then
doPlayerAddExperience(cid,300)
selfSay('Thank you! (you received 30 points of experience)', cid)
setPlayerStorageValue(cid,307,1)
setPlayerStorageValue(cid,308,1)
else
selfSay('You must have more items', cid)
end
end
end

	if(msgcontains(msg, 'mission')) and (getPlayerStorageValue(cid,308) == 1) then
selfSay('mission2', cid)
	

	if(msgcontains(msg, 'mission')) and (getPlayerStorageValue(cid,306) == 1) then
selfSay('mission3', cid)

end
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
@ kawon, Thanks for your replay! seems to be exacly what I'm looking for! thanks I will take a look at it about few hours. well thanks!!! I will let ya know if It was helpfull.
 
Kawon! thanks, btw I will edit the script a bit.. your script is great but you just missed a few things!! ;) like replay when your stuff get removed just some small things.. I add it.. and post the script for some other guys who need it for their server! You get the also credits ofc! thanks man!
 
Back
Top