|
Re: The Tornado
[Re: Scorpion]
#116081
03/09/07 21:40
03/09/07 21:40
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
a collision detection system would be (hard i know) great! When the tornado collides with an entity, we could add an ent_create that creates roof parts turn around the tornado but not going to the center of the twister, so it moves away, and dissapear. Also , a kind of big dust cloud on the ground would be nice. Oh, and sound ![](/ubbthreads/images/graemlins/smile.gif) I can provide a sound, i'll post back with it Thanks, god #2 ![](/ubbthreads/images/graemlins/smile.gif) (xXxGuitar is the 1st)
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: The Tornado
[Re: Marky Mark]
#116082
03/09/07 22:04
03/09/07 22:04
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
ok, i made the dust, but i am not 100% sure what you mean how 2 do it wiht the roof etc...i can make that there fly around some smaller object at the begin...thats easy Download new Code:
bmap tornado_bmap = <sprite.tga>; bmap small_bmap = <particle.tga>;
function tornado_particles; function small_particle;
function tornado_sprite() { var distance; var distance_add; var max_alpha = 40; my.facing = on; my.transparent=on; my.alpha=0; my.passable = on; my.unlit=on; my.light=on; my.red=70; my.green=50; my.blue=30; while(my.skill3 == 0) { wait(1); } distance_add=random(0.7); while(1) { distance + = distance_add*time; my.skill2 + = my.skill1 * time; you = ptr_for_handle(my.skill3); if(abs(my.z-your.z)>1000) { my.alpha-=0.5*time; if(my.alpha < 0){wait(1);ent_remove(me);return;} } else { my.alpha = min(my.alpha+time,max_alpha); } my.x = sin(my.skill2)*distance + you.x+20*sin(my.z+your.pan); my.y = cos(my.skill2)*distance + you.y+20*sin(my.z+your.pan); my.z += random(5)*time; if(total_ticks%5<1)//all 5 ticks { my.scale_x += 0.002; my.scale_y += 0.002; } if(random(40)>39.9) { effect(tornado_particles,2,my.x,nullvector); } my.roll + = my.skill1*time; wait(1); } }
function move_tornado { var position[3]; var new_pos[3]; new_pos.x=random(5)-2.5; new_pos.y=random(5)-2.5; while(1) { if(random(10)>9.9)//new dir { new_pos.x=random(5)-2.5; new_pos.y=random(5)-2.5; } position.x += (new_pos.x-position.x)*0.1*time; position.y += (new_pos.y-position.y)*0.1*time; my.x += position.x*time; my.y += position.y*time; my.pan+=5*time; wait(1); } }
function tornado_paritcle_func { if(my.skill_a==1) { my.alpha+=time; if(my.alpha>5) { my.skill_a=0; } } else { my.alpha-=time; } my.size += 20*time; my.x = your.x - 10*sin(total_ticks); my.y = your.y - 10*cos(total_ticks); effect(small_particle,1,vector(my.x+50-random(100),my.y+50-random(100),my.z+50-random(100)),vector(0,0,-0.125)); if(my.alpha<0) { my.lifespan=0; } }
function tornado_particles { my.bmap = tornado_bmap; my.function=tornado_paritcle_func; my.transparent=on; my.size = 200; my.alpha=0; my.skill_a=1; my.red=20; my.green=10; my.blue=5; }
function small_particle_func { my.alpha-=time; my.x = your.x +50-random(100); my.y = your.y +50-random(100); if(my.alpha<0) { my.lifespan=0; } }
function small_particle { my.size=0.5; my.function = small_particle_func; my.red=20; my.green=10; my.blue=0; my.bmap = small_bmap; my.streak=on; my.move=on; my.transparent = on; }
function dust_func { my.alpha-=time; my.size+=time; if(my.alpha<0) { my.lifespan=0; } }
function dust { my.size = 50; my.function = dust_func; my.bmap = tornado_bmap; my.vel_x = 4-random(8); my.vel_y = 4-random(8); my.vel_z = random(1); my.move = on; my.transparent = on; my.alpha=40; my.red=40; my.green=25; my.blue=12.5; }
action tornado() { my.passable = on; my.invisible = on; //move_me here^^ move_tornado(); while(1) { you = ent_create("sprite.tga",my.x,tornado_sprite); you.skill1 = random(10)+2; you.skill2 = random(360); you.scale_x = 0.125; you.scale_y = you.scale_x; you.skill3 = handle(my); effect(dust,1,my.x,nullvector); wait(-random(0.2)); } }
function main { fps_max=75; level_load("tornado.wmb"); wait(3); randomize(); while(1) { camera.pan -= mouse_force.x; camera.tilt += mouse_force.y; temp.x = (key_w-key_s+mickey.z/10)*15*time; temp.y = (key_a-key_d)*15*time; temp.z = 0; vec_rotate(temp,camera.pan); vec_add(camera.x,temp); wait(1); } }
|
|
|
Re: The Tornado
[Re: Scorpion]
#116083
03/09/07 22:21
03/09/07 22:21
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
I mean, you know, when a tornado hits a building, the building looses his roof, gets destroyed, etc. So the roof parts fly in the tornado then fall somewhere at the ground...
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: The Tornado
[Re: Marky Mark]
#116084
03/09/07 22:25
03/09/07 22:25
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
yes i know, but how did you imagine that exactly? if you model your houses in parts we could make( if they collide) a random positon and then let em fly, the flying issnt the problem then, ill try it...
but may you tell me more exactly what shall happen with the opject wehn it is in the tornado? shall it cycle till it is on top and then fall down or shall it no stop cycle around....
Last edited by Scorpion; 03/09/07 22:33.
|
|
|
Re: The Tornado
[Re: Scorpion]
#116085
03/09/07 22:48
03/09/07 22:48
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
I want it to cycle till its on top then fall down.
For destructiong a building, I dont really know how.. I'm using 1 model for a building..
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: The Tornado
[Re: Marky Mark]
#116088
03/10/07 16:39
03/10/07 16:39
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
i have the script now, but it is not perfect, i hope someone know a solution.... Code:
bmap tornado_bmap = <sprite.tga>; bmap small_bmap = <particle.tga>;
function tornado_particles; function small_particle; function destoyed_object_event;
var flying_objects[100];//max 100 var nbr_flying_obj=0;
entity* tornado_ent;
function tornado_sprite() { var distance; var distance_add; var max_alpha = 40; my.facing = on; my.transparent=on; my.alpha=0; my.passable = on; my.unlit=on; my.light=on; my.red=70; my.green=50; my.blue=30; while(my.skill3 == 0) { wait(1); } distance_add=random(0.7); while(1) { distance + = distance_add*time; my.skill2 + = my.skill1 * time; you = ptr_for_handle(my.skill3); if(abs(my.z-your.z)>1000) { my.alpha-=0.5*time; if(my.alpha < 0){wait(1);ent_remove(me);return;} } else { my.alpha = min(my.alpha+time,max_alpha); } my.x = sin(my.skill2)*distance + you.x+20*sin(my.z+your.pan); my.y = cos(my.skill2)*distance + you.y+20*sin(my.z+your.pan); my.z += random(5)*time; if(total_ticks%5<1)//all 5 ticks { my.scale_x += 0.002; my.scale_y += 0.002; } if(random(40)>39.9) { effect(tornado_particles,2,my.x,nullvector); } my.roll + = my.skill1*time; wait(1); } }
function move_tornado { var middle[3]; var position[3]; var new_pos[3]; new_pos.x=random(5)-2.5; new_pos.y=random(5)-2.5; my.passable=on; wait(-10); my.passable=off; vec_set(middle,my.x); while(1) { if(random(10)>9.9)//new dir { new_pos.x=random(10)-5; new_pos.y=random(10)-5; } position.x += (new_pos.x-position.x)*0.1*time; position.y += (new_pos.y-position.y)*0.1*time; c_move(me,nullvector,vector(position.x*time,position.y*time,0),glide + ignore_push); c_rotate(me,vector(5*time,0,0),ignore_passable + ignore_push); wait(1); } }
function tornado_paritcle_func { if(my.skill_a==1) { my.alpha+=time; if(my.alpha>5) { my.skill_a=0; } } else { my.alpha-=time; } my.size += 20*time; my.x = your.x - 10*sin(total_ticks); my.y = your.y - 10*cos(total_ticks); effect(small_particle,1,vector(my.x+50-random(100),my.y+50-random(100),my.z+50-random(100)),vector(0,0,-0.125)); if(my.alpha<0) { my.lifespan=0; } }
function tornado_particles { my.bmap = tornado_bmap; my.function=tornado_paritcle_func; my.transparent=on; my.size = 200; my.alpha=0; my.skill_a=1; my.red=20; my.green=10; my.blue=5; }
function small_particle_func { my.alpha-=time; my.x = your.x +50-random(100); my.y = your.y +50-random(100); if(my.alpha<0) { my.lifespan=0; } }
function small_particle { my.size=0.5; my.function = small_particle_func; my.red=20; my.green=10; my.blue=0; my.bmap = small_bmap; my.streak=on; my.move=on; my.transparent = on; }
function dust_func { my.alpha-=time; my.size+=time; if(my.alpha<0) { my.lifespan=0; } }
function dust { my.size = 50; my.function = dust_func; my.bmap = tornado_bmap; my.vel_x = 4-random(8); my.vel_y = 4-random(8); my.vel_z = random(1); my.move = on; my.transparent = on; my.alpha=40; my.red=40; my.green=25; my.blue=12.5; }
function fall_down_event { if(event_type==event_block||event_type==event_impact) { vec_scale(bounce,0.3); if(vec_length(bounce)<1) { my.event=null; } vec_Set(my.skill2,bounce); } }
function fall_down(ent) { me=ent; my.passable = off; my.enable_block = on; my.enable_impact = on; my.event = fall_down_event; var position[3]; vec_Set(my.skill2,vector(tornado_ent.x-my.x,tornado_ent.y-my.y,0)); vec_normalize(my.skill2,5); my.skill4 = 5; my.skill1/=36; while(1) { my.skill4 -= 0.5*time; c_move(me,nullvector,my.skill2,glide); if(vec_length(my_speed)<1&&my.skill4<-5) { my.tilt%=360; my.tilt -= my.tilt*0.1; if(my.tilt<1) { my.skill1 = random(360); my.event = destoyed_object_event; return; } } else { c_rotate(me,vector(my.skill1*time,my.skill1*time,0),ignore_passable); } wait(1); } }
function control_flying_object { var i; while(1) { i=0; while(i<nbr_flying_obj) { you=flying_objects[i]; your.z += 16*time; your.x = (tornado_ent.x-fsin(2*tornado_ent.pan+your.skill1,your.skill1/2)); your.y = (tornado_ent.y-fcos(2*tornado_ent.pan+your.skill1,your.skill1/2)); your.pan += your.skill1/360; your.tilt += your.skill1/360; if(abs(tornado_ent.z-your.z)>1000) { fall_down(you); flying_objects[i]=flying_objects[nbr_flying_obj-1]; flying_objects[nbr_flying_obj-1]=0; nbr_flying_obj-=1; } i+=1; } wait(1); } }
action tornado() { tornado_ent = me; my.push = 10; //my.passable = on; my.invisible = on; //move_me here^^ move_tornado(); wait(1); c_setminmax(me); while(1) { you = ent_create("sprite.tga",my.x,tornado_sprite); you.skill1 = random(10)+2; you.skill2 = random(360); you.scale_x = 0.125; you.scale_y = you.scale_x; you.skill3 = handle(my); effect(dust,1,my.x,nullvector); wait(-random(0.2)); } }
function destoyed_object_event { if(nbr_flying_obj<100) { my.event = null; wait(1); flying_objects[nbr_flying_obj]=me; nbr_flying_obj+=1; my.passable = on; } }
action destroy_object { my.skill1 = random(360);//for the position in the storm... my.enable_push=on; my.event = destoyed_object_event; wait(1); c_setminmax(me); }
function main { fps_max=75; level_load("tornado.wmb"); wait(3); randomize(); control_flying_object(); while(1) { camera.pan -= mouse_force.x; camera.tilt += mouse_force.y; temp.x = (key_w-key_s+mickey.z/10)*15*time; temp.y = (key_a-key_d)*15*time; temp.z = 0; vec_rotate(temp,camera.pan); vec_add(camera.x,temp); wait(1); } }
|
|
|
Re: The Tornado
[Re: Scorpion]
#116089
03/10/07 20:32
03/10/07 20:32
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
That's really nice! I can see my buildings flying in the tornado! Awesome!
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: The Tornado
[Re: Marky Mark]
#116090
03/10/07 20:49
03/10/07 20:49
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Maybe it needs some work on the physics of it... Look at this: Here, The building keeps rotating like that: ![](http://img70.imageshack.us/img70/7704/weatherphoto1li2.jpg) Here, well.. you can see it ![](/ubbthreads/images/graemlins/laugh.gif) ![](http://img154.imageshack.us/img154/6535/weatherphoto2uz5.jpg)
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
|