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 08-24-2006, 01:09 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
A special door

Okay, so I'm making doors that can be opened by a key or lockpicking, and they are serverside. (Although this doesn't work clientside either).
Basically, I'm having trouble with the picking part. All the picking weapon does is send a trigger to a certain spot. I know that action is being sent. What I am having trouble with is the actual door:
PHP Code:

function onActionpick()
{
  if(
this.locked==0)
  {
    if(
this.canbelocked==1)
    {
      if(
this.warn==0)
      {
        
player.chat="This door is unlocked, to lock it, use the lockpick again";
        
this.warn=1;
      }
      else if(
this.warn==1)
      {
        
this.warn=0;
        
pick();
      }
    }
    else
    {
      
player.chat="This door cannot be locked";
    }
  }
  else
  {
    
picklock();
  }
}
function 
onCreated()
{
  
setshape(1,32,32);
  
// TOGGLE LOCK 0=CANNOT BE LOCKED 1=CAN LOCK
  
this.canbelocked=1;
  
this.locked=1;
}
function 
picklock()
{
  
player.chat="Picking lock...";
  
//other stuff

Reply With Quote
  #2  
Old 08-24-2006, 10:50 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Okay, I've added the key part too. It seems that it isnt receiving the actions, but it should be.
Key script:
PHP Code:
//#CLIENTSIDE
function onWeaponfired()
{
  
triggeraction(player.x+1+vecx(player.dir)*2,player.y+1.25+vecx(player.dir)*2,"key",1234);

Lock picking script:
PHP Code:
//#CLIENTSIDE
function onWeaponfired()
{
  
player.chat="...";
  
triggeraction(player.x+1+vecx(player.dir)*2,player.y+1.25+vecx(player.dir)*2,"pick","pick");

And the door:
PHP Code:
function onActionkey()
{
  if(
params[0]==1234//keycode, any number will work
  
{
    
this.locked=abs(this.locked-1);
  }
}   

function 
onActionpick()
{
  if(
this.locked==0)
  {
    if(
this.canbelocked==1)
    {
      if(
this.warn==0)
      {
        
player.chat="This door is unlocked, to lock it, use the lockpick again";
        
this.warn=1;
      }
      else if(
this.warn==1)
      {
        
this.warn=0;
        
triggeraction(x,y,"picklock","picklock");
      }
    }
    else
    {
      
player.chat="This door cannot be locked";
    }
  }
  else
  {
    
triggeraction(x,y,"picklock","picklock");
  }
}
function 
onCreated()
{
  
setshape(1,32,32);
  
// TOGGLE LOCK 0=CANNOT BE LOCKED 1=CAN LOCK
  
this.canbelocked=1;
  
this.locked=1;
}
function 
onPlayertouchsme()
{
  if(
this.locked==1)
  {
    
player.chat="This door is locked";
  }
  else if(
this.locked==0)
  {
    
hide();
    
sleep(2);
    
show();
  }
}
//#CLIENTSIDE
function onActionpicklock()
{
  
player.chat="Picking lock...";
  
this.lx=screenwidth-200;
  
this.ly=screenheight-150;
  
showimg(600,"dr_lock.png",this.lx,this.ly);
  
changeimgvis(600,10);
  
showimg(601,"dr_lock_pin.png",this.lx+4,this.ly+20);
  
changeimgvis(601,11);

Does anyone what could be worng??
Reply With Quote
  #3  
Old 08-25-2006, 04:35 AM
BigNoobie BigNoobie is offline
I am Tig.
Join Date: Aug 2006
Posts: 13
BigNoobie is on a distinguished road
Send a message via AIM to BigNoobie
You probably need to set the shape of the door NPC clientside so the NPC can recieve the trigger. just do
function onCreated() {
setshape(1,32,32);
}
Not sure if this will help, give it a shot.
Reply With Quote
  #4  
Old 08-26-2006, 04:37 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Nope, I tried that, it didn't work.
Reply With Quote
  #5  
Old 09-02-2006, 09:52 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
bump
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 07:41 AM.


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