View Single Post
  #7  
Old 08-13-2007, 06:32 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Well, there's probably many ways to optimize this script so please tell me how CONSTRUCTIVELY but here's the script, it's a basic bomb plant.

Note: I'm am not handing out this script to others servers. If you can learn from it, good, do so. BUT DO NOT STEAL IT!

sorry for all the rude legal stuff guys but I really love this script and dont want it be stolen.

PHP Code:
// Scripted by Jex Varia for the Server Varia
//#CLIENTSIDE
function onCreated() {
  
hideImgsthiso.indexthiso.index+2);
  
thiso.ox thiso.x;
  
thiso.oy thiso.y;
  
thiso.setImgPart"varia_bombplant.png"0016*216*2);
  
thiso.canBePushed();
  
thiso.canBePulled();
  
thiso.setShape13232);
  
thiso.blockAgain();
}

public function 
onStartBoom() {
  if (
thiso.boom == 0)
  {
    
thiso.boom 1;

    
sleep3);

    for ( 
thiso.0thiso.5thiso.m++)
    {
      
thiso.setImgPart"varia_bombplant.png"16*2016*216*2);
      
sleep0.1);
      
thiso.setImgPart"varia_bombplant.png"16*4016*216*2);
      
sleep0.1);
      
thiso.setImgPart"varia_bombplant.png"0016*216*2);
      
sleep0.1);
      
thiso.setImgPart"varia_bombplant.png"16*2016*216*2);
      
sleep0.1);
      
thiso.setImgPart"varia_bombplant.png"0016*216*2);
      
sleep0.1);
    }

    
onStartQBoom();
  }
}


public function 
onStartQBoom() {
  
Flame();
  
onTimeout();
  
sleep0.01);
  
thiso.setColorEffect1110.01);
  
play"bomb.wav");
  
sleep0.01);
  
play"bomb.wav");
  
sleep0.01);
  
play"bomb.wav");
  
thiso.gx = { -2, -2, -200, +2, +2, +2};
  
thiso.gy = { -20, +2, -2, +2, -20, +2};

  for ( 
0thiso.gx.size(); i++)
  {
    
triggeractionthiso.thiso.gxi], thiso.thiso.gyi], "explode"thiso.xthiso.y4);
  }
  
  
sleep0.2);
  
play"spell_fire");
  
sleep2.77);
  
hideImgsthiso.indexthis.index+2);
  
thiso.hide();
  
thiso.setColorEffect1111);
  
setTimer0);
  
sleeprandom48));
  
ReGrow();
}

function 
ReGrow() {
  
thiso.thiso.ox;
  
thiso.thiso.oy;
  
thiso.show();
  
thiso.zoom 0;

  for ( 
thiso.0thiso.9.5thiso.j++)
  {
    
thiso.setZoomEffectthiso.zoom);
    
thiso.zoom += 0.1;
    
sleep0.05);
  }

  
thiso.setZoomEffect1);

  
thiso.boom 0;

  
onCreated();
}


function 
Flame() {
  
with (findimg(thiso.index)) {
    
layer 2;
    
emitter.delaymin 0.05;
    
emitter.delaymax 0.05;
    
emitter.nrofparticles 4;
    
emitter.firstinfront false;
    
emitter.emissionoffset = { 000};

    
emitter.particle.lifetime 0.5;
    
emitter.particle.image "light2s.png";

    
emitter.particle.red 1;
    
emitter.particle.green 0;
    
emitter.particle.blue 0;
    
emitter.particle.alpha 0.99;
    
emitter.particle.zoom 0.2;
    
emitter.particle.mode 0;

    
emitter.particle.angle degToRad0);
    
emitter.particle.zangle degToRad0);
    
emitter.particle.speed 6;
    
emitter.addlocalmodifier("once"00"angle""add"2degToRad0), degToRad360));
    
emitter.addlocalmodifier("range"00.5"alpha""replace"0.990);
    
emitter.addlocalmodifier("range"00.5"zoom""replace"0.80);
    
emitter.addlocalmodifier("range"00.5"speed""replace"620);
  }

  
with (findimgthiso.index+1)) {
    
layer 0;
    
emitter.delaymin 0.05;
    
emitter.delaymax 0.05;
    
emitter.nrofparticles 2;
    
emitter.firstinfront false;
    
emitter.emissionoffset = { 000.3};

    
emitter.particle.lifetime 0.6;
    
emitter.particle.image "g4_animation_fire.gif";

    
emitter.particle.alpha 0.6;
    
emitter.particle.zoom 0.3;
    
emitter.particle.mode 2;

    
emitter.particle.angle pi 2;
    
emitter.particle.speed 6;
    
emitter.addlocalmodifier("once"00"angle""add", -0.10.1);
    
emitter.addlocalmodifier("once"00"x""add", -0.10.1);
    
emitter.addlocalmodifier("range"00.6"alpha""replace"0.60);
    
emitter.addlocalmodifier("range"00.3"zoom""replace"1.52.5);
    
emitter.addlocalmodifier("range"0.30.6"zoom""replace"0.30);
    
emitter.addlocalmodifier("range"00.6"speed""replace"610);
  }

  
with (findimg(thiso.index+2)) {
    
layer 1;
    
emitter.delaymin 0.05;
    
emitter.delaymax 0.05;
    
emitter.nrofparticles 4;
    
emitter.firstinfront false;
    
emitter.emissionoffset = { 000};

    
emitter.particle.lifetime 0.6;
    
emitter.particle.image "g4_animation_fire.gif";

    
emitter.particle.red 1;
    
emitter.particle.green 0.5;
    
emitter.particle.blue 0.5;
    
emitter.particle.alpha 0.6;
    
emitter.particle.zoom 0.2;
    
emitter.particle.mode 0// add like a light

    
emitter.particle.angle pi 2;
    
emitter.particle.speed 6;
    
emitter.addlocalmodifier("once"00"angle""add", -0.10.1);
    
emitter.addlocalmodifier("once"00"x""add", -0.050.05);
    
emitter.addlocalmodifier("range"00.6"alpha""replace"0.60);
    
emitter.addlocalmodifier("range"00.3"zoom""replace"12);
    
emitter.addlocalmodifier("range"0.30.6"zoom""replace"0.20);
    
emitter.addlocalmodifier("range"00.6"speed""replace"610);
  }

}

function 
onActionPulled()
onStartBoom();

function 
onActionPushed()
onStartBoom();

function 
onWa****() {
  
thiso.boom 1;
  
onStartQBoom();
}

function 
onActionExplode() {
  if ( 
thiso.boom == 0)
  {
    
thiso.boom 1;
    
onStartQBoom();
  }
}

function 
onTimeout() {
  if ( 
player.x in thiso.1thiso.3| &&
       
player.y in thiso.1thiso.3|) {
    
triggerServer"weapon""-PlayerControl""Fire");
  }
  
  
setTimer0.01);

__________________
Deep into the Darkness peering...
Reply With Quote