98 lines
3.0 KiB
Plaintext
98 lines
3.0 KiB
Plaintext
/*
|
|
Author: Brazilian Armed Forces
|
|
-Rodrigo "Ogrinho" Arantes
|
|
|
|
Description:
|
|
- This function is designed to implement smoke ejection from A-29 exhaust
|
|
|
|
Exucution:
|
|
- call the function via user action added to the aircrfat itself.
|
|
|
|
to activate smoke emitter:
|
|
|
|
class BRAF_Smoke_Toggle
|
|
{
|
|
priority=0.05;
|
|
shortcut="Smoke On";
|
|
displayName="Fumaça já!";
|
|
condition="player in this && {
|
|
speed this > 1
|
|
}";
|
|
statement="[this] spawn BRAF_fnc_SmokeOn";
|
|
position="pilotcontrol";
|
|
radius=10;
|
|
onlyforplayer=1;
|
|
showWindow=0;
|
|
};
|
|
|
|
Requirments:
|
|
|
|
- Compatible aircraft must have a config definition for all sub-sytems that will be invoked by this function.
|
|
|
|
1- Aircrfat model must have memory a point called "smoker_spawn" definig the position where to attach smoke generator.
|
|
|
|
Result: Smoke effect particles will be ejected from aircrafts right exhaustor, and vehicleChat will say "Fumaça Já!"
|
|
|
|
*/
|
|
|
|
/*--------------------------------------------------------------------------------------------------
|
|
|
|
Conditions to play the function:
|
|
1- Aircraft is alive.
|
|
2- Aircraft speed > 1.
|
|
3- "braf_smoke_on" variable == true
|
|
|
|
--------------------------------------------------------------------------------------------------*/
|
|
private _plane = param [0, objNull];
|
|
|
|
if (isNull _plane ||
|
|
{
|
|
!alive _plane ||
|
|
{
|
|
speed _plane < 1
|
|
}
|
|
}
|
|
) exitWith {};
|
|
if (_plane getVariable ["braf_smoke_on", true]) then {
|
|
/*--------------------------------------------------------------------------------------------------
|
|
|
|
Creation of smoke generator and attaching it to vehicle's "smoker_spawn" memory point
|
|
|
|
--------------------------------------------------------------------------------------------------*/
|
|
_plane spawn
|
|
{
|
|
private _plane = _this;
|
|
_plane vehicleChat "Fumaça Já!";
|
|
sleep 0.25;
|
|
private _smoker = "#particlesource" createVehicleLocal [0, 0, 0];
|
|
_smoker setParticleParams
|
|
[
|
|
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1],
|
|
"", "Billboard", 1, 16, // AnimationName, type, timerPeriod, lifeTime
|
|
[0, 0, 0], // position relative to referenceObject
|
|
[0, 0, 0], // velocity
|
|
0, 10, 7.9, 0.066, [1, 3, 6], // Rotation, Weight, Volume, Rubbing, size
|
|
[
|
|
[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 0.75], [1, 1, 1, 0.5], [1, 1, 1, 0.25], [1, 1, 1, 0] // Array for smoke colors [R, G, B, A]
|
|
],
|
|
[0.25], // animationPhase
|
|
1, 0, // randomDerictionPeriod, randomDirectionIntensity
|
|
"", "", // onTimer, beforeDestroy
|
|
_smoker// referenceObject
|
|
];
|
|
_smoker setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
|
|
_smoker setDropInterval 0.025;
|
|
_smoker setDir (getDir _plane);
|
|
_smoker setPosASL (_plane modelToWorld [0, 0, 0]);
|
|
_smoker attachTo [_plane, [0, 0, 0], "smoker_spawn"];
|
|
|
|
_plane setVariable ["smoker", _smoker];
|
|
_plane setVariable ["braf_smoke_on", false];
|
|
};
|
|
} else {
|
|
private _smoker = _plane GetVariable ["smoker", objNull];
|
|
deleteVehicle _smoker;
|
|
_plane vehicleChat "Fumaça Off!";
|
|
_plane setVariable ["smoker", nil];
|
|
_plane setVariable ["braf_smoke_on", true];
|
|
}; |