Results 1 to 7 of 7

Thread: Urgent Help on a Strobe Effect

  1. #1

    Urgent Help on a Strobe Effect

    I cant get this to work... Someone please help lol


    HTML Code:
    function onActionServerSide(cmd){
    if (cmd == "Strobe"){
    show;
    triggerClient("gui",this.name,"Strobe");
    }
    if (cmd == "StrobeOff"){
    echo(temp.test);
    triggerClient("gui",this.name,"StrobeOff");
    hide;
     }
    }
    //#CLIENTSIDE
    function onPlayerChats() {
    if (player.chat == "/strobeoff"){
    hide;
    temp.test = "Testing Script";
    triggerserver("gui",this,name,"StrobeOff",temp.test);
    }
    if (player.chat == "/strobe"){
    show;
    settimer(0.1);
    triggerserver("gui",this.name,"Strobe");
      }
    }
    function onActionClientSide(cmd) {
    if (cmd == "Strobe"){
     onTimeout();
      }
    if (cmd == "StrobeOff"){
    hide;
    )
    }
    function onTimeout(){
    this.zoom = 60;
      this.alpha = 0.05;
      this.red = 0.8;
      this.blue = 0;
      this.green = 1;
      sleep(0.1);
      this.red = 0;
      this.blue = 0;
      this.green = 0;
      setTimer(0.1);
      }
    Last edited by Frenzy; 07-18-2013 at 07:30 AM.
    iEra SFX Artist

    Music for life

  2. #2
    Can you put it in HTML format so it's easier to read?
    Just put [ HTML ] before and [ /HTML ] after your code

  3. #3
    There you go
    iEra SFX Artist

    Music for life

  4. #4
    Thanks, but it's too bad I don't do gs2 so I can't help you :[

  5. #5
    put it into PHP please and style the code

    PHP Code:
    function onActionServerSide(cmd){
      if (
    cmd == "Strobe"){
        
    show;
        
    triggerClient("gui",this.name,"Strobe");
      }
      if (
    cmd == "StrobeOff"){
        echo(
    temp.test);
        
    triggerClient("gui",this.name,"StrobeOff");
        
    hide;
      }
    }
    //#CLIENTSIDE
    function onPlayerChats() {
      if (
    player.chat == "/strobeoff"){
        
    hide;
        
    temp.test "Testing Script";
        
    triggerserver("gui",this,name,"StrobeOff",temp.test);
      }
      if (
    player.chat == "/strobe"){
        
    show;
        
    settimer(0.1);
        
    triggerserver("gui",this.name,"Strobe");
      }
    }
    function 
    onActionClientSide(cmd) {
      if (
    cmd == "Strobe"){
        
    onTimeout();
      }
      if (
    cmd == "StrobeOff"){
        
    hide;
        )
          }
      function 
    onTimeout(){
        
    this.zoom 60;
        
    this.alpha 0.05;
        
    this.red 0.8;
        
    this.blue 0;
        
    this.green 1;
        
    sleep(0.1);
        
    this.red 0;
        
    this.blue 0;
        
    this.green 0;
        
    setTimer(0.1);
      } 
    1. temp.test is not defined on the serversde part, therefore nothing can be echo'd (most likely a 0 will apear)
    2. the way you use show and hide is gs1, so make sure to use gs2 by changing it to show() and hide()
    3. on the onActionClientSide() part, you are having one invalid ')' and one '}' missing
    4. in case this is a weapon, you cant just change this.zoom/alpha/red/blue...., nothing would change
    in case this is a level npc, you can't just use triggerserver() to get to the serverside part (same for triggerclient()). you would need to use triggerAction() to access the server-/clientside part of the script
    5. the only real use you seem to have for the serverside part is that you are displaying the npc to other players, yet they wouldnt see the effect. let me make a fixed version for you


    this is a level npc - not a weapon
    PHP Code:
    function onCreated() {
        
    //create a blocking shape for the npc so triggerAction() will work
      
    this.setshape(1,32,32);
    }

    function 
    onPlayerChats() {
      if (
    player.chat == "/strobe"createEffect();
      else if (
    player.chat == "/strobeOff"disableEffect();
    }

    function 
    createEffect() {
        
    //attr[] is always synced to serverside and clientside, so i will use this to store the information for everyone
      
    this.attr[1] = "enabled";
        
    //trigger the action for the clientside part, having the effect serverside will just lag the server
      
    triggerAction(this.xthis.y"StrobeToggle"NULL);
    }

    function 
    disableEffect() {
      
    this.attr[1] = "disabled";
      
    triggerAction(this.xthis.y"StrobeToggle"NULL);
    }

    //#CLIENTSIDE
    function onPlayerEnters() {
      
    this.setshape(1,32,32);
        
    //we are having the checks in the onTimeOut() function
        //like i mentioned, attributes are synced to client- and serverside, so stored information will be seen by everyone
      
    onTimeOut();
    }

    function 
    onActionStrobeToggle() {
      
    onTimeOut();
    }

    function 
    onTimeout(){
        
    //if the effect is stoped, discontinue the loop
      
    if (this.attr[1] == "disabled") return;

        
    //else we can just continue everything
      
    this.zoom 60;
      
    this.alpha 0.05;
      
    this.red 0.8;
      
    this.blue 0;
      
    this.green 1;

      
    sleep(0.1);

      
    this.red 0;
      
    this.blue 0;
      
    this.green 0;

      
    setTimer(0.1);


    ps: you dont seem to have any image set or whatever, you should change that

  6. #6
    ily calli, can't wait to come back and see everyone again. i miss graal scripting ;D

  7. #7
    Thanks Calli I will try this and look at what you did ;D
    iEra SFX Artist

    Music for life

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •