|
|
Re: Rainbox
[Re: xXxGuitar511]
#115223
03/09/07 00:36
03/09/07 00:36
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Hi, Still not able to stop the rain sound and the rain effect. Anything to stop an effect? effect(rainitspezial,max(1,int(rainitAnzahlPartikel*time)),MyPOS,nullvector); ... In this: Code:
while(1) { if (vec_dist(my.x, player.x) < my.skill1) { if (ObservationConditions == ocAverage) { rainit(); if(snd_playing(rainloop_handle)) { return; } else { rainloop_handle = snd_loop(rainloopnice,15,0); rainturnon = 1; //lightning_dist = 2000; //lightning_strike(); } if(snd_playing(thunderloop_handle)) { return; } else { thunderloop_handle = snd_loop(thunderloop,15,0); //rainturnon = 1; //lightning_dist = 2000; //lightning_strike(); } } if (ObservationConditions == ocGood) { rainit(); if(snd_playing(rainloop_handle)) { return; } else { rainloop_handle = snd_loop(rainloopnice,15,0); rainturnon = 1; //lightning_dist = 5000; lightning_strike(); } } } else { stopit(); } wait(1); } }
At the //no rain..., I wrote: Code:
stopit();
and here's my stopit function: Code:
function stopit() { snd_stop(rainloop_handle); //HOW DO I STOP THE RAIN PARTICLE EFFECT? }
Thanks again
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Rainbox
[Re: Marky Mark]
#115224
03/09/07 01:55
03/09/07 01:55
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Found the script, sent you an email...
As I said before, it's that damn while() loop... There is a way to terminate it though, which I didn't think of till now (sorry)...
But yeah, try out the file I sent you...
xXxGuitar511 - Programmer
|
|
|
Re: Rainbox
[Re: xXxGuitar511]
#115225
03/09/07 02:20
03/09/07 02:20
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Oh you found it  lets check it out
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Rainbox
[Re: xXxGuitar511]
#115228
03/09/07 03:09
03/09/07 03:09
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
It works yeah, but check out your maps EDIT Am I drunk? your maps? I mean.. Your mails 
Last edited by Marky Mark; 03/09/07 03:11.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Rainbox
[Re: Marky Mark]
#115229
03/09/07 03:21
03/09/07 03:21
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Quote:
It works very good, but just one thing. I added , if the conditions are GOOD, the execution of my function lightning_strike(). Now, when I run the game and enters in the area, it starts my lightning effect like if it was the end of the world lol. It's like the engine calls the function thousand times... Any idea?
Yeah, you should have it call the lightning function randomly, instead of every frame. Could you post the code for your lightning function. We'll keep the modifications inside that...
xXxGuitar511 - Programmer
|
|
|
Re: Rainbox
[Re: xXxGuitar511]
#115230
03/09/07 03:41
03/09/07 03:41
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Here you go... Code:
function lightning_strike() { while(1) { if (random(1) > 0.985 && lightning_on == 1) //0.9 {
pos_pick = int(random(num_of_pos_ents)+1); //get a random pos ent num neg_pick = int(random(num_of_neg_ents)+1); //get a random neg ent num
pos_flag = 0; counter = 1; you = ent_next(NULL); //get first entity while(you != 0 && pos_flag == 0) { if(you.skill1 == 1 && counter == pos_pick) { vec_set(line_start.x, you.x); pos_flag = 1; cloud = you; } if(you.skill1 == 1 && counter != pos_pick) { not_cloud = you; } counter += 1; you = ent_next(YOU); //get next entity }
neg_flag = 0; counter = 1; you = ent_next(NULL); //get first entity while(you != 0 && neg_flag == 0) { if(you.skill1 == 2 && counter == neg_pick)///// { vec_set(line_end.x, you.x); neg_flag = 1; } counter += 1; you = ent_next(YOU); //get next entity }
if(vec_dist(line_start.x, line_end.x) < 6000)// strike only if closer than 325 { //create lightning bolt lightning_effect();
//flash cloud cloud.red = 128; // set amount of red in flash here cloud.green = 128; // set amount of green in flash here cloud.blue = 255; // set amount of blue in flash here cloud.light = on; cloud.lightrange = flash_dist; wait(2);
//play random thunder thunder_choice = int(random(6)); // returns whole numbers 0 to 5 if(thunder_choice == 0 || thunder_choice == 3){ent_playsound(cloud, thunder1, snd_dist);} if(thunder_choice == 1 || thunder_choice == 4){ent_playsound(cloud, thunder2, snd_dist);} if(thunder_choice == 2 || thunder_choice == 5){ent_playsound(cloud, thunder3, snd_dist);}
//turn off cloud flash cloud.light = off; cloud.lightrange = 0; } } wait (1); } }
There are some functions related to that, but I don't think you need them.
Last edited by Marky Mark; 03/09/07 03:42.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Rainbox
[Re: Marky Mark]
#115231
03/09/07 04:05
03/09/07 04:05
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
lol, once again, remove the while() loop... Thats the only problem I see... If you leave it in there, then another instance of this function will be created in every frame from the other while() loop thats calling it... This will cause it to run 1 more time for each frame, eventually causing an overload... 
xXxGuitar511 - Programmer
|
|
|
Re: Rainbox
[Re: xXxGuitar511]
#115232
03/09/07 04:07
03/09/07 04:07
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Ok so because of the new code you sent me, this new one do the loop job so I dont need this one? Thanks i'll try.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|