|
Varia Developer
|
 |
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
|
|
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() {
hideImgs( thiso.index, thiso.index+2);
thiso.ox = thiso.x;
thiso.oy = thiso.y;
thiso.setImgPart( "varia_bombplant.png", 0, 0, 16*2, 16*2);
thiso.canBePushed();
thiso.canBePulled();
thiso.setShape( 1, 32, 32);
thiso.blockAgain();
}
public function onStartBoom() {
if (thiso.boom == 0)
{
thiso.boom = 1;
sleep( 3);
for ( thiso.m = 0; thiso.m < 5; thiso.m++)
{
thiso.setImgPart( "varia_bombplant.png", 16*2, 0, 16*2, 16*2);
sleep( 0.1);
thiso.setImgPart( "varia_bombplant.png", 16*4, 0, 16*2, 16*2);
sleep( 0.1);
thiso.setImgPart( "varia_bombplant.png", 0, 0, 16*2, 16*2);
sleep( 0.1);
thiso.setImgPart( "varia_bombplant.png", 16*2, 0, 16*2, 16*2);
sleep( 0.1);
thiso.setImgPart( "varia_bombplant.png", 0, 0, 16*2, 16*2);
sleep( 0.1);
}
onStartQBoom();
}
}
public function onStartQBoom() {
Flame();
onTimeout();
sleep( 0.01);
thiso.setColorEffect( 1, 1, 1, 0.01);
play( "bomb.wav");
sleep( 0.01);
play( "bomb.wav");
sleep( 0.01);
play( "bomb.wav");
thiso.gx = { -2, -2, -2, 0, 0, +2, +2, +2};
thiso.gy = { -2, 0, +2, -2, +2, -2, 0, +2};
for ( i = 0; i < thiso.gx.size(); i++)
{
triggeraction( thiso.x + thiso.gx[ i], thiso.y + thiso.gy[ i], "explode", thiso.x, thiso.y, 4);
}
sleep( 0.2);
play( "spell_fire");
sleep( 2.77);
hideImgs( thiso.index, this.index+2);
thiso.hide();
thiso.setColorEffect( 1, 1, 1, 1);
setTimer( 0);
sleep( random( 4, 8));
ReGrow();
}
function ReGrow() {
thiso.x = thiso.ox;
thiso.y = thiso.oy;
thiso.show();
thiso.zoom = 0;
for ( thiso.j = 0; thiso.j < 9.5; thiso.j++)
{
thiso.setZoomEffect( thiso.zoom);
thiso.zoom += 0.1;
sleep( 0.05);
}
thiso.setZoomEffect( 1);
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 = { 0, 0, 0};
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 = degToRad( 0);
emitter.particle.zangle = degToRad( 0);
emitter.particle.speed = 6;
emitter.addlocalmodifier("once", 0, 0, "angle", "add", 2* degToRad( 0), degToRad( 360));
emitter.addlocalmodifier("range", 0, 0.5, "alpha", "replace", 0.99, 0);
emitter.addlocalmodifier("range", 0, 0.5, "zoom", "replace", 0.8, 0);
emitter.addlocalmodifier("range", 0, 0.5, "speed", "replace", 6, 20);
}
with (findimg( thiso.index+1)) {
layer = 0;
emitter.delaymin = 0.05;
emitter.delaymax = 0.05;
emitter.nrofparticles = 2;
emitter.firstinfront = false;
emitter.emissionoffset = { 0, 0, 0.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", 0, 0, "angle", "add", -0.1, 0.1);
emitter.addlocalmodifier("once", 0, 0, "x", "add", -0.1, 0.1);
emitter.addlocalmodifier("range", 0, 0.6, "alpha", "replace", 0.6, 0);
emitter.addlocalmodifier("range", 0, 0.3, "zoom", "replace", 1.5, 2.5);
emitter.addlocalmodifier("range", 0.3, 0.6, "zoom", "replace", 0.3, 0);
emitter.addlocalmodifier("range", 0, 0.6, "speed", "replace", 6, 10);
}
with (findimg(thiso.index+2)) {
layer = 1;
emitter.delaymin = 0.05;
emitter.delaymax = 0.05;
emitter.nrofparticles = 4;
emitter.firstinfront = false;
emitter.emissionoffset = { 0, 0, 0};
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", 0, 0, "angle", "add", -0.1, 0.1);
emitter.addlocalmodifier("once", 0, 0, "x", "add", -0.05, 0.05);
emitter.addlocalmodifier("range", 0, 0.6, "alpha", "replace", 0.6, 0);
emitter.addlocalmodifier("range", 0, 0.3, "zoom", "replace", 1, 2);
emitter.addlocalmodifier("range", 0.3, 0.6, "zoom", "replace", 0.2, 0);
emitter.addlocalmodifier("range", 0, 0.6, "speed", "replace", 6, 10);
}
}
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.x - 1, thiso.x + 3| &&
player.y in | thiso.y - 1, thiso.y + 3|) {
triggerServer( "weapon", "-PlayerControl", "Fire");
}
setTimer( 0.01);
}
|
__________________
Deep into the Darkness peering...
|
|