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

Npc teleport

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Reaction score
2
Hi!

I would like a so that players has to collect something like lets say 20 demon horns and give them to an Npc then the player will be sent to position Y="xxxx" x="xxxx" z="x" :)
 
Dunno you distro but either create a lever..... If getPlayerCountItem(cid, nnnn) == 20 then doTeleportPlayer(pos) etc etc.. or do a creatureevent
 
And what happens after that? will it be for free, does the player need to pay it again or is it just for 1 time and a player can't teleport again?
Also an example of the conversation with the NPC would also be useful to understand what you want exactly.
 
okey, player can trade 20 demon horns for a passage how many times as thay want but he always needs 20 demon horns to travel.
I want it to be in a quest instead of just putting a tp, players need to do a little task to move on to the next room.

Code:
Player: Hi

Npc: Hello there Player! So you want to pass?

Player: Yes

Npc: Okey then! Bring me 20 "demon horns" to show you got the courage to move on..

Player: demon horns

Npc: Oh I might have mistaking you! Are you sure you want to move on?

Player: Yes

Then the player gets teleported and the demon horns are removed..
 
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)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	local pos = {x = 1000, y = 1000, z = 7} -- add here the teleport position

	if(msgcontains(msg, 'yes')) and talkState[talkUser] ~= 2 then
		selfSay('Okey then! Bring me 20 {demon horns} to show you got the courage to move on.', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'demon horns')) and talkState[talkUser] == 1 then
		selfSay('Oh I might have mistaking you! Are you sure you want to move on.', cid)
		talkState[talkUser] = 2
	elseif(msgcontains(msg, 'yes')) and talkState[talkUser] == 2 then
            	if getPlayerItemCount(cid, 5954) >= 20 then
               	 	doPlayerRemoveItem(cid, 5954, 20)
                	doTeleportThing(cid, pos)
		else
			selfSay('You don\'t have it.', cid)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no')) and talkState[talkUser] ~= 1 then
		talkState[talkUser] = 0
		selfSay('Oh, well then not!', cid)
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top