Quote:
Originally Posted by cbk1994
For some reason I thought that if dontBlock was set serverside it still blocked on clientside. I didn't even know drawOverPlayer existed serverside. Tested it, and you're right. Thanks for the tips  .
|
It's possible that with the update that was made several months ago to remove "empty" NPCs from serverside memory that these forms of synchronisation no longer work after the onCreated event.
Something else which also no longer appears to work serverside is showimg();.
On a related note, if you have lots of animated lights via timeout it would be better to use a class script, not so much because it improves usability but because then it is only the class which is required to be downloaded the one time, rather than each NPC script being downloaded as part of the level file.
For instance:
Class script -
PHP Code:
//#CLIENTSIDE
function onCreated(){
if(this.image == NULL){
this.image = "light4.png";
}
//red
if(this.attr[1] == NULL){
this.attr[1] = 1;
}
//green
if(this.attr[2] == NULL){
this.attr[2] = 0.75;
}
//blue
if(this.attr[3] == NULL){
this.attr[3] = 0.75;
}
//alpha
if(this.attr[4] == NULL){
this.attr[4] = 0.5;
}
//zoom
if(this.attr[5] == NULL){
this.zoom = 2;
}
else{
this.zoom = this.attr[5];
}
this.setcoloreffect(this.attr[1], this.attr[2], this.attr[3], this.attr[4]);
this.boundary = {this.attr[4] - (this.attr[4] / 5), this.attr[4] + (this.attr[4] / 5)};
this.flickerchange = this.attr[4] / 10;
this.onTimeout();
}
function onTimeout(){
this.alpha += this.flickerchange;
if(this.alpha in this.boundary){
this.flickerchange *= -1;
}
this.setTimer(0.05);
}
NPC script:
PHP Code:
this.join("levelitem_light_flicker");
function onCreated(){
//custom light image
this.setimg("light2.png");
//custom alpha
this.attr[4] = 0.25;
//neutralise red to make the colour whiter
this.attr[1] = 0.75;
}