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

[Support] Guide Npc

Adm Eddie

New Member
Joined
Aug 12, 2011
Messages
26
Reaction score
0
Location
Mexico
Hello
Otland :)


Well firstful thankyou for all the help that u have given me :D Congratz ^^

Secondful
I wanna know how to edit or make and Npc like the ones of Tibia RL.
I mean a Guide Npc
Guide_Tiko.gif
<<--Just like this one.

I want that if I say to him keywords like "Guide", "Map"
Or something like that.

He put me marks in my mini map just like Tibia RL.

I dont know if it's possible that's the reason im asking :p

 
Guide Tico.xml
HTML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Guide Tico" script="guide_tico.lua">
	<look type="132" head="79" body="79" legs="79" feet="79" />
</npc>

<!-- change outfit:	<look type="131" head="79" body="79" legs="79" feet="79" /> -->
colors and type nr: http://otland.net/f83/monster-looktypes-31774/

guide_tico.lua
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 onPlayerEndTrade(cid)			npcHandler:onPlayerEndTrade(cid)			end
function onPlayerCloseChannel(cid)		npcHandler:onPlayerCloseChannel(cid)		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
	
	if doMessageCheck(msg, "temple") then
		selfSay('hmm tempe?', cid)
		talkState[talkUser] = 1
	elseif talkState[talkUser] == 1 and doMessageCheck(msg, 'yes') then
		selfSay('here', cid)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "blabla bla here tempe")
		doPlayerAddMapMark(cid, {x=111, y=111, z=7}, MAPMARK_TEMPLE, "city tempe")
		talkState[talkUser] = 0

	elseif doMessageCheck(msg, "tools") then
		selfSay('hmm tools?', cid)
		talkState[talkUser] = 2
	elseif talkState[talkUser] == 2 and doMessageCheck(msg, 'yes') then
		selfSay('here', cid)
		doPlayerSendTextMessage(cid, MAPMARK_SHOVEL, "blabla bla tools.")
		doPlayerAddMapMark(cid, {x=222,y=222,z=7}, MAPMARK_SHOVEL, "city tols")
		talkState[talkUser] = 0

-- no
	elseif(doMessageCheck(msg, 'no') and isInArray({1,2}, talkState[talkUser])) then
		selfSay('Ok then.', cid)
		talkState[talkUser] = 0
	end
	return true
end

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

--[[ 
optional:
MAPMARK_TICK
MAPMARK_QUESTION
MAPMARK_EXCLAMATION
MAPMARK_STAR
MAPMARK_CROSS
MAPMARK_TEMPLE
MAPMARK_KISS
MAPMARK_SHOVEL
MAPMARK_SWORD
MAPMARK_FLAG
MAPMARK_LOCK
MAPMARK_BAG
MAPMARK_SKULL
MAPMARK_DOLLAR
MAPMARK_REDNORTH
MAPMARK_REDSOUTH
MAPMARK_REDEAST
MAPMARK_REDWEST
MAPMARK_GREENNORTH
MAPMARK_GREENSOUTH
 ]]
 
Last edited:
Back
Top