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

[tfs 0.3.6][8.60][NPC Travel for Items][Goroma][1]

SonGoqu

New Member
Joined
Nov 27, 2008
Messages
64
Reaction score
0
Hi, I need a script/lua code ... for an npc that can travel us for 4 kind of items. When we bring this four items to the npc he will travel us to an island. So as the quest at goroma. Can someone help me?
 
Im not sure what you'r after but im guessing its this:

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
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	--[[
	REMEMBER TO SET YOUR STORAGE
	]]--
	local storage = 2097
        local teleport = {x=1000, y=1000, z=7}

	if(msgcontains(msg, 'travel') or msgcontains(msg, 'teleport')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			npcHandler:say("Bring me these three items...ITEMS HERE.", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			npcHandler:say("Did you bring me...THREE ITEMS HERE", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Let me teleport you!", cid)
                        doTeleportThing(cid, teleport, true)
		end
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if(doPlayerRemoveItem(cid, XXXX, 100) and doPlayerRemoveItem(cid, XXXX, 1) and doPlayerRemoveItem(cid, XXXX, 1) == TRUE) then
			npcHandler:say("Thankyou, as promised here is your reward. I will teleport you.", cid)
		        doTeleportThing(cid, teleport, true)
			setPlayerStorageValue(cid, storage, 2)
			talkState[talkUser] = 0
		else
			npcHandler:say("Sorry, you do not have all the items, dont try scam me! Dont make me call the guards!", cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Not tested, may not work as i think i saw some errors you can fix. But you got the core script done. Also i thought you wanted three items not four, but you can just add another item check.
 
Back
Top