Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Class question (https://forums.graalonline.com/forums/showthread.php?t=69940)

wild8900 11-08-2006 05:39 AM

Class question
 
Hey, I have one npc spread between alot of levels. I need to make a class that all the npcs can copy to so when I update the class it updates all. How would I do that? I constantly update the script too.
Thanks!


EDIT:
would this work? Btw this is going in an npc in the level so I used gs1. I want the npc to be the class npc basicly...
Quote:

//#CLIENTSIDE
if (created){
join class;
}

Gambet 11-08-2006 05:55 AM

You make very little sense. Just make a class, add the script there, and use join scripts in the levels instead of the same script over and over again.

wild8900 11-08-2006 06:02 AM

So this script would work?
PHP Code:

//#CLIENTSIDE
if (created){
join class;



hotrian 11-08-2006 06:12 AM

On another note, GS2 does not work offline, However once the level is online, a level based GS2 script, will work

MegaMasterX90875 11-08-2006 07:35 PM

I used to just clear out the entire script and do

NPC Code:
join("class");


konidias 11-08-2006 08:34 PM

Quote:

Originally Posted by wild8900 (Post 1240689)
Hey, I have one npc spread between alot of levels. I need to make a class that all the npcs can copy to so when I update the class it updates all. How would I do that? I constantly update the script too.
Thanks!


EDIT:
would this work? Btw this is going in an npc in the level so I used gs1. I want the npc to be the class npc basicly...

You basically described the function of a class. A class is just a script that you can call upon to use in other scripts. If you put join classname; in a level npc, and you have a class on your server with that name, the level npc will use the script in that class.

Whenever you update the class, it would update the script in that level. Though usually you have to also update the level to refresh the class, but not with everything.

KuJi 11-08-2006 11:47 PM

Example:

Local NPC:
PHP Code:

function onCreated()
{
  
join("door");


Class NPC:
PHP Code:

function onCreated()
{
  
setimg("door.png");
  
setshape(13248);
}

function 
onPlayerTouchsMe()
{
  
hide();
  
sleep(3);
  
show();


^ Should work fine ^

xAndrewx 11-09-2006 12:57 AM

please, use
HTML Code:

this.join("className");
Learn from Skyld--

Bl0nkt 11-09-2006 02:14 AM

Quote:

Originally Posted by xAndrewx (Post 1240974)
please, use
HTML Code:

this.join("className");
Learn from Skyld--

What's the difference between that and

join("class");

function onCreated() {
join("class");
}

etc

KuJi 11-09-2006 02:31 AM

Quote:

Originally Posted by Bl0nkt (Post 1241008)
What's the difference between that and

join("class");

function onCreated() {
join("class");
}

etc

None, but I believe it should be in an event anyway.

-- Andrew =(.. sorry.

Only this. I use is in triggerserver("gui", this.name, "lolz");


All times are GMT +2. The time now is 04:11 AM.

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