Skip to content

Commit

Permalink
Combazone sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
tuntematonjr committed Feb 4, 2023
1 parent ba02f12 commit 4dc3219
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
12 changes: 6 additions & 6 deletions addons/Utilities/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ class CfgVehicles {
defaultValue = "Warning!<br />You are leaving the combatzone. TURN BACK!";
};

class sound {
displayName = "Sound";
//description = "";
typeName = "STRING";
defaultValue = "beep_strobe";
};
// class sound {
// displayName = "Sound";
// //description = "";
// typeName = "STRING";
// defaultValue = "beep_strobe";
// };

class sideWest {
displayName = "Enable West";
Expand Down
32 changes: 24 additions & 8 deletions addons/Utilities/functions/fnc_combatZone.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private _module = param [0,objNull,[objNull]];
private _markerPreFix = _module getVariable ["markerPreFix", ""];
private _markerCount = _module getVariable ["markerCount", 0];
private _updateInterval= _module getVariable ["updateInterval", ""];
private _sound = _module getVariable ["sound", ""];
//private _sound = _module getVariable ["sound", ""];
private _hintText = _module getVariable ["hintText", ""];
private _sideWest = _module getVariable ["sideWest", false];
private _sideEast = _module getVariable ["sideEast", false];
Expand Down Expand Up @@ -44,7 +44,7 @@ private _debugText = format ["init combatzone for: %1", _sides];
LOG(_debugText);

[{ !isNull player && ( !isnull findDisplay 52 || !isnull findDisplay 53 || !isnull findDisplay 12 )}, {
_this params ["_sides", "_markerPrefix", "_markerCount", "_updateInterval", "_hintText", "_sound"];
_this params ["_sides", "_markerPrefix", "_markerCount", "_updateInterval", "_hintText"];
if (playerside in _sides && isNil QGVAR(borderPolygon)) then {
GVAR(borderPolygon) = [];
for "_i" from 1 to _markerCount do {
Expand All @@ -60,23 +60,39 @@ LOG(_debugText);
};

[{ controlNull isNotEqualTo (findDisplay 12 displayCtrl 51) }, {
_this params ["_updateInterval", "_hintText", "_sound"];
_this params ["_updateInterval", "_hintText"];
diag_log "combatzone";
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
_this select 0 drawPolygon [GVAR(borderPolygon), [1,0,0,1]];
}];
LOG("Create combatzone for main screen");
_handle = [{
_args params ["_hintText", "_sound"];
_args params ["_hintText"];
if ( player isKindOf "man" && {alive player} && {!(player isKindOf "ace_spectator_virtual")} && {playerSide in [west,east,resistance,civilian]} && {!(vehicle player isKindOf "air")} && {!(player getVariable ["tun_respawn_waiting_respawn", false])} ) then {
private _player_pos = getpos player;
if !( _player_pos inPolygon GVAR(borderPolygon)) then {
[(format["<t color='#ff0000' size = '.8'>%1</t>",_hintText]),-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;
playSound _sound;
switch (ceil random 3) do {
case 1: {
playSound3D ['a3\dubbing_f_epa\zone_restriction\A_Warn_No_Leader\zone_restriction_a_warn_no_leader_KER_0.ogg', player];

[[profileName, "Where the hell am I? I should check my map.", 0]] spawn BIS_fnc_EXP_camp_playSubtitles;
};
case 2: {
playSound3D ['a3\dubbing_f_epa\zone_restriction\A_Warn_No_Leader\zone_restriction_a_warn_no_leader_KER_1.ogg', player];

[[profileName, "This doesn't look right at all. Where am I?", 0]] spawn BIS_fnc_EXP_camp_playSubtitles;
};
case 3: {
playSound3D ['a3\dubbing_f_epa\zone_restriction\A_Warn_No_Leader\zone_restriction_a_warn_no_leader_KER_2.ogg', player];

[['SPEAKER', "Wow, I must be way off course. Better check my map.", 0]] spawn BIS_fnc_EXP_camp_playSubtitles;
};
};
LOG("player out of AO");
};
};
}, _updateInterval, [_hintText, _sound]] call CBA_fnc_addPerFrameHandler;
}, [_updateInterval, _hintText, _sound]] call CBA_fnc_waitUntilAndExecute;
}, _updateInterval, [_hintText]] call CBA_fnc_addPerFrameHandler;
}, [_updateInterval, _hintText]] call CBA_fnc_waitUntilAndExecute;
};
}, [_sides, _markerPrefix, _markerCount, _updateInterval, _hintText, _sound]] call CBA_fnc_waitUntilAndExecute;
}, [_sides, _markerPrefix, _markerCount, _updateInterval, _hintText]] call CBA_fnc_waitUntilAndExecute;
4 changes: 2 additions & 2 deletions addons/Utilities/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#define MAJOR 1
#define MINOR 1
#define PATCHLVL 0
#define BUILD 07012023
#define PATCHLVL 1
#define BUILD 04022023

#define VERSION MAJOR.MINOR.PATCHLVL.BUILD
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
Expand Down

0 comments on commit 4dc3219

Please sign in to comment.