Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Light Changing Script for Lightshow (https://forums.graalonline.com/forums/showthread.php?t=85963)

Struggler 05-29-2009 09:43 AM

Light Changing Script for Lightshow
 
I made this for my lvl but dont know whats wrong, I tried using all players and just making it clientside, but it only affects the player who said it... Can someone help me out here? Make it so that when I say /lightson I'm not the only one viewing the lightshow?
PHP Code:

function onActionlightshow(){
  
pl.seteffect(0,0,0.2,0.1);
  
sleep(0.2);
  
pl.seteffect(0,0.2,0,0.1);
  
sleep(0.2);
  
pl.seteffect(0.2,0,0,0.1);
}
//#CLIENTSIDE
function onCreated(){
  
this.on false;
}
function 
onPlayerChats(){
  if(
player.chat.starts("/play")){
    
this.playing true;
    
setTimer(0.2);
  }
  if(
player.chat.starts("/stop")){
    
this.playing false;
    
seteffect(0,0,0,0);
    
setTimer(NULL);
  }
  if(
player.chat == "/lightsoff"){
    if(
player.guild == "Tree Bar Crew"){
      
seteffect(0,0,0,0);
      
player.chat "Light effects turned off.";
      
this.on false;
    }
  }
  else if (
player.chat == "/lightson"){
    if(
player.guild == "Tree Bar Crew"){
      if(
this.playing == true){
        
player.chat "Light effects turned on.";
        
this.on true;
        
setTimer(0.2);
      }else{
        
player.chat "Light effects turned on.";
        
this.on true;
      }
    }
  }
}
function 
onTimeout(){
  if(
this.on == true){
    for(
temp.plallplayers){
      if(
pl.level == "struggler-treehideout.nw"){
        
pl.triggeraction(this.x,this.y,"lightshow",NULL);
        
pl.seteffect(0,0,0.2,0.1);
        
sleep(0.2);
        
pl.seteffect(0,0.2,0,0.1);
        
sleep(0.2);
        
pl.seteffect(0.2,0,0,0.1);
        
setTimer(0.2);
      }
    }
  }



zokemon 05-29-2009 12:35 PM

seteffect doesn't work serverside.

Try this: In your serverside function, try setting a save array member such as this.save[0] = 1.

the save variable is passed from serverside to all clients so when you set it on the server, all players will see the changes clientside.

Then just have a timeout or so check that variable to see if it has changed at all.


All times are GMT +2. The time now is 08:27 PM.

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