Rainbox

Posted By: Marky Mark

Rainbox - 03/05/07 16:20

Anyone ever experienced a box that when you enters in that invisible box, the rain starts and a rain sound starts, then when you go out of the box, the rain stops and the sound stops? I could also add a luminosity drop when you enter the box...

Any idea of how to do this? Thanks!

EDIT: my player is the Newton car, so i dont know if the collision system is the same... anyway.. thanks in advance
Posted By: xXxGuitar511

Re: Rainbox - 03/05/07 16:42

Collision won't be a problem. The best way to do it would probably not by collision, but by distance. If the car is within range of an entity, then run the rain effects...
Posted By: Marky Mark

Re: Rainbox - 03/05/07 16:52

ok so let's say i have my cloud entity, i dont need any box? I just need to use the distance of the cloud entity?

ok if so... hum,.. any example ?
Posted By: xXxGuitar511

Re: Rainbox - 03/05/07 17:01

Code:

ACTION Cloud
{
// Range to scan for rain...
my.skill1 = 5000;
//
while(1)
{
if (vec_dist(my.x, player.x) < my.skill1)
{
// Rain...
}
else
{
// No Rain...
}
wait(1);
}
}


Posted By: Marky Mark

Re: Rainbox - 03/05/07 17:40

thanks!
Posted By: Marky Mark

Re: Rainbox - 03/05/07 18:15

hum.. i get an error

Code:

while(1)
{
if (vec_dist(my.x, player.x) < my.skill1)
{
// Rain...
rainit();
}
else
{
// No Rain...
}
wait(1);
}



Here's the error:


Note that my car action that is newtonvehicle have the line "player = my;"

Thanks
Posted By: Marky Mark

Re: Rainbox - 03/05/07 18:43

EDIT: Works.

one more thing:

My rain looks bad. I want a simple particles script that makes rain falls, but here is some bad things:

When i do a fast 180 degrees, i can see that it was not raining beside me (then it starts) ...

The rain looks intermittent: It goes by a bunch of particles, then when they are all finished, a new bunch arrives from the sky...

I made a simple script with easyparticle 3...

Thanks to help again
Posted By: xXxGuitar511

Re: Rainbox - 03/06/07 00:03

The problem with the "grouping" of particles is caused by having more particles than your "var max_particles" is set. Just open the display00.wdl and increase this value until it looks smoother.

I myself am not a big fan of easy-particles. It is nice for creating ideas, and previes for an effect, but not good for a final product. The best way that I found to create nice rain particles was to create a simple (round) dot with an alpha channel, and then use the "streak" flag so that it stretched it out to form a verticles line (as if it were stretched from falling).
Posted By: Marky Mark

Re: Rainbox - 03/06/07 00:07

will it work with extra?

and maybe you could show me how you do?
Posted By: xXxGuitar511

Re: Rainbox - 03/06/07 00:30

Ah, sorry. The streak flag is comm and pro only...

But the max particles thing isn't...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 00:36

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
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 01:55

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...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 02:20

Oh you found it lets check it out
Posted By: Marky Mark

Re: Rainbox - 03/09/07 02:27

You are a god?
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 02:31

lol, it works then?...

no, not a god. I am the doG...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 03:09

It works yeah, but check out your maps

EDIT
Am I drunk? your maps? I mean.. Your mails
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 03:21

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...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 03:41

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.
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 04:05

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...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 04:07

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.
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 04:17

Rightm take the while() loop out of lightning_strike()
Posted By: Marky Mark

Re: Rainbox - 03/09/07 05:34

It works great. I'll say it again. You are god
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 06:21

lol - thanks man...

You need anymore help with your StormChaser project, let me know...

even if you need "guitar music" for recreating that one scene in twister, lol. They don't call me Guitar for nothing...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 06:22

LOL hehe

I got a question for another work on the project.. maybe I should start a new topic, but anyway. If I want my whole storm system to move... Can I just group the whole package, and make this group move? (certainly not, nothing is easy.. )

Thanks
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 06:27

Hmm... please be more specific. I'm not quite following you...

You want to move the clouds [which hold the storm], or just the location of the storms center?
Posted By: Marky Mark

Re: Rainbox - 03/09/07 06:31

I want to move the whole storm cloud, including the lightning strikes generator objects and the rain curtain generator object.. I want all of this to be moveable by a function, so everything realted to the storm cloud would be depending on the function which moves the object in a direction (very slowly) .. Cause you know, my storm is currently not moving and that's not very good for realism
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 06:37

Well, you'll have to move the clouds then...

All of the effects [lightning, rain, sound, etc] are based on the clouds position, so you will simply have to move the clouds.

My next concern is, do you plan on having more than one storm at a time in the level? If no, then moving the storm will be very simple. If yes, then I'll have to take a look at more code...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 06:46

No i dont think I will have more than 1 storm at a time, but sometimes I will need a bigger one, i could just stretch it instead of adding a copy of it. The lightning strikes are not based on my cloud model, its invisible box that moves under the storm, and some in the clouds, then it makes like a positive with a negative contact, so the lightning strike appears between 2 cubes.. So I will have to move those cubes too.
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 06:59

ok, here's my plan...

Create an entity for the center of the storm. Then place this (in WED), in the center of your storm . Then, during the first cycle of the [clouds, lightning cubes, etc] action, they will find their offset from the storm center, and save it in a skill (or three).

var StromScale = 1;

ACTION StormCenter
{
StormC = my;
}

ACTION Cloud [lightning, etc]
{
wait(1);
vec_diff(temp, my.x, StormC.x);
vec_set(my.skill50, temp);
...
while(1)
{
...
vec_set(my.x, StormC.x);
vec_set(temp, my.skill50);
vec_scale(temp, StormScale);
vec_add(my.x, temp);
...
wait(1);
}
}


Then you'd just use another function to move around StormC.x, and all else will follow... plus you can also set the StormScale value to scale the storm...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 07:14

But then if I move the storm center, the other objects would keep their distance with the center? and for the stormscale, how does it works?
Posted By: xXxGuitar511

Re: Rainbox - 03/09/07 07:21

keep their distance from the center [of the storm], yes.

If you set StormScale to "1", then the "pieces" of the storm would be in normal position away from storm center. If you set it to "3", then each piece would be 3 times its normal distance from the center... The only downfall to this, is that it is actually just spreading the pieces away from each other, so it would make the storm bigeer, but "thinner" as well... However, this could be fixed...
Posted By: Marky Mark

Re: Rainbox - 03/09/07 07:24

Ok thanks, I will try some things with your plan .
© 2023 lite-C Forums