Thank you very much! Now I think I understand the DB NPC
Although, I still have problems with the PlayerTouchsMe. It seems as if the player touches the NPC when the player is located to the top left of the NPC.
This is the NPC script:
PHP Code:
join("shop");
//#CLIENTSIDE
function onCreated()
{
showcharacter();
nick = "Candy"; //Sets the nickname of the character
ap = 100; //Sets the ap of the character. Also affects the colour of the nickname
headimg = "head722.gif"; //What head image to use
bodyimg = "body8.png"; //What body image to use
colors[0] = "orange"; //Sets the skin colour
colors[1] = "lightblue"; //Sets the coat colour
colors[2] = "yellow"; //Sets the sleeves colour
colors[3] = "darkred"; //Sets the shoes colour
colors[4] = "lightgreen"; //Sets the belt colour
shieldimg = "no-shield.gif"; //Sets the shield image
shieldpower = 1; //Must have this or the shield won't show
}
and this is the shop class:
PHP Code:
function onCreated()
{
setShape(1, 32, 32);
this.shop_id = "basicshop";
}
function onPlayerTouchsMe()
{
this.listofitems = DB_Items.getShopItems(this.shop_id);
triggerclient("gui", "-shopcontrol", this.listofitems, this.x, this.y);
}
Am I missing something that causes the PlayerTouchsMe to fire when I'm located to the top left of the NPC?