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 01-23-2007, 04:06 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
triggering beetween wnpcs

Well, I've been experimenting, but I can't get something like this to work..

// -Master
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.wnpc "Chompy/Test";
  
triggerserver"gui"this.wnpc"actiontest""foo");

// Chompy/Test
PHP Code:
function onActionServerside()
{
  if ( 
params0] == "actiontest")
    echo( 
params1]);

This isn't working for me, anyone have any ideas?
I dunno if I am doing anything wrong..
(Doesn't output the echo in rc chat)
__________________

Last edited by Chompy; 01-23-2007 at 08:26 PM.. Reason: removed comma
Reply With Quote
  #2  
Old 01-23-2007, 04:29 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I've never triggered accross weapons. I've always just triggered the current one and use a public function .
Reply With Quote
  #3  
Old 01-23-2007, 04:33 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
Well, is it possible to do this?
Actually the 'this.wnpc' is from variable saved on the player, that was just an example.
Just wondering if it is possible, would make my work easier :O

(I am planning on having one master script to control other wnpcs (each wnpc with a different ability/functons etc.), so making lots of public functions inside the master script would just look messy)

The stuff I am doing would look more like,.. :

PHP Code:
//#CLIENTSIDE
function _triggerwnpc, function, array)
  
triggerserver"gui"temp.wnpctemp.function, temp.array; 
__________________
Reply With Quote
  #4  
Old 01-23-2007, 05:16 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
I did something similar a while ago.

I have a weapon script which creates an NPC using putnpc2. When that NPC is touched it triggers an action on the weapon NPC.


In the placed npc I just have triggeraction(0,0,"serverside","npc name",params);


I'm pretty sure that works,

if not, you can always use findweapon.

Master
NPC Code:

//#CLIENTSIDE
function onCreated(){
findweapon("Chompy/Test").trigger();
}




Chompy/Test
NPC Code:

function onActionServerside()
{
if ( params[ 0] == "actiontest")
echo( params[ 1]);
}
//#CLIENTSIDE
public function trigger() {
triggeraction(0,0,"serverside","Chompy/Test","actiontest");

}

__________________

Coming soon (Hopefully:P)
Reply With Quote
  #5  
Old 01-23-2007, 06:41 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
its not, it must use a variable instead of the real wnpc name, thats my problem..

like triggerserver( "gui", "Chompy/Test", ...); works fine, but if I take out 'Chompy/Test' and replace with a variable it won't work..

I don't know what type it needs, if its an object or a string..
__________________
Reply With Quote
  #6  
Old 01-23-2007, 06:57 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Chompy View Post
its not, it must use a variable instead of the real wnpc name, thats my problem..

like triggerserver( "gui", "Chompy/Test", ...); works fine, but if I take out 'Chompy/Test' and replace with a variable it won't work..

I don't know what type it needs, if its an object or a string..
Well, think about it. "Chompy/Test" is a string, therefore it logically will expect a string.
__________________
Skyld
Reply With Quote
  #7  
Old 01-23-2007, 08:21 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 Skyld View Post
Well, think about it. "Chompy/Test" is a string, therefore it logically will expect a string.
But, it doesn't work, like the example in the first post..

What I am saying is that, my problem is something like this:

This works
PHP Code:
//#CLIENTSIDE
function onCreated()
  
triggerserver"gui""Chompy/Test""actiontest""foo"); 
But this doesn't..
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
temp.wnpc "Chompy/Test";
  
triggerserver"gui"temp.wnpc"actiontest""foo");

__________________
Reply With Quote
  #8  
Old 01-23-2007, 08:23 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
PHP Code:
this.wnpc "Chompy/Test",; 
... won't work if you keep that comma there.
__________________
Skyld
Reply With Quote
  #9  
Old 01-23-2007, 08:25 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 Skyld View Post
PHP Code:
this.wnpc "Chompy/Test",; 
... won't work if you keep that comma there.
Opps, well I removed the comma, but it still won't work (see post that is two posts above this)
__________________
Reply With Quote
  #10  
Old 01-23-2007, 09:47 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Chompy View Post
Opps, well I removed the comma, but it still won't work (see post that is two posts above this)
The player has BOTH weapons, yes?
Reply With Quote
  #11  
Old 01-23-2007, 09:52 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 Chandler View Post
The player has BOTH weapons, yes?
Yes, the player has both weapons.
__________________
Reply With Quote
  #12  
Old 01-23-2007, 09:56 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Triggering script:
HTML Code:
//#CLIENTSIDE
function onPlayerChats()
{
  temp.curToks = player.chat.tokenize();
  triggerserver("weapon", temp.curToks[0], temp.curToks[1]);
}
Finding script:
HTML Code:
function onActionServerside(curOption)
{
  echo(curOption);
}
Works perfect for me o-o

This also works too:
HTML Code:
//#CLIENTSIDE
function onPlayerChats()
{
  temp.curNPC = "CT";
  triggerserver("weapon", temp.curNPC, player.chat);
}
Am I not understanding what you're trying to do?
Reply With Quote
  #13  
Old 01-23-2007, 10:00 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 Chandler View Post
Triggering script:
HTML Code:
//#CLIENTSIDE
function onPlayerChats()
{
  temp.curToks = player.chat.tokenize();
  triggerserver("weapon", temp.curToks[0], temp.curToks[1]);
}
Finding script:
HTML Code:
function onActionServerside(curOption)
{
  echo(curOption);
}
Works perfect for me o-o

This also works too:
HTML Code:
//#CLIENTSIDE
function onPlayerChats()
{
  temp.curNPC = "CT";
  triggerserver("weapon", temp.curNPC, player.chat);
}
Am I not understanding what you're trying to do?
Hmm, I think you found it :] Thanks
( 'weapon' instead of 'gui', will check if it works on my server)
__________________
Reply With Quote
  #14  
Old 01-23-2007, 10:47 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
"weapon" and "gui" are the same though. For me the only possible solution is that the player actually doesn't have both weapons.
Reply With Quote
  #15  
Old 01-23-2007, 10:50 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Stefan View Post
"weapon" and "gui" are the same though. For me the only possible solution is that the player actually doesn't have both weapons.
That's how I see it...
Reply With Quote
  #16  
Old 01-24-2007, 02:31 AM
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
It works fine for me, Even with the variable calling o.O

Hikaru/Test
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.wnpc "Hikaru/Test2";
triggerserver("weapon"this.wnpc"actiontest""foo");

Hikaru/Test2
PHP Code:
function onActionServerSide(cmdoption) {
switch(
cmd) {
case 
"actiontest":
echo(
option);
break;
}

__________________
What signature? I see no signature?
Reply With Quote
  #17  
Old 01-24-2007, 04:06 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
hmm, weird..
__________________
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 01:40 PM.


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