Jump to content

Ibragim A

Member
  • Content Count

    192
  • Joined

  • Last visited

  • Medals

Posts posted by Ibragim A


  1. red army, your code doesn't work for several reasons:
    1) you run the code with a sleep and while loop in an environment that does not accept these commands. In order to stop and loop the script, you need to spawn it or run it using execVM command.
    See: Scheduled Environment
    2) the block in the count command should return true, but your block does not return anything, therefore the script does not work.
    See: count (Alternative Syntax), deleteVehicle (Main Syntax Return Value)

    So, try this code in init.sqf:

    [] spawn 
    	{
    		waitUntil {time > 5};
    		
    		while {true} do 
    			{				
    				{
    					if ({alive _x} count crew _x < 1) then 
    						{
    							deleteVehicleCrew _x;
    							deleteVehicle _x;
    						};
    				} forEach (nearestObjects [player,["Air"],14000])
    				
    				sleep 5;
    			};
    	};

     

    • Thanks 1

  2. The script works with the BMP, because there is a commander in the crew of the BMP, but in helicopter there are only two pilots. Therefore, the script defines the helicopter pilot group as not existing, and therefore, the pilot does not receive waypoints.

    private _veh = createVehicle ["O_Heli_Light_02_dynamicLoadout_F", [0,0,0],["MKH1"]];
    
    //create crew and group with vehicle
    	createVehicleCrew _veh;
    	private _grp = group driver _veh;
    
    //await 2 minute before helo move
    	//private _hour = time + 180;
    	waituntil { time >= 120 };
    
    //create waypoints on empty marker position	 
    	
    	private _wpp = _grp addWaypoint [getMarkerPos "MKH2", 0];
    	_wpp setWaypointType "MOVE";
    	_wpp setWaypointSpeed "LIMITED";
    	_wpp setWaypointBehaviour "SAFE";
    
    	private _wpp = _grp addWaypoint [getMarkerPos "MKH3", 0];
    	_wpp setWaypointType "MOVE";
    	_wpp setWaypointSpeed "LIMITED";
    	_wpp setWaypointBehaviour "SAFE";
    
    // on last waypoint helo land and crew disembark
    
    	private _wpp = _grp addWaypoint [getMarkerPos "MKH4", 0];
    	_wpp setWaypointType "GETOUT";
    	_wpp setWaypointSpeed "LIMITED";
    	_wpp setWaypointBehaviour "SAFE";

     

    • Like 1

  3. Pay attention to your variables. You didn't use some variables correctly. _x from forEach is not passed to the event handler. Also, your HITECT variable is updated after each handler is added, and then you use it already updated for all units. Although in fact you don't need it at all, because it is passed to the handler code in the form of the _thisEventHandler variable.

    {    
    	_x addEventHandler 
    		[
    			"HitPart", 
    			{
    				(_this select 0) params ["_target", "_shooter", "_projectile", "_position", "_velocity", "_selection", "_ammo"];
    				if (((_ammo select 4) in ["vn_560x15","vn_762x51"])) exitWith 
    					{
    						[STB, ["MONOHIT",5]] remoteExec ["say3D", 0];
    						_target removeEventHandler [_thisEvent, _thisEventHandler];       
    					};
    			}
    		];		
    } forEach (allUnits select {alive _x && (side _x) == east});

     

    • Like 1
    • Thanks 1

  4. 2 hours ago, redarmy said:

    That makes sense.  i tested this and it works great,with one caveat.

     

    Is there a way to change this to detect a new enemy group,rather than individual target? individual targets are going to spam the side chat in enemy heavy instances 

     

    
    this addEventHandler ["EnemyDetected", {
    	params ["_group", "_newTarget"];
    	
    	leader _group sideChat "Enemy detected!";
    }];

    One thing about the trigger was i was able to play a sound effect (radio squeek) upon side chat activating. Is there a way i can do that here and pull from vanilla sound effects or voices?

     

    this addEventHandler ["EnemyDetected", {
    	params ["_group", "_newTarget"];
    	
    	if ({leader _group knowsAbout _x > 0} count units group _newTarget == 1) then 
    		{
    			leader _group sideChat "Enemy detected!";
    			
    			_soundFile = selectRandom ["in2a.ogg","in2b.ogg","in2c.ogg"];
    			
    			playSound3D ["\A3\Dubbing_Radio_F\Sfx\" + _soundFile, player];
    			
    			[] spawn 
    				{
    					sleep 3;
    					
    					_soundFile = selectRandom ["out2a.ogg","out2b.ogg","out2c.ogg"];
    			
    					playSound3D ["\A3\Dubbing_Radio_F\Sfx\" + _soundFile, player];
    				};
    		};	
    }];
    
    this addEventHandler ["CombatModeChanged", {
    	params ["_group", "_newMode"];
    	
    	if (_newMode == "COMBAT") then 
    		{
    			leader _group sideChat "Combat!";
    		
    			_soundFile = selectRandom ["in2a.ogg","in2b.ogg","in2c.ogg"];
    			
    			playSound3D ["\A3\Dubbing_Radio_F\Sfx\" + _soundFile, player];
    			
    			[] spawn 
    				{
    					sleep 3;
    					
    					_soundFile = selectRandom ["out2a.ogg","out2b.ogg","out2c.ogg"];
    			
    					playSound3D ["\A3\Dubbing_Radio_F\Sfx\" + _soundFile, player];
    				};
    		};
    }];
    
    this addEventHandler ["UnitLeft", {
    	params ["_group", "_oldUnit"];
    	
    	if !(alive _oldUnit) then 
    		{
    			leader _group sideChat "Lost one!";
    			
    			_soundFile = selectRandom ["in2a.ogg","in2b.ogg","in2c.ogg"];
    			
    			playSound3D ["\A3\Dubbing_Radio_F\Sfx\" + _soundFile, player];
    			
    			[] spawn 
    				{
    					sleep 3;
    					
    					_soundFile = selectRandom ["out2a.ogg","out2b.ogg","out2c.ogg"];
    			
    					playSound3D ["\A3\Dubbing_Radio_F\Sfx\" + _soundFile, player];
    				};
    		};
    }];

     

    • Like 3

  5. Don't use a trigger - use an event handler.

    In the initialization of the group, enter this code:

    this addEventHandler ["EnemyDetected", {
    	params ["_group", "_newTarget"];
    	
    	leader _group sideChat "Enemy detected!";
    }];
    
    this addEventHandler ["CombatModeChanged", {
    	params ["_group", "_newMode"];
    	
    	if (_newMode == "COMBAT") then {leader _group sideChat "Combat!"};
    }];
    
    this addEventHandler ["UnitLeft", {
    	params ["_group", "_oldUnit"];
    	
    	if !(alive _oldUnit) then {leader _group sideChat "Lost one!"};
    }];

     

    • Like 1
    • Thanks 1

  6. PC2-SW-header.png
     

    Steamhttps://steamcommunity.com/sharedfiles/filedetails/?id=2952853824


    Tags: SP - Milsim - New Mechanics - Command

     

    Platoon Commander 2 mod gives the player the opportunity to command a platoon consisting of a player squad and three AI squads.
    With this mod, an ordinary [SP] mission with a linear plot can be turned into complete freedom of action up to multi-stage planning from landing to evacuation.

     

    About this mod in a nutshell: You get the opportunity to take command of friendly groups and manage them in much the same way as you manage the units of your group. Plus you get a number of new features.


    What you need to know: This mod is not about how to press the W key and LMB. Platoon Commander 2 shifts the gameplay vector from arcade, shooter and action to tactics and strategy. Platoon Commander 2 forces the player to monitor the actions of several squads, while the player himself rarely engages in battle personally. The player must learn how to use platoon squads as additional "hands" to solve different types of tactical tasks. Missions built with this mod are distinguished by freedom of action and collective synchronous actions of several squads.

    // This mod gives the player the opportunity to perform some actions that may disrupt the plot planned by the mission makers, like:
    // [*] make units of other groups join player and AI groups, including plot units
    // [*] join friendly groups to the platoon, including plot groups
    // [*] move units of your group or AI groups to other groups

    Differences from the old Platoon Commander mod:

    • This mod can be used in all missions, not just those that were created with it initially.
    • This mod can be used not only by mission makers, but by any user.
    • This mod allows you to add or remove groups from the platoon at any time in the scenario.
    • This mod adds voice-over of radio messages between platoon squads.
    • This mod greatly (!) simplifies platoon control (control identical to vanilla).
    • This mod saves vanilla control menus and complements them a little.
    • This mod does not assign a specific role to specific squads. Any squad can have any purpose.
    • This mod significantly saves performance.
    • This mod adds some new features (a group of escorted persons, storage boxes, static weapons, etc.).
    • This mod includes a more detailed platoon command bar.
       
    • This mod limits the number of units in platoon squads (8) and the number of squads in platoon (4).
    • There is no planning and rally points in this mod.
    • There are no extended actions for the player's group in this mod.

    Languages:

    • English
    • Russian

    How to use:

    • Put 1, 2, 3 or 4 groups. Then put the module Platoon Commander 2 and fill it in. 
    • Or just launch any mission and make groups join the platoon manually.

    Tutorial:

    • Single Player >> Showcases >> Platoon Commander 2 - Tutorial.

    New player actions:

    • Detonation of planted explosives by choice (not just all at once)
    • The ability to exchange weapons with the group's units
    • and others.

    New tactics of AI squads:

    • Search of the dead
    • Blowing up (buildings, boxes, bridges, railway, etc.)
    • Mining of roads
    • Retreat
    • Occupation of buildings
    • and others.

    New modes:

    • Fire at the player's signal (for the player's group and AI groups)
    • Running without returning fire (Go Go Go!)

    New action strategy:

    • Command of the entire platoon in real time.
    • A wide range of actions and tactics.
    • The ability to plan actions at your discretion, not limited to linear plots.
    • Synchronous actions, support by mortar, helicopters, armored vehicles and anything else.

    Settings:

    • Complete freedom in platoon customization
    • About 50 customizable gameplay and visualization parameters

    Visualization:

    • Chat between platoon squads and their voiceover
    • Use of appropriate animations and gestures
    • Control via a vanilla-like command menu
    • Ability to translate into other languages

    Optimization:

    • Loops in scripts are made in such a way that they almost do not affect the frame rate
    • Triggers are not used
    • A special function for the stucked/bagged groups/fighters
    /*
    The mod includes a number of my other mods (do not add them):
    [*] Slow-Motion Menu
    [*] Fire on My Command
    [*] Go Go Go Mode
    [*] Stretch Grenade
    [*] Smoke and signal grenades behind the belt
    [*] Switch Weapons
    [*] Separate Detonator for ED
    [*] Capture Your Enemies
    */

    Images:

    PC2-SW-M001-header.png

     

    PC2-SW-M002-header.png

     

    PC2-SW-M003-header.png

     

    PC2-SW-M004-header.png

     

    PC2-SW-M005-header.png

     

    PC2-SW-M006-header.png

     

    PC2-SW-M007-header.png

     

    PC2-SW-M008-header.png

     

    PC2-SW-M009-header.png

     

    PC2-SW-M010-header.png

     

    chat.png

     

    map.png

     

    surrender.png

     

    showcases.png

     

    settings.png

     

    VR-screen.png

     

     

     

    • Like 6

  7. this works fine for me:

    if (isServer) then {
    for "_i" from 0 to 5 do {
    _rPos = getMarkerPos (selectRandom ["marker_0","marker_0"]);  
    _sPos = [_rPos, 0, 50, 0, 0, 0, 0] call BIS_fnc_findSafePos;  
    _grp = [_sPos, west,[	 
    typeOf player,
    typeOf player,
    typeOf player	 
    ]] call BIS_fnc_spawnGroup;
    _grp setBehaviourStrong "AWARE";		 
    {_x setCombatMode "RED"} forEach units _grp;	 
    _grp setSpeedMode "FULL";	
    _grp setFormation "LINE";	
    _grp deleteGroupWhenEmpty true;
    _AtkMrkOne = selectRandom ["marker_1","marker_2"];  
    _grp move (getMarkerPos _AtkMrkOne);
    
    };
    };

    Check your markers

    • Thanks 1

  8. If you just want to put a backpack with a parachute on the unit at the time when it falls to the ground, then it's pretty simple:

    {
    	removeBackpack _x;
    	_x addBackpack "B_parachute";
    } forEach playableUnits;

    A parachute is added to the AI unit in the same way.


    I can share my version of parachuting the whole group.
    All known bugs when exiting a helicopter in the air in this script have already been fixed. The helicopter will not land on the ground and will not hover in the air.
     

    Spoiler
    
    /*
        Filename: Simple ParaDrop Script v0.99d eject.sqf
        Author: Beerkan 
    	Revision: Ibragim
    
        Description:
        A Simple Paradrop Script which will eject ALL assigned units (except crew) from a vehicle
        add a parachute and when landed will respawn their original backpacks.
    
        Parameter(s):
        0: VEHICLE  - vehicle that will be doing the paradrop (object)
        1: ALTITUDE - the altitude where the group & Cargo Item (if used) will open their parachute (number)    
    	3: PARAS - the units to drop.
    	
        Working Example
        0 = 
    		[
    			_vehicleToParadropFrom, 
    			selectMax [40, ((position _vehicleToParadropFrom select 2) * 0.66)], 
    			nil, 
    			_unitsToParadrop
    		] execVM "eject.sqf"
    
    */
    
    if (!isServer) exitWith {};
    private ["_paras","_vehicle","_item"];
    
    _vehicle = _this select 0;
    _paras = [];
    _crew = crew _vehicle;
    _paras = _this select 3;
    _chuteheight = _this select 1;// Height to auto-open chute
    _item = _this select 2;// Cargo to drop, or nothing if not selected.
    _vehicle allowDamage false;
    _dir = direction _vehicle;
    
    
    if (player in _paras) then 
    	{
    		_paras = [player] + (_paras - [player]);
    	};
    
    
    [_paras, _vehicle] call 
    	{
    		params ["_paras", "_vehicle"];
    		
    			{
    				_x hideObjectGlobal true;
    				_x setUnitFreefallHeight _chuteheight;				
    				_x disableCollisionWith _vehicle;
    				_x allowDamage false; 
    				unassignVehicle _x; 
    				_x moveOut _vehicle;
    				_x attachTo [_vehicle, [0, -10, -8]];
    			} forEach _paras;
    	};
    
    ParaLandSafe =
    	{
    		private ["_unit"];
    		_unit = _this select 0;
    		_chuteheight = _this select 1;
    		(vehicle _unit) allowDamage false;
    		[_unit,_chuteheight] spawn AddParachute;//Set AutoOpen Chute if unit is a player
    		waitUntil { sleep 0.2; isTouchingGround _unit || (position _unit select 2) < 1 };
    		_unit action ["eject", vehicle _unit];
    		_unit setUnitFreefallHeight -1;
    		sleep 1;
    		_unit setUnitLoadout (_unit getVariable ["Saved_Loadout",[]]);// Reload Saved Loadout
    		_unit allowdamage true;// Now you can take damage.
    	};
    
    AddParachute =
    	{
    		private ["_paraUnit"];
    		_paraUnit = _this select 0;
    		_chuteheight = _this select 1;
    		waitUntil { sleep 0.2; (position _paraUnit select 2) < _chuteheight};
    		//_paraUnit addBackPack "B_parachute";// Add parachute
    		if (vehicle _paraUnit IsEqualto _paraUnit ) then {_paraUnit action ["openParachute", _paraUnit]};//Check if players chute is open, if not open it.
    	};
    
    
    _dummy = createVehicle ["C_Soldier_VR_F", position player vectorAdd [0,0, 2000], [], 0, "CAN_COLLIDE"];
    _dummy disableAI "ALL";
    _dummy allowDamage false;
    _dummy setCaptive true;
    _dummy enableSimulation false;
    _dummy hideObject true;
    
    	{
    		_loadOut = getUnitLoadout _x;
    		
    		if (getText (configFile >> "CfgVehicles" >> (_loadOut select 5 select 0 ) >> "backpackSimulation") in ["ParachuteSteerable"]) then 
    			{
    				_loadOut set [5, ""];
    			};
    		
    		_x setVariable ["Saved_Loadout", _loadOut];// Save Loadout
    		
    		if !(getText (configFile >> "CfgVehicles" >> backpack _x >> "backpackSimulation") in ["ParachuteSteerable"]) then 
    			{
    				_parachuteBag = (((everyBackpack _vehicle)) select {getText (configFile >> "CfgVehicles" >> typeOf _x >> "backpackSimulation") in ["ParachuteSteerable"]}) select 0;
    				
    				removeBackpack _x;
    				
    				_x addBackpack typeOf _parachuteBag;
    				_dummy action ["TakeBag", _parachuteBag];
    			};
    		
    		//
    		//_x disableCollisionWith _vehicle;// Sometimes units take damage when being ejected.
    		//_x allowdamage false;// Good Old Arma, they still can take damage on Vehcile exit.
    		[_x] allowGetIn false;		
    		//moveout _x;
    		//_x action ["eject", _vehicle];
    		//unassignvehicle _x;
    		[_x] allowGetIn false;
    		
    		detach _x;
    		
    		
    		_x hideObjectGlobal false;
    		
    		_x setDir (_dir + 90);// Exit the chopper at right angles.
    		_x setvelocity [0,0,-5];// Add a bit of gravity to move unit away from _vehicle
    		sleep 0.5;//space the Para's out a bit so they're not all bunched up.
    		[_x,_chuteheight] spawn ParaLandSafe;
    	} forEach _paras;
    
    //(_paras select 0) leaveVehicle _vehicle;
    _paras allowGetIn true;
    
    /*if (!isNil ("_item")) then
    	{
    		_CargoDrop = _item createVehicle getpos _vehicle;
    		_CargoDrop allowDamage false;
    		_CargoDrop disableCollisionWith _vehicle;
    		_CargoDrop setPos [(position _vehicle select 0) - (sin (getdir _vehicle)* 15), (position _vehicle select 1) - (cos (getdir _vehicle) * 15), (position _vehicle select 2)];
    		clearMagazineCargoGlobal _CargoDrop;clearWeaponCargoGlobal _CargoDrop;clearItemCargoGlobal _CargoDrop;clearbackpackCargoGlobal _CargoDrop;
    		waitUntil {(position _item select 2) <= _chuteheight};
    		[objnull, _CargoDrop] call BIS_fnc_curatorobjectedited;
    		_CargoDrop addaction ["<t color = '#00FF00'>Open Virtual Arsenal</t>",{["Open",true] call BIS_fnc_arsenal;}];
    	};*/
    
    _vehicle allowDamage true;
    	{
    		_x enableCollisionWith _vehicle;
    	} forEach _paras;
    
    sleep 2;
    	
    deleteVehicle _dummy;

     

     

    Make sure that the helicopter pilot is not in the group that parachutes out of him.

    • Like 1

  9. 14 hours ago, Larrow said:

    What happens if you skip several waypoints that have statements like this? Are they all executed, or only the current?

    Sounds like a logic error to me in the waypoint code.

    The statement is called for each waypoint that the script jumps over. I have encountered this and because of this problem I was forced to not use setCurrentWaypoint and use waypoint deletion instead.
    I agree that this is at least not logical.


  10. I've also come across something similar.
    But the setCurrentWaypoint command also has its drawbacks. So, for example, if waypoints have a statement, this code will be called if you use this command to change the current point to another one.

    _wp1 = g1 addWaypoint[ [2000,2000,0], 0];
    _wp1 setWaypointType "MOVE";
    _wp1 setWaypointStatements ["true","systemchat 'goal'"];
    
    _wp2 = g1 addWaypoint [[1000,1000,0], 0];
    _wp2 setWaypointType "MOVE";
    g1 setCurrentWaypoint _wp2;

    The chat will say "goal", despite the fact that the first point will not be reached.

    • Like 1

  11. The wiki explanation says that argumentSpeech is an array of strings - each string is an already defined word in config, and in the code it looks something like this:

    _sender kbTell 
    [
      _receiver, 
      "Orders", 
      "PlayerOrder", 				
      ["Target type", {}, 	"- soldier -", ["veh_infantry_s"]], // ["veh_infantry_s"] is an argumentSpeech array of strings 
      1
    ];

    Here the array ["veh_infantry_s"] includes one string (already defined word in config), as it should be, according to the wiki.

     

    As far as I can see, kbTell takes this word only using the following config way:

    configFile >> "RadioProtocolENG" >> "Words"

    and this defined word ("veh_infantry_s") sounds like "Soldier!".

    Now the problem is, that there are other defined words with the same name, but with a different path, and I can't figure out how to use them in kbTell.

    For example, the same word ("veh_infantry_s"), but defined in

    configFile >> "RadioProtocolENG" >> "Words" >> "CombatEngage"

    sounds like "Fire at that soldier!".

     

    The question is, is it possible to use words from the entire parent config "Words" in the kbTell command, and if so, how?


  12. You can take the BIS function for cutscenes, cut out the lock of the keys necessary for movement and run it in the place you need.
    The cinemaBorder function is responsible for the beginning and end of cutscenes. 
    Here is its version without locking the movement keys:

    Spoiler
    
    /*
        Author: Karel Moricky, modified by Thomas Ryan
    
        Description:
        Moves camera borders.
    
        Parameter(s):
            _this select 0: NUMBER - Mode (0 - in, 1 - out)
            _this select 1: NUMBER - Duration in seconds (default - 1.5)
            _this select 2: BOOL - Play sound (default - true)
            _this select 3: BOOL - lock 1st person view (default - false)
    
        Returns:
        Nothing
    */
    
    private ["_mode","_duration","_sound"];
    
    _mode       = _this param [0,0,[0]];
    _duration = _this param [1,1.5,[0]];
    _sound    = _this param [2,true,[true]];
    
    BIS_fnc_cinemaBorder_lockview     = _this param [3,false,[false]];        //unfortunately it must be global variable because it is used in eventhandler
    BIS_fnc_cinemaBorder_shown     = [true,false] select _mode;
    
    [_mode,_duration,_sound] spawn
    {
        disableSerialization;
    
        private ["_mode","_duration","_sound"];
    
        _mode       = _this select 0;
        _duration = _this select 1;
        _sound    = _this select 2;
    
        waitUntil { !isNull ( [] call BIS_fnc_DisplayMission ) };
    
        private "_DisableGameElements";
        _DisableGameElements =
        {
            private ["_handler", "_displaynumber"];
            _displaynumber = [] call BIS_fnc_DisplayMission;
    
            // Remove eventhandler if it exists (only happens when restarting)
            if (!(isNil {uiNamespace getVariable "BIS_fnc_cinemaBorder_keyHandler"})) then {
                _displaynumber displayRemoveEventHandler ["KeyDown", uiNamespace getVariable "BIS_fnc_cinemaBorder_keyHandler"];
                uiNamespace setVariable ["BIS_fnc_cinemaBorder_keyHandler", nil];
            };
    
            //if action is found in the _actions array or SHIFT/ALT/CTRL was pressed then ignore it (bypass it)
            _handler = _displaynumber displayAddEventHandler
            [
                "KeyDown",
                "
                    if !(missionnamespace getvariable ['BIS_fnc_cinemaBorder_shown',false]) exitwith {
                        _thisEventHandler spawn {
                            ([] call BIS_fnc_DisplayMission) displayRemoveEventHandler ['KeyDown',_this];
                            uiNamespace setVariable ['BIS_fnc_cinemaBorder_keyHandler', nil];
                        };
                    };
    
                    private ['_actions', '_nrofactions', '_returnvalue', '_actionKeys', '_shift', '_alt', '_ctrl' ];
                    _shift = _this select 2;
                        _ctrl = _this select 3;
                        _alt = _this select 4;
                    _returnvalue = _false;
                    _actions = [ 'showmap', 'TimeDec', 'TimeInc', 'Gear', 'Throw', 'Fire', 'ReloadMagazine', 'SwitchWeapon', 'Diary', 'ZoomInToggle', 'ZoomOutToggle', 'ZoomIn', 'ZoomOut', 'BuldZoomIn', 'TacticalView', 'Tasks', 'TasksToggle' ];
    
                    if( BIS_fnc_cinemaBorder_lockview ) then
                    {
                        _actions = _actions + ['PersonView'];
                    };
    
                    _actionKeys = [];
                    {
                        _actionkeys = _actionkeys + actionKeys _x;
                    } forEach _actions;
    
                    if( (_this select 1) in _actionKeys || (_ctrl || _alt) ) then { _returnvalue = true };
                    _returnvalue
                "
            ];
    
            uiNamespace setVariable ["BIS_fnc_cinemaBorder_keyHandler", _handler];
    
            private "_m";
            (findDisplay 129) closeDisplay 2;    //close tasks if opened
            (findDisplay 602) closeDisplay 2;    //close inventory if opened
            _m = openmap [false, false];        //close map if opened
            showCompass false;            //disallow other elements
            showGPS false;
            showRadio false;
            showWatch false;
            showPad false;
            [false] call bis_fnc_showUnitInfo;    //weapon info may overlap
        };
    
        private "_EnableGameElements";
        _EnableGameElements =
        {
            private [ "_displaynumber" ];
            _displaynumber = [] call BIS_fnc_DisplayMission;
            if (!(isNil {uiNamespace getVariable "BIS_fnc_cinemaBorder_keyHandler"})) then
            {
                _displaynumber displayRemoveEventHandler [ "keydown", uiNamespace getVariable "BIS_fnc_cinemaBorder_keyHandler" ];
                uiNamespace setVariable ["BIS_fnc_cinemaBorder_keyHandler", nil];
            };
            showCompass true;            //allow other elements
            showGPS true;
            showRadio true;
            showWatch true;
            showPad true;
            [true] call bis_fnc_showUnitInfo;
        };
    
        switch (_mode) do {
            // In
            case 0: {
                "BIS_fnc_cinemaBorder_disabledSave" call BIS_fnc_disableSaving;
                
                // Hotfix for disabling the restart/load button
                BIS_fnc_cinemaBorder_loadingDisabled = true;
                
                call _DisableGameElements;
                //if wanted - switch player into the 1st person
                
                ("BIS_fnc_cinemaBorder" call BIS_fnc_rscLayer) cutRsc ["RscCinemaBorder", "PLAIN"];
                
                private ["_borderDialog", "_borderTop", "_borderBottom", "_height"];
                _borderDialog = uiNamespace getVariable "RscCinemaBorder";
                _borderTop = _borderDialog displayCtrl 100001;
                _borderBottom = _borderDialog displayCtrl 100002;
                _height = 0.125 * safeZoneH;
                _offset = 0.1;
                
                if( BIS_fnc_cinemaBorder_lockview ) then
                {
                    player switchCamera "INTERNAL";
                };
                setAccTime 1;
    
                showHUD false;
    
                if (_sound) then {
                    if (isClass (configFile >> "CfgSounds" >> "border_in")) then {
                        playSound "border_in";
                    };
                };
    
                _borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _height - _offset, safeZoneW + 2 * _offset, _height + _offset];
                _borderTop ctrlCommit 0;
                _borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _offset,safeZoneW + 2 * _offset, _height + _offset];
                _borderTop ctrlCommit _duration;
    
                _borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH, safeZoneW + 2 * _offset, _height + _offset];
                _borderBottom ctrlCommit 0;
                _borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH - _height, safeZoneW + 2 * _offset, _height + _offset];
                _borderBottom ctrlCommit _duration;
    
                sleep _duration;
    
                showCinemaBorder true;
            };
    
            // Out
            case 1: {
                call _EnableGameElements;
                
                ("BIS_fnc_cinemaBorder" call BIS_fnc_rscLayer) cutRsc ["RscCinemaBorder", "PLAIN"];
                
                private ["_borderDialog", "_borderTop", "_borderBottom", "_height"];
                _borderDialog = uiNamespace getVariable "RscCinemaBorder";
                _borderTop = _borderDialog displayCtrl 100001;
                _borderBottom = _borderDialog displayCtrl 100002;
                _height = 0.125 * safeZoneH;
                _offset = 0.1;
                
                if (_sound) then {
                    if (isClass (configFile >> "CfgSounds" >> "border_out")) then {
                        playSound "border_out";
                    };
                };
    
                showCinemaBorder false;
    
                _borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _offset, safeZoneW + 2 * _offset, _height + _offset];
                _borderTop ctrlCommit 0;
                _borderTop ctrlSetPosition [safeZoneX - _offset, safeZoneY - _height - _offset, safeZoneW + 2 * _offset, _height + _offset];
                _borderTop ctrlCommit _duration;
    
                _borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH - _height, safeZoneW + 2 * _offset, _height + _offset];
                _borderBottom ctrlCommit 0;
                _borderBottom ctrlSetPosition [safeZoneX - _offset, safeZoneY + safeZoneH, safeZoneW + 2 * _offset, _height + _offset];
                _borderBottom ctrlCommit _duration;
    
                sleep _duration;
    
                ("BIS_fnc_cinemaBorder" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
    
                "BIS_fnc_cinemaBorder_disabledSave" call BIS_fnc_enableSaving;
                
                // Hotfix for disabling the restart/load button
                BIS_fnc_cinemaBorder_loadingDisabled = false;
                
                showHUD true;
            };
        };
    };

     

     

    It runs with the same arguments as the developer function:
    [mode, duration, sound, view]

    • Like 1

  13. You can detect the breath holding with the command inputAction:

    inputAction "holdBreath" > 0 // result true means he is holdding his breath by pressing Shift

    And the aiming of the player can be detected by the command cameraView:

    cameraView == "Gunner" // if true, then it means he is aiming

    I also advise you to add other conditions to exclude undesirable situations, for example, when a player drives in a vehicle and presses Shift to accelerate, rather than holding his breath:

    isNull objectParent player // true if player is on foot

     

    • Like 3
×