From d4b854e9af310f721be3c0da5be276289757aea2 Mon Sep 17 00:00:00 2001 From: McDiod Date: Sun, 16 Dec 2018 11:25:26 +0100 Subject: [PATCH] hopefully save radio issues --- functions/missionSetup/cfgFunctions.hpp | 1 + functions/missionSetup/fn_applyUniform.sqf | 4 +- functions/missionSetup/fn_init.sqf | 1 + .../missionSetup/fn_removeInitialWeapon.sqf | 10 +-- .../missionSetup/fn_saveRadioInstance.sqf | 10 +++ mission.sqm | 63 ++++++++++++++++++- 6 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 functions/missionSetup/fn_saveRadioInstance.sqf diff --git a/functions/missionSetup/cfgFunctions.hpp b/functions/missionSetup/cfgFunctions.hpp index 6b011ca..e306ba6 100644 --- a/functions/missionSetup/cfgFunctions.hpp +++ b/functions/missionSetup/cfgFunctions.hpp @@ -14,6 +14,7 @@ class gungame_missionSetup { class randomizeTeams {}; class randomizeUniforms {}; class removeInitialWeapon {}; + class saveRadioInstance {}; class scoreBoard {}; class selectWeapons {}; class setRadioFrequencies {}; diff --git a/functions/missionSetup/fn_applyUniform.sqf b/functions/missionSetup/fn_applyUniform.sqf index 3661abc..904aca6 100644 --- a/functions/missionSetup/fn_applyUniform.sqf +++ b/functions/missionSetup/fn_applyUniform.sqf @@ -6,6 +6,6 @@ private _teamNamespace = player getVariable [QGVAR(teamNamespace),objNull]; private _uniform = _teamNamespace getVariable [QGVAR(teamUniform),""]; private _isWoodLand = toLower ([missionConfigFile >> "CfgIslands" >> worldName,"isWoodland",1] call BIS_fnc_returnConfigEntry) == "true"; private _vest = ["V_TacVest_khk","V_TacVest_oli"] select _isWoodland; +private _radio = player getVariable [QGVAR(radioInstance),"TFAR_anprc152"]; - -player setUnitLoadout [[],[],[],[_uniform,[["ACE_fieldDressing",6],["ACE_morphine",4]]],[_vest,[]],[],"","",["Binocular","","","",[],[],""],["ItemMap","ItemGPS","TFAR_anprc152","ItemCompass","ItemWatch",""]]; +player setUnitLoadout [[],[],[],[_uniform,[["ACE_fieldDressing",6],["ACE_morphine",4]]],[_vest,[]],[],"","",["Binocular","","","",[],[],""],["ItemMap","ItemGPS",_radio,"ItemCompass","ItemWatch",""]]; diff --git a/functions/missionSetup/fn_init.sqf b/functions/missionSetup/fn_init.sqf index 3046ed4..3995500 100644 --- a/functions/missionSetup/fn_init.sqf +++ b/functions/missionSetup/fn_init.sqf @@ -13,6 +13,7 @@ }; [] call FUNC(removeInitialWeapon); + [] call FUNC(saveRadioInstance); player addEventHandler ["Killed", EFUNC(events,onPlayerKilled)]; player addEventHandler ["Respawn", EFUNC(events,onPlayerRespawn)]; diff --git a/functions/missionSetup/fn_removeInitialWeapon.sqf b/functions/missionSetup/fn_removeInitialWeapon.sqf index 1fbdb14..55e5a7a 100644 --- a/functions/missionSetup/fn_removeInitialWeapon.sqf +++ b/functions/missionSetup/fn_removeInitialWeapon.sqf @@ -1,11 +1,3 @@ #include "component.hpp" -removeAllWeapons player; -removeAllItems player; -removeAllAssignedItems player; -removeVest player; -removeBackpack player; -removeHeadgear player; -removeGoggles player; - -player linkItem "ItemGPS"; +player setUnitLoadout [[],[],[],["U_Marshal",[]],[],[],"","",[],["ItemMap","ItemGPS","TFAR_anprc152","ItemCompass","ItemWatch",""]]; diff --git a/functions/missionSetup/fn_saveRadioInstance.sqf b/functions/missionSetup/fn_saveRadioInstance.sqf new file mode 100644 index 0000000..08dead3 --- /dev/null +++ b/functions/missionSetup/fn_saveRadioInstance.sqf @@ -0,0 +1,10 @@ +#include "component.hpp" + +[QGVAR(radiosReceivedEH), "OnRadiosReceived",{ + params ["","_args"]; + _args params [["_radioClassname","TFAR_anprc152"]]; + + player setVariable [QGVAR(radioInstance),_radioClassname]; + [QGVAR(radiosReceivedEH),"OnRadiosReceived"] call tfar_fnc_removeEventHandler; + +},player] call TFAR_fnc_addEventHandler; diff --git a/mission.sqm b/mission.sqm index 3489c25..1a3c21c 100644 --- a/mission.sqm +++ b/mission.sqm @@ -112,7 +112,7 @@ class CustomAttributes }; class value { - items=52; + items=53; class Item0 { class data @@ -841,6 +841,20 @@ class CustomAttributes value="tfar_givemicrodagrtosoldier"; }; }; + class Item52 + { + class data + { + class type + { + type[]= + { + "STRING" + }; + }; + value="tfar_setting_defaultfrequencies_sr_west"; + }; + }; }; }; }; @@ -857,7 +871,7 @@ class CustomAttributes }; class value { - items=52; + items=53; class Item0 { class data @@ -3198,6 +3212,51 @@ class CustomAttributes }; }; }; + class Item52 + { + class data + { + class type + { + type[]= + { + "ARRAY" + }; + }; + class value + { + items=2; + class Item0 + { + class data + { + class type + { + type[]= + { + "STRING" + }; + }; + value="100,110,120,130,140,150"; + }; + }; + class Item1 + { + class data + { + class type + { + type[]= + { + "SCALAR" + }; + }; + value=1; + }; + }; + }; + }; + }; }; }; };