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-07-2010, 12:11 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Can't join classes.

I've done this in the past. so perhaps I just forgot how to join the classes. But it's not working. Is this correct?:

NPC:
PHP Code:
//#CLIENTSIDE
function onCreated(){
  
player.join("player_classtest"); 
  
player.chat "Class should be joined now";

Class player_classtest:
PHP Code:
//#CLIENTSIDE
function onPlayerchats(){
  if(
player.chat == "/testclass"){
    
player.chat "It works!";
    echo(
"It really works!");
  }

What am I doing wrong this time?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 08-07-2010, 12:12 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Try joining it on the serverside.
Reply With Quote
  #3  
Old 08-07-2010, 12:18 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by DustyPorViva View Post
Try joining it on the serverside.
I believe I've tried that already but I'll give it another shot.

edit: no luck.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #4  
Old 08-07-2010, 12:46 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
onPlayerChats isn't an event of the player object.
__________________
Reply With Quote
  #5  
Old 08-07-2010, 12:52 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by cbk1994 View Post
onPlayerChats isn't an event of the player object.
Yes.

this.join instead of player.join.
__________________
Quote:
Reply With Quote
  #6  
Old 08-07-2010, 01:02 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
onPlayerChats isn't an event of the player object.
So.. you're saying that I use such functions in a class, nor list a set of custom functions in a class?

Okay, would I be able to do this in an NPC? (I guess theyre called DBNPCs? The ones under the dragon icon.)

If so, how would I communicate between a weapon and a dbnpc?

edit:
Quote:
Originally Posted by fowlplay4 View Post
Yes.

this.join instead of player.join.
o. thanks, I'll try that!
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #7  
Old 08-07-2010, 01:20 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
When you join something you're basically copying and pasting the code into that weapon. If you join it to the player you can add extra functions to the player (like player.unstick()) but you can't use stuff like onKeyPressed and onPlayerChats which aren't events of the player.

Your code should look like this (and be in a weapon):

PHP Code:
function onCreated() {
  
this.join("myclass");
}

//#CLIENTSIDE
function onCreated() {
  
player.chat "it works!";

__________________
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 06:51 AM.


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