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 01-18-2011, 07:50 PM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
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.
Reply With Quote
  #2  
Old 01-18-2011, 07:54 PM
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
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); 

__________________
Quote:
Reply With Quote
  #3  
Old 01-18-2011, 07:56 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
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.
Reply With Quote
  #4  
Old 01-18-2011, 07:59 PM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
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?
Reply With Quote
  #5  
Old 01-18-2011, 08:25 PM
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 AlexanderK View Post
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.
__________________
Quote:
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 04:13 PM.


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