Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
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
  #2  
Old 06-11-2009, 07:21 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by [email protected] View Post
That's a good idea actually, yeah. I didn't think of that- thanks!
Same, I'll also remember that one.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.