(copying this from the other thread, I'll just post in this one from now on)
The current Lua command has 28 parameters! I've added 2 more but I'm thinking there must be a better way, will probably end up adding specific commands with fewer parameters to make things more usable, any parameters not set by the script can just default to sensible values.
I'm thinking of:
LoadParticleImage( <filePath>, [id] ) -- returns id number for image or overwrites specified id
ParticlesGetFreeEmitter() -- existing command, returns id of next not-in-use emitter
ParticlesAddEmitter( id, .... + up to 29 other parameters ) -- existing command
ParticlesSetFrames( id, animationSpeed, frameStart, frameEnd )
ParticlesSetSpeed( id, xMin, yMin, zMin, [ xMax, yMax, zMAx ] )
ParticlesSetOffset( id, xMin, yMin, zMin, [ xMax, yMax, zMAx ] )
ParticlesSetRotation( id, ... etc )
ParticlesSetScale( id, .. etc )
ParticlesSetAlpha( id ... etc )
ParticlesStartEmitter( id, spawnRate )
ParticlesStopEmitter( id )
ParticlesDeleteEmitter( id )
You get the idea.
Here is the script that the above video uses:
local emitterList = {}
function snow_particle_emitter_init(e)
end
function snow_particle_emitter_main(e)
local emitter = emitterList[e]
if emitter == nil then
emitterList[e] = { p = ParticlesGetFreeEmitter(), used = false,
image = ParticlesLoadImage( "effectbank\\particles\\64snowflakes.dds" ) }
else
if emitter.p > 0 and not emitter.used then
ParticlesAddEmitter(emitter.p,
0, -- animationSpeed
1, -- startsOffRandomAngle
-200, -- offsetMinX
200, -- offsetMinY
-200, -- offsetMinZ
200, -- offsetMaxX
400, -- offsetMaxY
200, -- offsetMaxZ
1, -- scaleStartMin
10, -- scaleStartMax
1, -- scaleEndMin
10, -- scaleEndMax
-0.1, -- movementSpeedMinX
-0.9, -- movementSpeedMinY
-0.1, -- movementSpeedMinZ
0.1, -- movementSpeedMaxX
-0.1, -- movementSpeedMaxY
0.1, -- movementSpeedMaxZ
-2, -- rotateSpeedMinZ
2, -- rotateSpeedMaxZ
5000, -- lifeMin
10000, -- lifeMax
40, -- alphaStartMin
75, -- alphaStartMax
0, -- alphaEndMin
0, -- alphaEndMax
25, -- frequency
emitter.image );
emitter.used = true
end
end
end
Been there, done that, got all the T-Shirts!