I am trying to make an item spawner. I am making it create an NPC at my mouses x and y, and when it is touched, it adds the weapon to the player and destroys itself. However, I can't get it to work. When I fire the weapon, it puts the NPC with the image bcalarmclock.png, and it changes the chat to the players chat. That is all done on created. In the class, this is what I have...
PHP Code:
//Works
function onCreated() {
setimg("block.png");
this.chat = text;
}
//Doesn't work
function onPlayerTouchsMe() {
addweapon(this.chat);
player.chat = "Green";
destroy();
}
Any suggestions?
I think it is something to do with the PlayerTouchsMe