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 02-24-2007, 05:32 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Triggeraction Problems

I'm using a DB NPC, I need to trigger it from a class that the DB NPC is joined to.
The DB NPC's image is block.png

Here's the trigger (clientside)
PHP Code:
triggeractionthis.+.5this.+.5"BuyWep", [...] ); 
Here's the serverside onAction thing
PHP Code:
function onActionBuyWep( [...] )
{
  
player.chat "trigger2";
  [...]

What am I doing wrong?
__________________
Reply With Quote
  #2  
Old 02-24-2007, 05:43 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
When using triggeraction() in a class, it will go serverside..
So when on serverside in the class, use findnpc()..
__________________
Reply With Quote
  #3  
Old 02-24-2007, 05:51 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Chompy View Post
When using triggeraction() in a class, it will go serverside..
So when on serverside in the class, use findnpc()..
Thanks for quick response, but what I'm really trying to figure out is how to do it with local NPCs. The DB NPC I made for a test (quick editing).
Basicly the local NPCs will have the exact same script ...
__________________
Reply With Quote
  #4  
Old 02-24-2007, 05:54 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by cbkbud View Post
Thanks for quick response, but what I'm really trying to figure out is how to do it with local NPCs. The DB NPC I made for a test (quick editing).
Basicly the local NPCs will have the exact same script ...

Have local NPCs join the class that is triggering to the DB NPC.
Reply With Quote
  #5  
Old 02-24-2007, 05:54 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Use classes and join them in the Local NPC and use this code to trigger between the DB NPC and the class:

PHP Code:
triggerserver("npc""DBName""BuyItem", [...]); 
__________________
What signature? I see no signature?
Reply With Quote
  #6  
Old 02-24-2007, 05:57 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Let me try to explain ...
screw the DB NPC.
I have a local NPC that joins the shop item class.
The class does everything right, then it triggers, but it doesn't receive the trigger on serverside.
__________________
Reply With Quote
  #7  
Old 02-24-2007, 05:59 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
Let me try to explain ...
screw the DB NPC.
I have a local NPC that joins the shop item class.
The class does everything right, then it triggers, but it doesn't receive the trigger on serverside.
The class do have a shape?
It needs a shape to recieve the trigger..
__________________
Reply With Quote
  #8  
Old 02-24-2007, 06:00 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by cbkbud View Post
Let me try to explain ...
screw the DB NPC.
I have a local NPC that joins the shop item class.
The class does everything right, then it triggers, but it doesn't receive the trigger on serverside.

Posting the code does help...
Reply With Quote
  #9  
Old 02-24-2007, 06:01 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Gambet View Post
Posting the code does help...
I second that..

We have no idea if what you are doing serverside is correct or it does have a shape..
__________________
Reply With Quote
  #10  
Old 02-24-2007, 06:09 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
The class
PHP Code:
function onActionBuyWep()
{
  
player.chat "trigger2";
}
//#CLIENTSIDE
function onCreated()
{
  
setshape13232 );
  
setimgthis.image );
  
setTimer0.05 );
}
function 
onActionMouseClick()
{
  
showGui();
  
client.shopid this.id;
}
function 
onMouseDownbutton )
{
  if ( 
button == "left" )
  {
    
triggeractionmousexmousey"MouseClick"player.account );
  }
}
function 
onTimeOut()
{
  
chat this.stockamm;
  if ( 
this.stock == true )
  {
    
this.stockamm makevarthis.stockvar );
  }
  
setTimer0.05 );
}
function 
showGUI()
{
 
// GUI is here, works fine
}

function 
Shop_Buy.onAction()
{
  if ( 
client.shopid == this.id )
  {
    if ( 
player.rupees >= this.realprice )
    {
      
triggeractionthis.xthis.y"BuyWep");
    }
    else
    {
      
player.chat "You cannot afford this!";
    }
  }

The local NPC that joins it ...
PHP Code:
join"shoptest" );
//#CLIENTSIDE
function onCreated()
{
  
this.image "block.png";
  
this.weaponname "Items/Explosives";
  
this.itemname "Plastic Explosives";
  
this.itemprice 100;

__________________
Reply With Quote
  #11  
Old 02-24-2007, 06:09 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Set the shape of the NPC then trigger the action on itself.
Shape must be set on serverside.
__________________
Reply With Quote
  #12  
Old 02-24-2007, 06:19 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Inverness View Post
Shapes must be set on serverside.
Thanks That worked
__________________
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:59 AM.


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