This is the main mass of firebolt without the trail:
int effect$ = WorldFXMgr.CreateParticleEffect( sfx_target1$ );
WorldFXMgr.SetQuadRendering( effect$, true );
WorldFXMgr.SetTargetDependence( effect$, true, false );
WorldFXMgr.SetEffectTexture( effect$, "b_sfx_fireball-01" );
WorldFXMgr.AttachSimulation( effect$, "SpawnParticles( 40, 0xFFFF8855, 0xFFFF8855, 0.175, 0.175 )", 0.0 );
WorldFXMgr.AttachSimulation( effect$, "PositionInSphere( 0.05, 0.05 )", 0.0 );
WorldFXMgr.AttachSimulation( effect$, "AccelOutFromTarget( 0.1, 0.1 )", 0.0 );
WorldFXMgr.AttachSimulation( effect$, "MoveWithVelocity()", 0.0 );
WorldFXMgr.AttachSimulation( effect$, "AlphaChange( 0, .5, 0, 0.0 )", 0.0 );
WorldFXMgr.AttachSimulation( effect$, "ScaleChange( 0.003, 0.5, 0.05, 0.0 )", 0.0 );
WorldFXMgr.SetEffectSrcBlend( effect$, PB_SRCALPHA );
WorldFXMgr.SetEffectDestBlend( effect$, PB_DESTALPHA );
}
Here is a breakdown of what I think it means:
WorldFXMgr.SetQuadRendering( effect$, true );
Should it be rendered as a quad? Renders as flat and 2d, facing camera.
WorldFXMgr.SetTargetDependence( effect$, true, false );
It’s unclear to me what the parameters mean.
WorldFXMgr.SetEffectTexture( effect$, "b_sfx_fireball-01" );
Use this to pass the effect texture.
WorldFXMgr.AttachSimulation( effect$, "SpawnParticles( 40, 0xFFFF8855, 0xFFFF8855, 0.175, 0.175 )", 0.0 );
Create your particle effects. I think the first parameter is an object you attach the particles to.
Next is SpawnParticles which has its own set of parameters. The first parameter is the amount of particles. The second and third are the particle colors. The last two are the size of your particles.
The final parameter of AttachSimulation is the delay particles have upon creation.
WorldFXMgr.AttachSimulation( effect$, "PositionInSphere( 0.05, 0.05 )", 0.0 );
PositionInSphere’s parameters are the minimum and maximum radius of the position from the origin the particles can spawn.
WorldFXMgr.AttachSimulation( effect$, "AccelOutFromTarget( 0.1, 0.1 )", 0.0 );
The two parameters of AccelOutFromTarget are the minimum and maximum acceleration of the particles. It’s radial and pushes away from the target. I think it could make a nice blowing effect. In this example it seems to be accelerating away from the target in .1 seconds.
WorldFXMgr.AttachSimulation( effect$, "MoveWithVelocity()", 0.0 );
Particles move in space according to their velocity vector. It likely uses delta time under the hood.
WorldFXMgr.AttachSimulation( effect$, "AlphaChange( 0, .5, 0, 0.0 )", 0.0 );
This transitions the particles’ transparency. In this case it’s going from 50% transparency to 100% transparency.
WorldFXMgr.AttachSimulation( effect$, "ScaleChange( 0.003, 0.5, 0.05, 0.0 )", 0.0 );
ScaleChange’s first parameter is the start size. I think the second is it’s growth. The third is like the speed of the growth. The last is possibly a delay. However, I need to confirm this.
WorldFXMgr.SetEffectSrcBlend( effect$, PB_SRCALPHA );
WorldFXMgr.SetEffectDestBlend( effect$, PB_DESTALPHA );
This blends it with the rest of the scen by using alpha channels.
// Have spell target1 accel towards target
WorldFXMgr.AttachTargetSimulation( sfx_target1$, sfx_target2$, "AccelTowardsTarget( 20, 20 )" );
The first two parameters in AttachTargetSimulation are the two targets. For example: player casts(sfx_target1$) firebolt on a monster(sfx_target2$).
The second is a function passed as a string.
AccelTowardsTarget is the speed of the projectile. The first parameter is the minimum amount of seconds per acceleration towards the target and the second is the maximum.