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

Limiting npc movement in TFS 0.3.0?

Rhydin

New Member
Joined
Jul 21, 2008
Messages
56
Reaction score
2
I can't seem to limit my NPCs movement(or limiting pushing them away from their place), they don't stay within the spawn point. :/

Anyone know how to solve this? :confused:

the npc

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Yok" script="data/npc/scripts/Yok.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="134" head="39" body="95" legs="0" feet="39" addons="0"/>
	<parameters>
		    <parameter key="message_greet" value="Greetings |PLAYERNAME|. You don't happen to have any questions about the {village}?" />
		<parameter key="module_keywords" value="1" />
		<parameter key="keywords" value="job;jailor;village" />
		<parameter key="keyword_reply1" value="I work as a {jailor}." />
		<parameter key="keyword_reply2" value="I see to it that any prisoners we might have, does not escape." />
		<parameter key="keyword_reply3" value="I protect this wonderful village to the south from harm." />
	</parameters>
</npc>

and the script

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
npcHandler:addModule(FocusModule:new())

function onThink()
	npcHandler:onThink()
	talk = math.random(1,40)
	if talk == 1 then
		selfSay("Long live the king!")
	end
	if talk == 2 then
		selfSay("<mumbles>")
	end
end
 
Last edited:
If you want them to stand still all the time, walkinterval="0"

No, I want them to walk around but in a limited area so they won't walk from the town away to some far off mountain if the server is online long enough, as it is, this is currently what's happening, they're just wandering off :/
 
In tfs 0.3 series you have scripts for tiles only for players etc, just put correct id on tiles around NPC spawn, so only players can stand on these tiles, NPCs will stay inside of area.
If I'll find these Ids I can post it here
EDIT: its like that, use whatever ID that fits your needs best:
Code:
		Player Tile
			191

		Monster Tile
			192

		NPC Tile
			193

		NOT Player Tile
			194

		NOT Monster Tile
			195

		NOT NPC Tile
			196
 
Nooo


In map editor create spawn area 3x3 squares and put in NPC then save and start server with this spawn. Npc will walk only at this square 3x3
 
Back
Top