|
How to stop my particle effect?
#244261
01/03/09 17:22
01/03/09 17:22
|
Joined: Jul 2008
Posts: 14 The Netherlands
Warkey
OP
Newbie
|
OP
Newbie
Joined: Jul 2008
Posts: 14
The Netherlands
|
The particle can be activated by pressing M on keyboard. Then the effect shows up in the air like firework. I would like if the radius is 200, then the effect needs to be invissible. But i dont know how to script this. VAR fireworkAnzahlPartikel = 1; //number of particles used for this effect
var radius = 0;
SOUND shellknal = <shellknal.wav>;
Function firework_spec_fun()
{
if(my.size > 0) { my.size -= 0.117 *time; }else{my.lifespan = 0; }
my.alpha -= 5 *time;
IF(My.alpha < 0) { my.alpha = 0; my.lifespan = 0; }
}
Function fireworkspezial()
{
my.blue = 233 ;
my.green = 156 ;
my.red = 250 ;
my.vel_x = random( 3 ) - 1.500 ;
my.vel_y = random( 3 ) - 1.500 ;
my.vel_z = random( 3 );
my.size = 4 ;
my.alpha = 50 ;
my.gravity = 0 ;
my.streak = off;
my.flare = on;
my.bright = on;
my.beam = off;
my.move = on;
my.transparent = on;
my.function = firework_spec_fun;
}
}
Function firework()
{
while(1)
{
fireworkAnzahlPartikel = 1;
my.skill9 = 0;
my.skill11 = 360 ;
if(radius >= 200){
// effect needs to stop but how to do it?
}
while (my.skill9 < my.skill11)
{
radius += 0.1;
temp.x = my.x + cos(my.skill9)*radius ;
temp.y = my.y + sin(my.skill9)*radius ;
temp.z = my.z;
my.skill9 += 15 ;
effect(fireworkspezial,max(1,int(fireworkAnzahlPartikel*time)),temp,nullvector);
}
wait(1);
}
}
action firework_action()
{
my.invisible = on;
My.passable = on;
while(!key_m) { wait(1); }
snd_play(shellknal,100,0);
firework();
} And when the effect is dissapered, it must be possible to show the particle effect again with M on the keyboard. Anyone can help me? Thanks! Regards, Warkey
|
|
|
Re: How to stop my particle effect?
[Re: Warkey]
#244265
01/03/09 17:47
01/03/09 17:47
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
action firework_action()
{
my.invisible = on;
My.passable = on;
while(1)
{
if(key_m){
snd_play(shellknal,100,0);
firework();
}
while(key_m){wait(1);}
wait(1);
}
}
this will allow you to repeat your fireworks with pressing the m key again
Ubi bene, ibi Patria.
|
|
|
Re: How to stop my particle effect?
[Re: Warkey]
#244282
01/03/09 20:04
01/03/09 20:04
|
Joined: Jan 2008
Posts: 1,580
Blade280891
Serious User
|
Serious User
Joined: Jan 2008
Posts: 1,580
|
shouldn't
while(key_m){wait(1);}
be
while(!key_m){wait(1);}
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
Re: How to stop my particle effect?
[Re: Blade280891]
#244284
01/03/09 20:12
01/03/09 20:12
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
on your way it wont work blade! it's standard method when you want to wait until user releases the button and presses it again to call that function again
btw, he got that problem solved
Last edited by cerberi_croman; 01/03/09 20:14.
Ubi bene, ibi Patria.
|
|
|
|