Particles Tutorial: Difference between revisions
m (fix fire) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 17: | Line 17: | ||
=== Create a particle source === | === Create a particle source === | ||
<sqf>private _particleSource = "#particlesource" createVehicleLocal ASLtoAGL getPosASL player;</sqf> | |||
{{Feature | Informative | A particle source is '''[[Multiplayer Scripting#Locality|local]]''' (and all the particle commands take a local argument too), hence [[createVehicleLocal]] usage.}} | {{Feature | Informative | A particle source is '''[[Multiplayer Scripting#Locality|local]]''' (and all the particle commands take a local argument too), hence [[createVehicleLocal]] usage.}} | ||
Line 23: | Line 23: | ||
{{ArgTitle|3|Set source class|{{GVI|arma3|0.50}}}} | {{ArgTitle|3|Set source class|{{GVI|arma3|0.50}}}} | ||
<sqf>_particleSource setParticleClass "ObjectDestructionFire1Smallx"; // defined in configFile >> "CfgCloudlets"</sqf> | |||
{{Feature | Informative | Particle source class must be defined in game [[configFile|config]] and '''cannot''' be declared in [[missionConfigFile]] or [[campaignConfigFile]]. See [[Arma 3: Particle Effects]] for more information.}} | {{Feature | Informative | Particle source class must be defined in game [[configFile|config]] and '''cannot''' be declared in [[missionConfigFile]] or [[campaignConfigFile]]. See [[Arma 3: Particle Effects]] for more information.}} | ||
Line 29: | Line 29: | ||
=== Set source parameters === | === Set source parameters === | ||
See [[ParticleArray]] for details on the array format. | |||
<sqf> | |||
_particleSource setParticleParams | |||
[ | |||
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8], | |||
"", "Billboard", 1, 3, // animationName, type, timerPeriod, lifeTime | |||
[0,1.5,0], // position relative to referenceObject | |||
[0,0,0], // velocity | |||
0, 0.005, 0.003925, 0.1, [0.25, 0.75], // rotation, weight, volume, rubbing, size | |||
[[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]], // colors | |||
[1], // animationPhase | |||
0, 0, // randomDirectionPeriod, randomDirectionIntensity | |||
"", "", // onTimer, beforeDestroy | |||
player, // referenceObject | |||
0, false, // angle, bounces | |||
-1, [], // bounceOnSurface, emissiveColor | |||
[0,1,0] // vectorDir - CANNOT be [0,0,0] | |||
]; | |||
</sqf> | |||
=== Set source drop interval === | === Set source drop interval === | ||
<sqf>_particleSource setDropInterval 0.0625; // duration between drops</sqf> | |||
=== Set source drop circle === | === Set source drop circle === | ||
<sqf>_particleSource setParticleCircle [3, [0,1,0]]; // [circle radius, velocity]</sqf> | |||
=== Set source random values === | === Set source random values === | ||
<sqf> | |||
/* | |||
lifeTime, | |||
position, | |||
moveVelocity, | |||
rotationVelocity, | |||
size, | |||
color, | |||
directionPeriod, | |||
directionIntensity, | |||
angle, | |||
bounceOnSurface | |||
*/ | |||
_particleSource setParticleRandom [0, [0.1, 0.1, 0.1], [0, 0, 0.5], 0, 0.1, [0, 0, 0, 0], 0, 0]; | |||
</sqf> | |||
{{ArgTitle|3|Set source fire properties|{{GVI|arma3|1.08}}}} | {{ArgTitle|3|Set source fire properties|{{GVI|arma3|1.08}}}} | ||
<sqf>_particleSource setParticleFire [0.1, 0.5, 2]; // [coreIntensity, coreDistance, damageTime]</sqf> | |||
=== Delete source === | === Delete source === | ||
<sqf>deleteVehicle _particleSource; // as simple as that</sqf> | |||
=== Use the [[drop]] command === | === Use the [[drop]] command === | ||
Line 83: | Line 87: | ||
The [[drop]] command only drops one particle. If multiple ones are needed, a loop ([[for]], [[while]]) must be used. | The [[drop]] command only drops one particle. If multiple ones are needed, a loop ([[for]], [[while]]) must be used. | ||
See [[ParticleArray]] for details on the array format. | |||
<sqf> | |||
drop [ | |||
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8], | |||
"", "Billboard", 1, 3, // animationName, type, timerPeriod, lifeTime | |||
[0,1.5,0], // position relative to referenceObject | |||
[0,0,0], // velocity | |||
0, 0.005, 0.003925, 0.1, [0.25, 0.75], // rotation, weight, volume, rubbing, size | |||
[[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]], // colors | |||
[1], // animationPhase | |||
0, 0, // randomDirectionPeriod, randomDirectionIntensity | |||
"", "", // onTimer, beforeDestroy | |||
player // referenceObject | |||
]; | |||
</sqf> | |||
Line 106: | Line 112: | ||
One way to design your effect is to have an [[SQF Syntax|SQF]] file, named e.g "particles.sqf", filled with your code: | One way to design your effect is to have an [[SQF Syntax|SQF]] file, named e.g "particles.sqf", filled with your code: | ||
<sqf> | |||
{ deleteVehicle _x } forEach allMissionObjects "#particlesource"; | |||
private _posATL = player modelToWorld [0,10,0]; | |||
ps1 = "#particlesource" createVehicleLocal _posATL; | |||
ps1 setParticleParams [/* ... */]; | |||
ps1 setDropInterval 0.2; | |||
ps2 = "#particlesource" createVehicleLocal _posATL; | |||
ps2 setParticleParams [/* ... */]; | |||
ps2 setDropInterval 0.2; | |||
</sqf> | |||
and run with | and run with | ||
<sqf>execVM "particles.sqf";</sqf> | |||
This format deletes all previous effects and still allows you to use the [[Arma 3 Debug Console|Debug Console]] in order to adjust particle source settings thanks to the usage of global variables (here, {{hl|ps1}} and {{hl|ps2}}) | This format deletes all previous effects and still allows you to use the [[Arma 3 Debug Console|Debug Console]] in order to adjust particle source settings thanks to the usage of global variables (here, {{hl|ps1}} and {{hl|ps2}}) | ||
Line 133: | Line 141: | ||
{{Feature | Informative | The following examples are for {{arma2}} and later titles. For {{arma1}} examples, see [[ParticleTemplates]].}} | {{Feature | Informative | The following examples are for {{arma2}} and later titles. For {{arma1}} examples, see [[ParticleTemplates]].}} | ||
{{Feature | important | For games other than {{arma3}} | {{Feature | important | For games other than {{arma3}}: | ||
{{{!}} | * remove [[private]] usage | ||
* replace {{hl|\A3\Data_F\}} with: | |||
: {{{!}} | |||
{{!}} {{GVI|arma2|1.00}} {{!}}{{!}} {{hl|\Ca\Data\}} | {{!}} {{GVI|arma2|1.00}} {{!}}{{!}} {{hl|\Ca\Data\}} | ||
{{!}}- | {{!}}- | ||
Line 146: | Line 156: | ||
[[Image:PE_BurningVehicleLookAlike.jpg|thumb|left|100px|Burning vehicle fire look-alike]] | [[Image:PE_BurningVehicleLookAlike.jpg|thumb|left|100px|Burning vehicle fire look-alike]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
// Fire | |||
private _ps0 = "#particlesource" createVehicleLocal _posATL; | |||
_ps0 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 10, 32], "", "Billboard", | |||
0, 1, [0, 0, 0.25], [0, 0, 0.5], 1, 1, 0.9, 0.3, [1.5], | |||
[[1,1,1, 0.0], [1,1,1, 0.3], [1,1,1, 0.0]], | |||
[0.75], 0, 0, "", "", _ps0, rad -45]; | |||
_ps0 setParticleRandom [0.2, [1, 1, 0], [0.5, 0.5, 0], 0, 0.5, [0, 0, 0, 0], 0, 0]; | |||
_ps0 setDropInterval 0.03; | |||
// Smoke part 1 | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 1], "", "Billboard", | |||
1, 10, [0, 0, 0.5], [0, 0, 2.9], 1, 1.275, 1, 0.066, [4, 5, 10, 10], | |||
[[0.3, 0.3, 0.3, 0.33], [0.4, 0.4, 0.4, 0.33], [0.2, 0.2, 0, 0]], | |||
[0, 1], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0, 0, 0], [0.33, 0.33, 0], 0, 0.25, [0.05, 0.05, 0.05, 0.05], 0, 0]; | |||
_ps1 setDropInterval 0.5; | |||
// Smoke part 2 | |||
private _ps2 = "#particlesource" createVehicleLocal _posATL; | |||
_ps2 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 1], "", "Billboard", | |||
1, 15, [0, 0, 0.5], [0, 0, 2.9], 1, 1.275, 1, 0.066, [4, 5, 10, 10], | |||
[[0.1, 0.1, 0.1, 0.75], [0.4, 0.4, 0.4, 0.5], [1, 1, 1, 0.2]], | |||
[0], 1, 0, "", "", _ps2]; | |||
_ps2 setParticleRandom [0, [0, 0, 0], [0.5, 0.5, 0], 0, 0.25, [0.05, 0.05, 0.05, 0.05], 0, 0]; | |||
_ps2 setDropInterval 0.25; | |||
</sqf> | |||
=== Fire === | === Fire === | ||
[[Image:PE_fire.jpg|thumb|left|100px|Fire]] | [[Image:PE_fire.jpg|thumb|left|100px|Fire]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
// Fire | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 10, 32], "", "Billboard", | |||
1, 1, [0, 0, 0], [0, 0, 0.5], 0, 1, 1, 3, [0.5,1.5], | |||
[[1,1,1,0.4], [1,1,1,0.2], [1,1,1,0]], | |||
[0.25,1], 1, 1, "", "", _ps1]; | |||
_ps1 setParticleRandom [0.2, [0.5, 0.5, 0.25], [0.125, 0.125, 0.125], 0.2, 0.2, [0, 0, 0, 0], 0, 0]; | |||
_ps1 setDropInterval 0.05; | |||
// Smoke | |||
private _ps2 = "#particlesource" createVehicleLocal _posATL; | |||
_ps2 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 1, 1], "", "Billboard", | |||
1, 5, [0, 0, 1], [0, 0, 1.5], 0, 1, 1, 0.5, [1.75,2,3,4.5], // timerPeriod → size | |||
[[1,1,1,0], [1,1,1,0.5], [1,1,1,0.4], [1,1,1,0.2], [1,1,1,0]], | |||
[0.5,0.5], 0, 0, "", "", _ps2]; | |||
_ps2 setParticleRandom [0.5, [1, 1, 0.4], [0, 0, 0.5], 0, 0.125, [0, 0, 0, 0], rad 30, 0]; | |||
_ps2 setDropInterval 0.1; | |||
</sqf> | |||
=== Floating Orb === | === Floating Orb === | ||
[[Image:PE_FloatingOrb.jpg|thumb|left|100px|Floating Orb]] | [[Image:PE_FloatingOrb.jpg|thumb|left|100px|Floating Orb]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 12, 16, 0], "", "Billboard", | |||
1, 3.0141, [0, 0, 2], [0, 0, 0], 1, 1.275, 1, 0, [4], | |||
[[1, 1, 1, 1]], | |||
[1000], 1, 0, "", "", _ps1]; | |||
_ps1 setDropInterval 3; | |||
</sqf> | |||
=== Heavy Oily Smoke (Small) === | === Heavy Oily Smoke (Small) === | ||
[[Image:PE_HeavyOilySmokeSmall.jpg|thumb|left|100px|Heavy Oily Smoke (Small)]] | [[Image:PE_HeavyOilySmokeSmall.jpg|thumb|left|100px|Heavy Oily Smoke (Small)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6], | |||
[[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.05; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 234: | Line 252: | ||
[[Image:PE_HeavyOilySmokeMedium.jpg|thumb|left|100px|Heavy Oily Smoke (Medium)]] | [[Image:PE_HeavyOilySmokeMedium.jpg|thumb|left|100px|Heavy Oily Smoke (Medium)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12], | |||
[[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.1; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 249: | Line 269: | ||
[[Image:PE_HeavyOilySmokeLarge.jpg|thumb|left|100px|Heavy Oily Smoke (Large)]] | [[Image:PE_HeavyOilySmokeLarge.jpg|thumb|left|100px|Heavy Oily Smoke (Large)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [4, 12, 20], | |||
[[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.2; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 264: | Line 286: | ||
[[Image:PE_LightWoodSmokeSmall.jpg|thumb|left|100px|Light Wood Smoke (Small)]] | [[Image:PE_LightWoodSmokeSmall.jpg|thumb|left|100px|Light Wood Smoke (Small)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 16, 0], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6], | |||
[[0.5, 0.5, 0.5, 0], [0.5, 0.5, 0.5, 0.15], [0.5, 0.5, 0.5, 0.15], [0.5, 0.5, 0.5, 0.1], [0.75, 0.75, 0.75, 0.075], [1, 1, 1, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.05; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 279: | Line 303: | ||
[[Image:PE_LightWoodSmokeMedium.jpg|thumb|left|100px|Light Wood Smoke (Medium)]] | [[Image:PE_LightWoodSmokeMedium.jpg|thumb|left|100px|Light Wood Smoke (Medium)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 16, 0], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [2, 6, 12], | |||
[[0.5, 0.5, 0.5, 0], [0.5, 0.5, 0.5, 0.3], [0.5, 0.5, 0.5, 0.2], [0.5, 0.5, 0.5, 0.1], [0.75, 0.75, 0.75, 0.075], [1, 1, 1, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.1; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 294: | Line 320: | ||
[[Image:PE_LightWoodSmokeLarge.jpg|thumb|left|100px|Light Wood Smoke (Large)]] | [[Image:PE_LightWoodSmokeLarge.jpg|thumb|left|100px|Light Wood Smoke (Large)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 16, 0], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 4.5], 0, 10, 7.9, 0.5, [4, 12, 20], | |||
[[0.5, 0.5, 0.5, 0], [0.5, 0.5, 0.5, 0.5], [0.66, 0.66, 0.66, 0.33], [0.75, 0.75, 0.75, 0.25], [1, 1, 1, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.5, 0.5, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.2; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 309: | Line 337: | ||
[[Image:PE_MixedSmokeSmall.jpg|thumb|left|100px|Mixed Smoke (Small)]] | [[Image:PE_MixedSmokeSmall.jpg|thumb|left|100px|Mixed Smoke (Small)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6], | |||
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.1; | |||
private _ps2 = "#particlesource" createVehicleLocal _posATL; | |||
_ps2 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 16, 0], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6], | |||
[[0.33, 0.33, 0.33, 0], [0.33, 0.33, 0.33, 0.8], [0.33, 0.33, 0.33, 0.8], [0.66, 0.66, 0.66, 0.4], [1, 1, 1, 0]], | |||
[0.25], 1, 0, "", "", _ps2]; | |||
_ps2 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps2 setDropInterval 0.1; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 333: | Line 363: | ||
[[Image:PE_MixedSmokeMedium.jpg|thumb|left|100px|Mixed Smoke (Medium)]] | [[Image:PE_MixedSmokeMedium.jpg|thumb|left|100px|Mixed Smoke (Medium)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12], | |||
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.3], [0.2, 0.2, 0.2, 0.3], [0.35, 0.35, 0.35, 0.2], [0.5, 0.5, 0.5, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.2; | |||
private _ps2 = "#particlesource" createVehicleLocal _posATL; | |||
_ps2 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 16, 0], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12], | |||
[[0.33, 0.33, 0.33, 0], [0.33, 0.33, 0.33, 0.8], [0.33, 0.33, 0.33, 0.8], [0.66, 0.66, 0.66, 0.4], [1, 1, 1, 0]], | |||
[0.25], 1, 0, "", "", _ps2]; | |||
_ps2 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps2 setDropInterval 0.2; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 357: | Line 389: | ||
[[Image:PE_MixedSmokeLarge.jpg|thumb|left|100px|Mixed Smoke (Large)]] | [[Image:PE_MixedSmokeLarge.jpg|thumb|left|100px|Mixed Smoke (Large)]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 4.5], 0, 10, 7.9, 0.5, [4, 12, 20], | |||
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.3], [0.2, 0.2, 0.2, 0.3], [0.35, 0.35, 0.35, 0.2], [0.5, 0.5, 0.5, 0]], | |||
[0.25], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [0.4, 0.4, 0], [0.4, 0.4, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps1 setDropInterval 0.2; | |||
private _ps2 = "#particlesource" createVehicleLocal _posATL; | |||
_ps2 setParticleParams [ | |||
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 9, 16, 0], "", "Billboard", | |||
1, 8, [0, 0, 0], [0, 0, 4.5], 0, 10, 7.9, 0.5, [4, 12, 20], | |||
[[0.33, 0.33, 0.33, 0], [0.33, 0.33, 0.33, 0.8], [0.33, 0.33, 0.33, 0.8], [0.66, 0.66, 0.66, 0.4], [1, 1, 1, 0]], | |||
[0.25], 1, 0, "", "", _ps2]; | |||
_ps2 setParticleRandom [0, [0.4, 0.4, 0], [0.4, 0.4, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; | |||
_ps2 setDropInterval 0.2; | |||
</sqf> | |||
{{Clear}} | {{Clear}} | ||
Line 381: | Line 415: | ||
[[Image:PE_RockShower.jpg|thumb|left|100px|Rock Shower]] | [[Image:PE_RockShower.jpg|thumb|left|100px|Rock Shower]] | ||
<sqf> | |||
private _posATL = player modelToWorld [0,10,0]; | |||
private _ps1 = "#particlesource" createVehicleLocal _posATL; | |||
_ps1 setParticleParams [ | |||
"\A3\Data_F\ParticleEffects\Pstone\Pstone", "", "SpaceObject", | |||
1, 10, [0, 0, 30], [0, 0, -2], 1, 10, 1, 0.2, [2, 2], | |||
[[1, 1, 1 ,1]], | |||
[0, 1], 1, 0, "", "", _ps1]; | |||
_ps1 setParticleRandom [0, [10, 10, 0], [0.25, 0.25, 0], 0, 1.5, [0, 0, 0, 0], 0, 0]; | |||
_ps1 setDropInterval 0.04; | |||
</sqf> | |||
Revision as of 11:27, 22 July 2022
Basics
A particle is a (to some extent, non-physical) 2D plane that always faces the camera, or (more rarely) a 3D model. It can be used to simulate ambient effects, such as dust, fire, water splash, wood splinters and even rock debris.
A particle source is a non-physical object that creates particles at a certain rate and position/velocity.
A particle (as well as a particle source) is local to the computer where the script has been called; one player could see smoke while another could see through without any issue.
How to
Create a particle source
Set source class
Set source parameters
See ParticleArray for details on the array format.
Set source drop interval
Set source drop circle
Set source random values
Set source fire properties
Delete source
Use the drop command
The drop command only drops one particle. If multiple ones are needed, a loop (for, while) must be used.
See ParticleArray for details on the array format.
Design Workflow
In order to determine one particle behaviour, a simple drop usage in the Debug Console can do; but seeing the complete end result can be another task at hand.
Using a Script
One way to design your effect is to have an SQF file, named e.g "particles.sqf", filled with your code:
and run with
This format deletes all previous effects and still allows you to use the Debug Console in order to adjust particle source settings thanks to the usage of global variables (here, ps1 and ps2)
Using a Mod
Emitter 3Ditor (a real-time WYSIWYG particle source editor) adds and uses particle and light emitters in your scenarios without any scripting nor mod dependency.
Steam page - Forums post
Full examples
Burning Vehicle Fire Look-Alike
Fire
Floating Orb
Heavy Oily Smoke (Small)
Heavy Oily Smoke (Medium)
Heavy Oily Smoke (Large)
Light Wood Smoke (Small)
Light Wood Smoke (Medium)
Light Wood Smoke (Large)
Mixed Smoke (Small)
Mixed Smoke (Medium)
Mixed Smoke (Large)
Rock Shower
See also
- Category:Particle System
- ParticleArray - particle array format