Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   NPC only shows after "update level" (https://forums.graalonline.com/forums/showthread.php?t=134261745)

AlexanderK 01-18-2011 07:50 PM

NPC only shows after "update level"
 
I use this to display windows:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.windowtype="1b";
  
this.join("window");


this is the class:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
this.setShape(13232);
  
showimg(200"sorna_window"@this.windowtype@"_glass.png"this.xthis.y);
  
changeimgcolors(2001110.7);
  
changeimgvis(2000);
  
showimg(201"sorna_window"@this.windowtype@"_frame.png"this.xthis.y);
  
changeimgvis(2011);


When I connect to the server, the window doesn't show. It only does after I've used the update level command. I have no idea at all why this is, especially because I display the trees in the exact same way and I have no problem with them.

fowlplay4 01-18-2011 07:54 PM

Classes have loading issues on the client-side, just join them on the serverside and use an attr variable. I.e:

PHP Code:

function onCreated() { 
  
this.windowtype="1b"
  
this.join("window"); 


PHP Code:

function onCreated() {
  
this.attr[1] = this.windowtype;
}

//#CLIENTSIDE
function onCreated() { 
  
this.setShape(13232); 
  
showimg(200"sorna_window"@this.attr[1]@"_glass.png"this.xthis.y); 
  
changeimgcolors(2001110.7); 
  
changeimgvis(2000); 
  
showimg(201"sorna_window"@this.attr[1]@"_frame.png"this.xthis.y); 
  
changeimgvis(2011); 



Crow 01-18-2011 07:56 PM

Joining them on the serverside and setting the variables on the clientside will work just as well; like this:
PHP Code:

function onCreated()
  
this.join("window");

//#CLIENTSIDE
function onCreated()
  
this.windowtype "1b"

The synchronisation of attributes is usually delayed a bit. I, personally, only use them as a last resort.

AlexanderK 01-18-2011 07:59 PM

So is this because of the variable?
Because for my trees, the scripts are basically the same and work.


EDIT:
I just figured out why the trees worked,
there is one NPC left in the level that joins the class on the Serverside. So would this be a good way of saving server resources or should I just join all classes serverside because it doesn't matter anyway?

fowlplay4 01-18-2011 08:25 PM

Quote:

Originally Posted by AlexanderK (Post 1623880)
I just figured out why the trees worked,
there is one NPC left in the level that joins the class on the Serverside. So would this be a good way of saving server resources or should I just join all classes serverside because it doesn't matter anyway?

Probably just better to, the resources used doesn't really impact the server at all. You'll see client lag long before you see server lag from it.


All times are GMT +2. The time now is 08:41 AM.

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