From Savage Game Design Wiki
Jump to navigation
Jump to search
Description
/*
File: fn_createFlare.sqf
Author: Wyqer, veteran29
Date: 2020-07-16
Last Update: 2020-07-22
Public: Yes
Description:
Create ilumination flare on given position.
Parameter(s):
_size - Flare size <0,1,2> for small medium large [NUMBER, defaults to 0]
Returns:
Flare [OBJECT]
Example(s):
[(getPos player) vectorAdd [0,0,50], 2] call vn_ms_fnc_createFlare
*/
#define FLARE_SMALL 0
#define FLARE_MEDIUM 1
#define FLARE_LARGE 2
#define FLARE_AMMO_CLASSES ["vn_flare_plane_small_w_ammo", "vn_flare_plane_med_w_ammo", "vn_flare_plane_lg_w_ammo"]
if (!isServer) exitWith {
["Function must be executed on server!"] call BIS_fnc_error;
};
params [
["_pos", [], [[]], 3],
["_size", 1, [0]]
];
if !(_size in [FLARE_SMALL, FLARE_MEDIUM, FLARE_LARGE]) exitWith {
["Invalid flare size given!"] call BIS_fnc_error;
objNull
};
private _flare = createVehicle [FLARE_AMMO_CLASSES select _size, _pos, [], 0, "NONE"];
_flare setPos _pos;
_flare setVelocity [wind select 0, wind select 1, 50];
[_flare, "SN_Flare_Fired_4"] remoteExec ["say3D", 0];
private _soundSource = createSoundSource ["SoundFlareLoop_F", _pos, [], 0];
_soundSource attachTo [_flare, [0,0,0]];
_flare setVariable ["vn_soundSource", _soundSource];
_flare spawn {
private _vel = [];
waitUntil {
sleep 0.5;
_vel = velocity _this;
_vel set [2, -1 max (_vel select 2)];
_this setVelocity _vel;
isNull _this
};
#ifdef VN_DEBUG
systemChat "[VN] Flare cleanup";
#endif
deleteVehicle (_this getVariable ["vn_soundSource", objNull]);
};
_flare // return
(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)
Syntax
- Syntax
- [] call vn_ms_fnc_createFlare;
- Return value
- Nothing
Examples
- Example 1
-