Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2007, 06:14 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
player.join()

On the Control-NPC under onActionPlayerOnline(), I added a line 'player.join("player");' In the class 'player' I made a public function we'll call it sayChat(message). In another player weapon I have player.sayChat("test"), but all I get is an error the F2 window saying function rapidwolve.sayChat() not found... blah blah...I searched forums on this and nothing worked. I know this can be done as I have seen it done before. Can anybody help?
Reply With Quote
  #2  
Old 02-20-2007, 06:28 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Since the error is outputting to your console, I'm assuming you are trying the player function clientside. In that case, the function must be declared as public in the class clientside as well.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 02-20-2007, 06:37 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
It is public on both of them obviously. What sense would it make to have the serverside one public and the clientside one regular -_-
Reply With Quote
  #4  
Old 02-20-2007, 06:44 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Rapidwolve View Post
It is public on both of them obviously. What sense would it make to have the serverside one public and the clientside one regular -_-
It kind of helps if you post your code too...

I was thinking more along the lines of you forgetting to add a copy of the function in the clientside portion of the class as well.

EDIT:
Ok, I played around with this. In some type of system NPC (onCreated), have the player join the class clientside too. Then it should work.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.

Last edited by napo_p2p; 02-20-2007 at 06:59 AM..
Reply With Quote
  #5  
Old 02-20-2007, 09:55 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
You're aware that you can "say2" and "chat" serverside. It doesn't need to be clientside :o
Reply With Quote
  #6  
Old 02-21-2007, 03:30 AM
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 Rapidwolve View Post
On the Control-NPC under onActionPlayerOnline(), I added a line 'player.join("player");' In the class 'player' I made a public function we'll call it sayChat(message). In another player weapon I have player.sayChat("test"), but all I get is an error the F2 window saying function rapidwolve.sayChat() not found... blah blah...I searched forums on this and nothing worked. I know this can be done as I have seen it done before. Can anybody help?
There's no reason it shouldn't work. I have something like this in my Control-NPC ... player.join( "player-functions" );

I admit I've never done anything on it clientside, but I don't see why it shouldn't work. I'll post some examples for you to look at ...

in control NPC
PHP Code:
function onActionPlayerOnline()
{
  
player.join"player" );

in the class 'player'
PHP Code:
//#CLIENTSIDE
public function setChatsetchat )
{
  
player.chat setchat;

in some script
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
player.setChat"blah" );

[Edit: If this doesn't work, maybe you could try joining clientside in a system NPC?]
__________________
Reply With Quote
  #7  
Old 02-21-2007, 08:08 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Chandler View Post
You're aware that you can "say2" and "chat" serverside. It doesn't need to be clientside :o
Obviously, but if you're writing some clientside code for a script, it is nice to be able to call clientside functions (instead of having to trigger).

Quote:
Originally Posted by cbkbud
If this doesn't work, maybe you could try joining clientside in a system NPC?
That should do it.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:59 PM.


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