Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Weapons joined to a class do not stay joined after reconnecting. (https://forums.graalonline.com/forums/showthread.php?t=134262876)

Jiroxys7 04-18-2011 05:34 PM

Weapons joined to a class do not stay joined after reconnecting.
 
Just as the topic title says. I've been using classes joined to weapons to handle buff processing as well as stat processing.

However each time I disconnect, upon connecting to the server again, the classes will be no longer joined to my weapon. They will remain unjoined until I open the weapon script and click "Apply". I end up having to do this every time I connect to the server.

I figured that joining them with

PHP Code:

function onTimeout(){
  
join("classname");
setTimer(0.05);} 

instead of the method I've been using which is
PHP Code:

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


would remedy the problem, but it doesn't make any difference. Using an onPlayerenters() event instead does not fix the issue either. Nor does calling onCreated(); inside of an onTimeout().

Is there something I'm missing? Is this a bug? What's going on?

Crow 04-18-2011 05:44 PM

You should always join classes on the serverside.

Fulg0reSama 04-18-2011 05:45 PM

Quote:

Originally Posted by Crow (Post 1644151)
You should always join classes on the serverside.

this.

Jiroxys7 04-18-2011 06:02 PM

Quote:

Originally Posted by Crow (Post 1644151)
You should always join classes on the serverside.

I was under the impression that joining a class through the serverside only allowed you to call the serverside public functions of the script. I'll give it another shot though. Thanks. :)

MrOmega 04-18-2011 06:34 PM

Method I have used is

PHP Code:

while ( !isinclass( <CLASS>))
  
this.join( <CLASS>); 

Which will basically suspend the script till the class is loaded. Join it serverside but keep the class code clientside.

cbk1994 04-18-2011 09:50 PM

Quote:

Originally Posted by MrOmega (Post 1644158)
while ( !isiinclass( <CLASS>))

Typo, and there's no reason to use a while loop for this.

Quote:

Originally Posted by Jiroxys7 (Post 1644155)
I was under the impression that joining a class through the serverside only allowed you to call the serverside public functions of the script. I'll give it another shot though. Thanks. :)

Nope. If you join classes on the serverside you can use both serverside and clientside functions, and you don't have to wait for the class to load like you would if you joined it clientside.

The only exception I know of is the player object, where you do need to join classes clientside if you want to access clientside methods.

Jiroxys7 04-19-2011 04:20 AM

Alright thanks. I've changed one of the two weapons to join on the serverside. Though It seems like the other one was already being joined on the serverside. So I'll see what happens and I'll post back if I somehow run into this problem again.

Thanks a lot!

MrOmega 04-19-2011 02:51 PM

Quote:

Originally Posted by cbk1994 (Post 1644176)
Typo, and there's no reason to use a while loop for this.

oops, thanks, fixed it, I did that post from my phone and didn't catch it. Reason behind the for loop is on clientside, I guess it takes time to load and I wait for it to load clientside, but as mention (and what I do today) is joining it via serverside


All times are GMT +2. The time now is 02:42 PM.

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