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

[XML] How to make an NPC's

M4t30

THE RETURN OF TROLL KINGZ
Joined
Jan 20, 2010
Messages
774
Reaction score
14
Location
127.0.0.1
Just for Magnetico
Autor: M4t30
Script: How to make npc

Introduction

"NPC" stands for "Non-Player Character". They are characters that are in specific places throughout Tibia, and they are not controlled by a real-life human being.

Most NPCs in Tibia exist for the buying and selling of Items, but not all NPCs buy and sell things. Some NPCs are in the game as part of a Quest, and others are merely for roleplaying purposes.


I'll show you how to create buying and selling npc.

Here we got an example of script.

Code:
 <?xml version="1.0" encoding="UTF-8"?>
<npc name="[COLOR="Red"]Royal Helmet Seller[/COLOR]" script="[COLOR="DarkRed"]loot.lua[/COLOR]" walkinterval="[COLOR="Blue"]2000[/COLOR]" floorchange="0">
	<health now="[COLOR="Cyan"]150[/COLOR]" max="150"/>
	<look type="[COLOR="SeaGreen"]139[/COLOR]" head="132" body="79" legs="97" feet="132" corpse="2212"/>
	<parameters>
		<parameter key="module_shop" value="1"/>
		<parameter key="message_greet" value="[COLOR="Purple"]Hello |PLAYERNAME|. I sell swords, clubs, axes, helmets, boots, legs, shields and armors."/>[/COLOR]
		<parameter key="[COLOR="DeepSkyBlue"]shop_buyable[/COLOR]" value="[COLOR="SandyBrown"]royal helmet,2498,40000;[/COLOR]
	</parameters>
</npc>

RED - NAME: You can choose any name you want.. I pefer to use A-Z, 1-9..

DARKRED - LUA FILE: You can find it in npc/scripts.. Its very important to use it and it comes with every server pack... As you see here its named loot.lua it contains every detail of script. And script wont work it. loot.lua is also for SELL/BUY.. And ofcourse we got manly others scripts like: promotion.lua wich comes for promotion, addon.lua wich comes for addon and alot of more.

BLUE - WALKINTERVAL: Walkinterwal is percent that NPC will walk. If you want that npc don't move just simply set 0. Or if you want that moves alot put some higher number.. 2000 is normal. This isnt that important.

CYCAN - HEALTH: As it says it's NPC health. You can put any number and its not important cause NPC's are not attackable..

SEAGREEN - OUTFIT:
You can choose any outfit for your npc. From 2 to 354. Also if you have player outfit you can set addons for it.

PURPLE - NPC GRETTINGS:
You can set there what NPC will tell you on "Hi". You can put any text for it. For better RPG Felling make it sounds good.

DEEP SKY BLUE - SELL/BUY: Its veery important! It decides will NPC sell or buy anything. Loot npc can't work with it.

SANDY BROWN - ITEM: You can put there what it will say. Make sure that you put komma (,) after every word. You close it with ( ; ). The system it works is like this: itemname,itemid,buy/sellprice. Example: crystal coin,2160,10000.

I hope that i helped newbs to learn it. Noone know everything on start so this will help you. Thanks!​
 
Would be nice if it included some advanced funktions ;p
Thanks anyways!
 
Thanks I learned 3 NEW COLORS!!

btw. you have a little typo in cyan, (CYCAN haha : D)
 
ey... when you add "royal helmet,2498,40000;... i want a NPC to sell a bp of rings example... what do i write there then?
 
Back
Top