GEORGE FLOROS GR 4207 Posted March 26, 2019 Ok so soon there will be an update thanks to Pierre ! and in the update there will be incuded also HazJ's addition : Spoiler On 4/7/2018 at 2:59 AM, HazJ said: player setVariable ["weaponHolstered", true]; player addMagazine "HandGrenade"; [] spawn { throwKeyEH = (findDisplay 46) displayAddEventHandler ["KeyDown", { if (param [1] == (actionKeys "Throw" select 0) && player getVariable "weaponHolstered") then // change getVariable to whatever condition you need { hintSilent "Throw is blocked when your weapon is holstered."; true } else { false }; }]; }; and there will be also a Mod version available. Thanks ! 1 1 Share this post Link to post Share on other sites
LSValmont 789 Posted March 27, 2019 Thank you Pierre, HazJ and George for all your contributions! I will be finally able to use this script fully! 2 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted March 27, 2019 Well!, This is for SP , because the above doesn't work for SP. So maybe it's ideal for MP as well. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#Loaded addMissionEventHandler ["Loaded", { params ["_saveType"]; If(_saveType isEqualto "continue") then{ [] execVM "GF_Holster\GF_Holster.sqf"; }; }]; 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted March 27, 2019 Tested in SP + MP & this is how it should be in the init : addMissionEventHandler ["Loaded", { params ["_saveType"]; If(_saveType isEqualto "continue") then{ [] execVM "GF_Holster\GF_Holster.sqf"; }; }]; [] execVM "GF_Holster\GF_Holster.sqf"; 1 Share this post Link to post Share on other sites
LSValmont 789 Posted March 27, 2019 2 minutes ago, GEORGE FLOROS GR said: Tested in SP + MP & this is how it should be in the init : addMissionEventHandler ["Loaded", { params ["_saveType"]; If(_saveType isEqualto "continue") then{ [] execVM "GF_Holster\GF_Holster.sqf"; }; }]; [] execVM "GF_Holster\GF_Holster.sqf"; Thanks George! Will test this ASAP! 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted March 27, 2019 If someone can test this further in MP this is the whole updated code : Changelog v.2.0 GF_Holster.sqf Spoiler //________________ Author : GEORGE FLOROS [GR] ___________ 27.03.19 ___________ /* ________________ GF Holster Script - Mod ________________ https://forums.bohemia.net/forums/topic/215826-gf-holster-script-mod/ Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ ArmA 3 | Notepad ++ SQF tutorial https://www.youtube.com/watch?v=aI5P7gp3x90 and also use the extra pluggins (this way will be better , it will give also some certain colors to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ BI Forum Ravage Club Owner : https://forums.bohemia.net/clubs/73-bi-forum-ravage-club/ */ /* https://forums.bohemia.net/forums/topic/215798-weapon-holster-by-key-pressed/?tab=comments#comment-3281031 You can search here for key bindings https://community.bistudio.com/wiki/DIK_KeyCodes DIK_5 0x06 DIK_TAB 0x0F */ waitUntil {!isNull player}; //________________ Settings ________________ //________________ Set true or false ________________ GF_Holster_hintSilent_info = true; GF_Holster_systemchat_info = true; GF_Holster_diag_log_info = true; GF_Holster_key = 0x06; // key 5 GF_Holster_Disable_Throw = true; if (GF_Holster_systemchat_info) then{ systemchat "GF Holster Script - Mod initializing"; }; if (GF_Holster_diag_log_info) then{ diag_log "//________________ GF Holster Script - Mod initializing ________________"; }; [player] spawn { disableSerialization; waitUntil {!(isNull (findDisplay 46))}; _display = findDisplay 46; _display displayAddEventHandler["KeyDown", { params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"]; if(_key isEqualto GF_Holster_key) then { if (currentWeapon player != "" )then{ player setVariable ["Var_HazJ_Holstered", true]; player action ["SWITCHWEAPON",player,player,-1]; waitUntil {currentWeapon player isEqualto "" or {primaryWeapon player isEqualto "" && handgunWeapon player isEqualto ""}}; if (GF_Holster_hintSilent_info) then{ hintSilent"Weapon on the back"; }; }else{ player setVariable ["Var_HazJ_Holstered", false]; player action ["SWITCHWEAPON",player,player,0]; if (GF_Holster_hintSilent_info) then{ hintSilent"Weapon in front"; }; }; }; }]; }; if(GF_Holster_Disable_Throw)then { [player] spawn{ HazJ_throwKeyEH = (findDisplay 46) displayAddEventHandler ["KeyDown", { if (param [1] == (actionKeys "Throw" select 0) && player getVariable "Var_HazJ_Holstered") then{ if(GF_Holster_hintSilent_info)then{ hintSilent "Throw is blocked when your weapon is holstered."; }; true }else{false}; }]; }; }; if (GF_Holster_systemchat_info) then{ systemchat "GF Holster Script - Mod initialized"; systemchat "H o l s t e r y o u r W e a p o n w i t h k e y 5"; }; if (GF_Holster_diag_log_info) then{ diag_log "//________________ GF Holster Script - Mod initialized ________________"; }; init.sqf Spoiler //________________ Author : GEORGE FLOROS [GR] ___________ 27.03.19 ___________ /* ________________ GF Holster Script - Mod ________________ https://forums.bohemia.net/forums/topic/215826-gf-holster-script-mod/ Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ ArmA 3 | Notepad ++ SQF tutorial https://www.youtube.com/watch?v=aI5P7gp3x90 and also use the extra pluggins (this way will be better , it will give also some certain colors to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ BI Forum Ravage Club Owner : https://forums.bohemia.net/clubs/73-bi-forum-ravage-club/ */ [] execVM "GF_Holster\Credits.sqf"; // Please keep the Credits or add them to your Diary addMissionEventHandler ["Loaded", { params ["_saveType"]; If(_saveType isEqualto "continue") then{ [] execVM "GF_Holster\GF_Holster.sqf"; }; }]; [] execVM "GF_Holster\GF_Holster.sqf"; Thanks ! 1 Share this post Link to post Share on other sites
LSValmont 789 Posted March 27, 2019 Its not working for me, I am getting an Invalid Number error. (I am using the scripts in the previous post). Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted March 28, 2019 6 hours ago, LSValmont said: (I am using the scripts in the previous post). 13 hours ago, GEORGE FLOROS GR said: Changelog v.2.0 GF_Holster.sqf Reveal hidden contents //________________ Author : GEORGE FLOROS [GR] ___________ 27.03.19 ___________ /* ________________ GF Holster Script - Mod ________________ https://forums.bohemia.net/forums/topic/215826-gf-holster-script-mod/ Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ ArmA 3 | Notepad ++ SQF tutorial https://www.youtube.com/watch?v=aI5P7gp3x90 and also use the extra pluggins (this way will be better , it will give also some certain colors to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ BI Forum Ravage Club Owner : https://forums.bohemia.net/clubs/73-bi-forum-ravage-club/ */ /* https://forums.bohemia.net/forums/topic/215798-weapon-holster-by-key-pressed/?tab=comments#comment-3281031 You can search here for key bindings https://community.bistudio.com/wiki/DIK_KeyCodes DIK_5 0x06 DIK_TAB 0x0F */ waitUntil {!isNull player}; //________________ Settings ________________ //________________ Set true or false ________________ GF_Holster_hintSilent_info = true; GF_Holster_systemchat_info = true; GF_Holster_diag_log_info = true; GF_Holster_key = 0x06; // key 5 GF_Holster_Disable_Throw = true; if (GF_Holster_systemchat_info) then{ systemchat "GF Holster Script - Mod initializing"; }; if (GF_Holster_diag_log_info) then{ diag_log "//________________ GF Holster Script - Mod initializing ________________"; }; [player] spawn { disableSerialization; waitUntil {!(isNull (findDisplay 46))}; _display = findDisplay 46; _display displayAddEventHandler["KeyDown", { params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"]; if(_key isEqualto GF_Holster_key) then { if (currentWeapon player != "" )then{ player setVariable ["Var_HazJ_Holstered", true]; player action ["SWITCHWEAPON",player,player,-1]; waitUntil {currentWeapon player isEqualto "" or {primaryWeapon player isEqualto "" && handgunWeapon player isEqualto ""}}; if (GF_Holster_hintSilent_info) then{ hintSilent"Weapon on the back"; }; }else{ player setVariable ["Var_HazJ_Holstered", false]; player action ["SWITCHWEAPON",player,player,0]; if (GF_Holster_hintSilent_info) then{ hintSilent"Weapon in front"; }; }; }; }]; }; if(GF_Holster_Disable_Throw)then { [player] spawn{ HazJ_throwKeyEH = (findDisplay 46) displayAddEventHandler ["KeyDown", { if (param [1] == (actionKeys "Throw" select 0) && player getVariable "Var_HazJ_Holstered") then{ if(GF_Holster_hintSilent_info)then{ hintSilent "Throw is blocked when your weapon is holstered."; }; true }else{false}; }]; }; }; if (GF_Holster_systemchat_info) then{ systemchat "GF Holster Script - Mod initialized"; systemchat "H o l s t e r y o u r W e a p o n w i t h k e y 5"; }; if (GF_Holster_diag_log_info) then{ diag_log "//________________ GF Holster Script - Mod initialized ________________"; }; init.sqf Reveal hidden contents //________________ Author : GEORGE FLOROS [GR] ___________ 27.03.19 ___________ /* ________________ GF Holster Script - Mod ________________ https://forums.bohemia.net/forums/topic/215826-gf-holster-script-mod/ Please keep the Credits or add them to your Diary https://community.bistudio.com/wiki/SQF_syntax Don't try to open this with the simple notepad. For everything that is with comment // in front or between /* means that it is disabled , so there is no need to delete the extra lines. You can open this ex: with notepad++ https://notepad-plus-plus.org/ ArmA 3 | Notepad ++ SQF tutorial https://www.youtube.com/watch?v=aI5P7gp3x90 and also use the extra pluggins (this way will be better , it will give also some certain colors to be able to detect ex. problems ) http://www.armaholic.com/page.php?id=8680 or use any other program for editing . For the Compilation List of my GF Scripts , you can search in: https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/ BI Forum Ravage Club Owner : https://forums.bohemia.net/clubs/73-bi-forum-ravage-club/ */ [] execVM "GF_Holster\Credits.sqf"; // Please keep the Credits or add them to your Diary addMissionEventHandler ["Loaded", { params ["_saveType"]; If(_saveType isEqualto "continue") then{ [] execVM "GF_Holster\GF_Holster.sqf"; }; }]; [] execVM "GF_Holster\GF_Holster.sqf"; Share this post Link to post Share on other sites
LSValmont 789 Posted March 28, 2019 6 hours ago, GEORGE FLOROS GR said: Yeap now totally works! Super Cool! But I had to change: addMissionEventHandler ["Loaded", { params ["_saveType"]; If(_saveType isEqualto "continue") then{ [] execVM "GF_Holster\GF_Holster.sqf"; }; }]; I just had to remove the If(_saveType isEqualto "continue") as I was saving with a script and continue seems to work only with the menu save. Anyways, thank you! 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted March 29, 2019 Changelog: 2.0 Fixed working after save in SP + MP. There is also a Mod version available. GF Holster Script - Mod Share this post Link to post Share on other sites
topden 62 Posted February 13, 2021 I liked your scripts, but there are always some imperfections), for example, can this script be made so that in a prone position you can remove the weapon without standing up? Share this post Link to post Share on other sites
dr0nt_ 0 Posted July 20, 2021 So, If I need that AI is holstered all weapons? Next code does`nt work if AI has both primary and secondary weapon. This code work only when AI has a pistol. this action ["SWITCHWEAPON",this, this, -1]; waitUntil {currentWeapon this == "" or {primaryWeapon this == "" && handgunWeapon this == ""}}; Share this post Link to post Share on other sites