Difference between revisions of "VN ms fnc createFlare"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Text replacement - " |a= " to " |author= ")
(Page filling)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
 
{{Function
 
{{Function
  
Line 6: Line 5:
 
|author= Wyqer, veteran29
 
|author= Wyqer, veteran29
  
|e=
+
|a=
 
 
|g1= general
 
  
|d= <pre>/*
+
|e= global
    File: fn_createFlare.sqf
 
    Author: Wyqer, veteran29
 
    Date: 2020-07-16
 
    Last Update: 2020-07-22
 
    Public: Yes
 
  
    Description:
+
|n= server
        Create ilumination flare on given position.
 
  
    Parameter(s):
+
|g1= general
        _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
+
|d= Create ilumination flare on given position.
</pre><small>''(Placeholder description extracted from the function header by '''LM_exportFunctionsToWiki.sqf''')''</small>
 
  
|s= [] call [[vn_ms_fnc_createFlare]];
+
|s= [position, size] call [[VN_ms_fnc_createFlare]]
  
|p1n=
+
|p1n= position
|p1t=
+
|p1t= array
|p1d=
+
|p1d= the flare's position
 
|p1v=
 
|p1v=
  
|p2n=
+
|p2n= size
|p2t=
+
|p2t= number
|p2d=
+
|p2d= the flare's size - can only be 0, 1 or 2 for small, medium and large
|p2v=
+
|p2v= 0
  
|r1t=
+
|r1t= object
|r1d=
+
|r1d= the flare object
  
|x1= <code>-</code>
+
|x1= <code>[getPos player vectorAdd [0, 0, 50], 2] call [[VN_ms_fnc_createFlare]];</code>
 
}}
 
}}

Latest revision as of 18:13, 22 February 2021

← back to Functions Introduced in S.O.G. Prairie Fire v1.00
by Wyqer, veteran29
Argument(s): n/a
Effect(s): global
Execution: Server only

Description

Create ilumination flare on given position.

Syntax

Syntax
[position, size] call VN_ms_fnc_createFlare
Parameters
position: Array - the flare's position
size: Number - (Optional, default 0) the flare's size - can only be 0, 1 or 2 for small, medium and large
Return value
Object - the flare object

Examples

Example 1
[getPos player vectorAdd [0, 0, 50], 2] call VN_ms_fnc_createFlare;