DLL functions can also be used for particles, using the PARTICLE struct defined in atypes.h. They can be used in a similar way as C-Script defined particle functions. A pointer to the particle is the sole argument of a DLL particle function. Example:
// example for a particle effect function // start the particle effect by // effect(DLLEffect_Explo,1000,my.x,NULL); void Particle_Alphafade(PARTICLE *p) { // fade out, and kill the particle when it's totally translucent p->alpha -= v(time_step) * 4; if (p->alpha <= 0) p->lifespan = 0; } DLLFUNC void DLLEffect_Explo(PARTICLE *p) { // load a particle bmap - use 'static' for creating it only once static BMAP *bmap = bmap_create("blitz.tga"); p->bmap = bmap; // internal flags are already set, use |= for setting flags p->flags |= BEAM|MOVE|BRIGHT|TRANSLUCENT; // some random start values for speed and alpha p->vel_x = random(_VAR(10)) - _VAR(5); p->vel_y = random(_VAR(10)) - _VAR(5); p->vel_z = random(_VAR(10)) - _VAR(5); p->alpha = _VAR(50) + random(_VAR(50)); // change the particle function p->event = (EVENT)Particle_Alphafade; }Note how you can direct set an event to an external DLL function. Take care however that the assignment of external functions is not saved with the game_save instruction. This does not matter for a particle function, but once you've assigned an external function to an entity or key event, keep it and do not change it afterwards. ► latest version online