View Single Post
  #4  
Old 06-11-2009, 07:11 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
It's probably better do do something like this:

PHP Code:
function onCreated() {
  
level.door this;
  
this.hidden false;
}
function 
onOpen() {
  if (! 
this.hidden) {
    return;
  }
  
  
this.hidden true;
  
hide();
  
scheduleevent(3"Show");
}
function 
onShow() {
  
this.hidden false;
  
show();

and then in the other script

PHP Code:
function onPlayerTouchsMe() {
  if (
level.door.hidden) {
    return;
  }
  
  
level.door.trigger("Open");

Notice I'm putting the actual NPC object in a level variable, not the x and y. This ensures that you'll always get to that NPC, even if there's another NPC on top of it, which could cause problems when using triggeraction.
That's a good idea actually, yeah. I didn't think of that- thanks!
Reply With Quote