• 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!

Solved Help with Simple Quest Npc i made

ricotjeh

New Member
Joined
Apr 21, 2009
Messages
45
Reaction score
0
Hey,
- - - Updated - - -
Just used different keywords to solve the problem. "help" to start the quest and initiate quest status report. and "YES" to answer to quest status reports.
- - -Solved - - -

Im making a npc who, Greets with the given .XML greeting wich asks if you need some help, wich basicly gets answered by YES.
when first said "yes" (determined by playerStorage), he should say what he wants, give a sword and set storage to 1, when back from quest, he should then respond to "yes" with: So you got my feathers? wich in his turn gets responded to with yes. the rest is important, because i think my problem is that the npc/script dont receive/read My text ingame.

Can anyone, rookie or pro, help me out a hand?
Im using TFS mystic spirit: 0.2.14

Update ---- Solved ------

Here is the code i solved, feel free to use it:





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
npcHandler:addModule(FocusModule:new())
NpcSystem.parseParameters(npcHandler)

function creatureSayCallback(cid, type, msg)
		local featherid = 5890
		local amount = 10
		local storage = 7171
		local getstorage = getPlayerStorageValue(cid, storage)
		local sword = 2376
		
		


		
	if msgcontains(msg, 'help') then
	
				if getstorage <1
					then
                        npcHandler:say("I see you are trying to get past this point. i could help you since i am a mage, But i am in need of some Feathers first! get me 10 and i will help u out!", cid)
						doPlayerAddItem(cid, sword, 1)
						setPlayerStorageValue(cid, storage, 1)
				
              elseif getstorage == 1 
					then
                        npcHandler:say("So, you got my Feathers?", cid)
						
						
			  elseif getstorage == 2 
					then
						 npcHandler:say("Just ask for a teleport when you are ready", cid)
						 
						 end
						
						end
		if(msgcontains(msg, 'yes') and getstorage == 1) then	  	  
					 if doPlayerRemoveItem(cid, featherid, amount) == TRUE then
					 
						doSendMagicEffect(getCreaturePosition(cid), 13)
						npcHandler:say('Thanks for helping! Ask me for a teleport when you are ready, a TIP! You might find something before you leave!', cid)
						setPlayerStorageValue(cid, storage, 2)
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Quest completed: A Helping Hand.")
					
						
						
						
						
					elseif doPlayerRemoveItem(cid, featherid, amount) == FALSE then
						npcHandler:say('You dont have enough feathers yet', cid)
						talkState = 0
		  
		end
		end
	if msgcontains(msg, 'teleport') then
		if getstorage == 2 then
		  doTeleportThing(cid, {x=5979, y=5991, z=7}) 
		  doSendMagicEffect(getCreaturePosition(cid), 13)
		  npcHandler:say('Good Luck!', cid)
		   elseif getstorage <2 then
		    npcHandler:say('i wont do that yet, get me what i want first!', cid)
	end
	end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule)

- - - Updated - - -

BumpedieBump
 
Last edited:
Back
Top