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

Simple NPC

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello,
I requesting you guys to make for me one simple NPC.
TFS 0.3.6pl1 Tibia 854

This dialogue:
- hi
- Leave this forsaken ground, |PLAYERNAME|.
(than the NPC ignore player (focus 0))
 
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

function creatureSayCallback(cid, type, msg)
	if msgcontains(msg:lower(),'hi') then
		npcHandler:say('Leave this forsaken grounds, '..getCreatureName(cid)..'.',cid)
		npcHandler:releaseFocus(cid)
	end
	return true
end
 
Black Guard.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="a Black Guard" script="data/npc/scripts/bguard.lua" walkinterval="0" floorchange="0">
	<health now="100" max="100"/>
	<look type="139" head="114" body="114" legs="114" feet="114" addons="3"/>
</npc>

Bguard.lua
LUA:
local npcHandler = NpcHandler:new(keywordHandler) 
NpcSystem.parseParameters(npcHandler)

function onCreatureSay(cid, type, msg) 		npcHandler:onCreatureSay(cid, type, msg)
		if msgcontains(msg, 'hi') then
		selfSay('Leave this forsaken ground '..getCreatureName(cid)..'.', cid)
		npcHandler:releaseFocus(cid)
		end
end

Tested and working in TFS 0.2 by Talaturen
 
Last edited:
Back
Top