//Waterfall Particle Effects
//By Brandon R. Batie (aka AcidCrow)
//AcidCrew Software - http://www.acidcrewsoftware.com

//NOTES
///////
//This isn't a well commented script (I've never been good at that).
//Assign to an object in WED. Under the objects properties set skill1 to the life span (fall distance) and
//skill2 to the spray distance (usually pretty close to skill1.

bmap blue_map, <blue1.tga>;
bmap green_map, <rauch.tga>;
var my_life;
var my_spray;
var my_skill1;
var my_skill2;

function water_spray
{
if(my_age == 0)
{
my_speed.y = random(1) - .45;
my_speed.x = random(1) - .75;
my_speed.z = random(1) - 0.5;
my_size = random(150)+50;
my_map = green_map;
my_flare = on;
my_alpha = on;
end;
}

if(my_age > 10)
{
my_alpha = 21 - my_age * 3;} else { 
my_alpha = my_age * 10; }
if(my_age > 20){my_action = null;}
}


function water_fall_particles
{
if(my_age == 0){
my_speed.y = random(1) / 5;
my_speed.z = random(1) - 2; 
my_size = random(250)+550;
my_map = blue_map;
my_flare = on;
my_alpha = on;
end;
}
if (my_age > 40) {
my_alpha = 71 - my_age * 3;
} else { 
my_alpha = my_age * 10; 
}
my_spray = random(2) + 5;
my_life = random(10) + 49;
if(my_age > my_skill2 && my_speed.z < -1.5){{emit(my_spray,my_pos,water_spray);}
if(my_age > my_skill1){my_action = null;}
}

action waterfall
{
my_skill1 = my.skill1;
my_skill2 = my.skill2;
wait(1);
while(1){emit(1,my.pos,water_fall_particles);
wait(1);}
}
