Hard Light Productions Forums
Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Galemp on May 22, 2008, 09:07:17 pm
-
When the Shivan Comm Node is in its death throes, it spews out a LOT of big fluffy particles. I've looked at the model and at the table and I can't figure out where this effect is coming from. Does anyone have any idea how it was implemented, and if we can reproduce it in other models?
-
According to the wiki:
"the mission designer progammed the CommNode to self-destruct when the crystal is destroyed; this is not a hard-coded feature."
Self destruct causes the crazy particle spew AFAIK.
-
I assume it's because it's got the "knossos" flag. IIRC, the only function for this flag is to change the explosion behavior.
EDIT: Okay, having just searched in the code base, I take that back. One of the functions is to change the explosion. The other (naturally) is to handle special warpin/warpout.
But here's the code you're probably looking for:
// create little fireballs for knossos as it dies
if (knossos_ship) {
if ( timestamp_elapsed(shipp->next_fireball)) {
vec3d rand_vec, outpnt; // [0-.7 rad] in plane
vm_vec_rand_vec_quick(&rand_vec);
float scale = -vm_vec_dotprod(&objp->orient.vec.fvec, &rand_vec) * (0.9f + 0.2f * frand());
vm_vec_scale_add2(&rand_vec, &objp->orient.vec.fvec, scale);
vm_vec_normalize_quick(&rand_vec);
scale = objp->radius * frand() * 0.717f;
vm_vec_scale(&rand_vec, scale);
vm_vec_add(&outpnt, &objp->pos, &rand_vec);
float rad = objp->radius*0.2f;
int fireball_type = FIREBALL_EXPLOSION_LARGE1 + rand()%FIREBALL_NUM_LARGE_EXPLOSIONS;
fireball_create( &outpnt, fireball_type, OBJ_INDEX(objp), rad, 0, &objp->phys_info.vel );
// start the next fireball up in the next 50 - 200 ms (2-3 per frame)
shipp->next_fireball = timestamp_rand(333,500);
// emit particles
particle_emitter pe;
pe.num_low = 15; // Lowest number of particles to create
pe.num_high = 30; // Highest number of particles to create
pe.pos = outpnt; // Where the particles emit from
pe.vel = objp->phys_info.vel; // Initial velocity of all the particles
pe.min_life = 2.0f; // How long the particles live
pe.max_life = 12.0f; // How long the particles live
pe.normal = objp->orient.vec.uvec; // What normal the particle emit around
pe.normal_variance = 2.0f; // How close they stick to that normal 0=on normal, 1=180, 2=360 degree
pe.min_vel = 50.0f;
pe.max_vel = 350.0f;
pe.min_rad = 30.0f; // * objp->radius;
pe.max_rad = 100.0f; // * objp->radius;
particle_emit( &pe, PARTICLE_SMOKE2, 0, 50 );
// do sound - maybe start a random sound, if it has played far enough.
do_sub_expl_sound(objp->radius, &outpnt, shipp->sub_expl_sound_handle);
}
}
-
IIRC, the only function for this flag is to change the explosion behavior.
It also sets the deathroll time.
-
It also sets the deathroll time.
That kind of falls under the "explosion behavior" concept, doesn't it? :p
-
I guess so...
-
id love to add particle spewers as part of the glowpoint code. set glowpoint to type 2 and set pspew in the ship table and it would use the glowpoint position/normal as the spew point. then you can turn them on and off with sexps.
-
Couldn't you just script them?
-
yea, probably. but doing it in c you could do it with greater speed, and i find that sometimes when dealing with particles you need all the speed you can get.
-
I have a nice idea. SCP Team could code table-defined explosions so in tables so user could define explosions (like particle spew and particle animation) in tables. Also other things like particle smoke (when ship's damaged) would be definable.
-
Good luck getting that to happen anytime soon...
-
I have a nice idea.
Ideas are cheap. Give 'em an actual way to make it happen and put some effort into it.
-
Well if the changes are limited and simple we could see a test build in no time, right? :D
-
Well if the changes are limited and simple we could see a test build in no time, right? :D
Learn to code before you make assumptions like that :rolleyes:
-
I can't code but changes like this are obviously easier to do than many others...just look at the requests...