Quillon 2 Posted July 24, 2016 ...with little programming insight and no arma modding experience. i.e. https://forums.bistudio.com/topic/190389-arma-3-addon-request-thread/?p=3067239 While looking through sights/scope and holding down shift at the same time, it should slow down time for the duration: @FOCUS_MOD\addons\FOCUS_MOD\config.cpp /from pbo class CfgPatches { class FOCUS_MOD { units[] ={}; weapons[] ={}; requiredAddons[] = {}; }; }; class CfgFunctions { class FOCUS { class FOCUS_init { postInit = 1; file = "\FOCUS_MOD\init.sqf"; }; }; }; @FOCUS_MOD\addons\FOCUS_MOD\init.sqf /from pbo //Initialize Once if(FOCUS_MOD_INIT)exitWith{}; FOCUS_MOD_INIT = true; //the path provided should be the relative path from game root directory to the file //not the mod directory //this allows editing without reloading addon nul = [] execVM "\@FOCUS_MOD\data\scriptInit.sqf"; @FOCUS_MOD\data\scriptInit.sqf //init script only run once //check if is server if(!isServer) exitWith{ player sideChat "FOCUS_MOD can only activate on server"; }; //initialize only once if(isNil "FOCUS_MOD_Init") then { FOCUS_MOD_Init = true; //create Game Logic _center = createCenter sideLogic; _grp = createGroup _center; GameLogic_FOCUS_MOD = _grp createUnit ["LOGIC", [100,100,100], [], 0, "NONE"]; player sideChat "FOCUS_MOD System Initialized"; //load key func in RAM [] call compile preprocessFileLineNumbers "@FOCUS_MOD\data\hotkey\fnc_hotkey.sqf"; }; }else{ player sideChat "FOCUS_MOD System Already Initialized"; //TO restore hotkey in save/load in Campaign //load key func in RAM [] call compile preprocessFileLineNumbers "@FOCUS_MOD\data\hotkey\fnc_hotkey.sqf"; }; //place bis function module (reduce CBA dependence) if (isNil "BIS_functions_mainscope"&&isServer) then { _side = createCenter sideLogic; _group = createGroup _side; _logic = _group createUnit ["FunctionsManager", [0,0,0], [], 0, "NONE"]; }; waitUntil {bis_fnc_init}; @FOCUS_MOD\data\hotkey\fnc_hotkey.sqf //This fnc requires GameLogic_FOCUS_MOD to be active //[_keyParams,_keyStatus] call fnc_hotkey_keyAction; fnc_hotkey_keyAction = { private ["_key","_status","_ignoreKey","_varKey","_statusLong"]; //_this select 0 == [_control, _keyID,_shiftPressed,_ctrlPressed,_altPressed] _key = (_this select 0) select 1; //key ID _status = _this select 1; // true = keyDown, false = keyUp //hint str _this; //uncomment to use for detecting key ID _ignoreKey = false; switch (_key) do { case 42: {}; //Shift Left case 2: {}; //1 default {_ignoreKey = true;}; }; //only call log keys when key is not ignored if(!_ignoreKey)then { //When key is pressed, _varKey is true; when it is released, _varKey is false //save key info in gamelogic for multiple key processing _varKey = "KEY_"+(str _key); GameLogic_FOCUS_MOD setVariable [_varKey, _status]; //check if key is having a long press //_statusLong = [_varKey,_status] call fnc_hotkey_longPress; //get long press state //run key manager when a key event is triggered [_varKey,_status] call fnc_hotkey_keyManager; //pass keyUp and keyDown event //run key manager for long press //if(_statusLong)then { // [_varKey,_statusLong] call fnc_hotkey_keyManagerLongPress; //long press key manager }; }; }; fnc_hotkey_keyManager = { //used to monitor key and key combinations to trigger actions //Most functions use keyDown to activate //Some also use keyUp todeactivate //holding keydown will trigger multiple events //optimize for performance //Shift Left && in Scope : focus private ["_mapZoom","_keyState","_varKey"]; _varKey = _this select 0; //key ID _keyState = _this select 1; //key state //Shift left : Focus in scope view //(consider changing since this is a common button) if(GameLogic_FOCUS_MOD getVariable ["Key_42", false]&&cameraView=="Gunner")then { //script will watch Key_42 and terminate on false ["Key_42"] execVM "@FOCUS_MOD\data\special\focus.sqf"; }; }; //WIP fnc_hotkey_keyManagerLongPress = { private ["_varKeyLong","_keyState","_varKey"]; _varKey = _this select 0; //key ID _keyState = _this select 1; //key state _varKeyLong = _varKey + "_Long"; //key ID for long press if(_varKey=="Key_2" )then { player sideChat str _this; }; }; //WIP fnc_hotkey_longPress = { private ["_varKeyCount","_varKeyLong","_keyState","_varKey","_pressCount","_countTrigger","_ret"]; _varKey = _this select 0; //key ID _keyState = _this select 1; //key state _countTrigger = if(count _this >2)then{_this select 2}else{20}; //number of short press before longpress is true _varKeyCount = _varKey + "_Count"; //key ID for key count _varKeyLong = _varKey + "_Long"; //key ID for long press _ret = false; if(_keyState)then { //get how many presses already _pressCount = GameLogic_FOCUS_MOD getVariable [_varKeyCount, 0]; _pressCount = _pressCount + 1; if(_pressCount == _countTrigger)then { GameLogic_FOCUS_MOD setVariable [_varKeyCount, _pressCount]; GameLogic_FOCUS_MOD setVariable [_varKeyLong, true]; _ret = true; }else{ if(_pressCount > _countTrigger)then { GameLogic_FOCUS_MOD setVariable [_varKeyCount, _countTrigger]; GameLogic_FOCUS_MOD setVariable [_varKeyLong, false]; _ret = false; }else{ GameLogic_FOCUS_MOD setVariable [_varKeyCount, _pressCount]; //GameLogic_FOCUS_MOD setVariable [_varKeyLong, false]; _ret = false; }; }; }else{ //reset long press state GameLogic_FOCUS_MOD setVariable [_varKeyCount, 0]; GameLogic_FOCUS_MOD setVariable [_varKeyLong, false]; _ret = false; }; _ret }; @FOCUS_MOD\data\special\focus.sqf //requires GameLogic_FOCUS_MOD to work _varKey = _this select 0; //terminate on this value being false //allow script to run only once if(GameLogic_FOCUS_MOD getVariable ["Focus_Running", false])exitWith{}; GameLogic_FOCUS_MOD setVariable ["Focus_Running", true]; //enable only when in gunner view and key is pressed if(GameLogic_FOCUS_MOD getVariable [_varKey, false]&&cameraView=="Gunner")then { //focus while key is pressed while{GameLogic_FOCUS_MOD getVariable [_varKey, false]}do { setAccTime 0.2; hintSilent "Focus..."; }; }; //return to normal setAccTime 1; hint ""; //unlock script GameLogic_FOCUS_MOD setVariable ["Focus_Running", false]; original mod: https://forums.bistudio.com/topic/168708-the-super-soldier-mode-%E2%80%93-ultimate-cheat-module-for-single-player/ With no response from the other thread I decided to tinker with the files more, I've been on it for three days, failing :D Don't know know why I'm so obsessed over it but as a last resort I'm here. Firstly I tried to workaround the whole mod not running issue with combining config.hpp into config.cpp(then into bin&pbo) which made the game stopped prompting the on screen message "bla bla config not found" but only that. Then, since I don't really understand the code, I tried different structures; pulled the related codes, deleted the rest as best as I could guess Tried keeping the structure, combining scripts/folders etc with only changing the addresses from execVMs and "call compile"s, tried running it as a script and as a mod, tried changing some persistent variable names which relates to original mod name(YQ_MOD) with the name of the feature I'm trying pull, just to better understand it as I go through the code, didn't help tho :P In the process, downloaded and used various tools, googled the hell out of it, searched here and community wiki etc, I'm a fast mislearn-er. It was mostly fun tho. At its last state above; there are only relevant files/codes(according to my best guess),original file/folder structure intact except config.hpp combined into config.cpp which has the only additional few lines I could come with(class CfgFunctions...) after looking through some other mods' config files. Share this post Link to post Share on other sites
Quillon 2 Posted July 25, 2016 I decided to try it in mission editor, put all the files in mission's root, there was an error in init.sqf line 4: rpt: if(FOCUS_MOD_INIT)exitWith{}; FOCUS_MOD_INI> 5:15:50 Error position: <FOCUS_MOD_INIT)exitWith{}; FOCUS_MOD_INI> 5:15:50 Error Undefined variable in expression: focus_mod_init 5:15:50 File C:\Users\---\Documents\Arma 3\missions\Focus_Test.Stratis\init.sqf, line 4 --- 3 if(FOCUS_MOD_INIT)exitWith{}; 4 FOCUS_MOD_INIT = true; Isn't this for defining FOCUS_MOD_INIT? Share this post Link to post Share on other sites
Quillon 2 Posted July 25, 2016 Well... it's working now. Just when I decided to give up I looked back into a mod and copied most of its structure. First try, at last gave a hint of working; actually too much working with constant while loop made it slow mo at 10 fps, sleep command fixed it, I think. I only tried for a few minutes and everything seemed normal. Anyway if anyone wants some slow-mo action: --- thanks to 2fast & bis :D ed: it was broken, stopping working after some time into gameplay. hopefully its fixed now and added kill ticker also. --- ed2/ps: Had ongoing performance issues, finally figured it was caused by this, removed cfg_fucntions from config and reinstated BIS_functions_mainscope or whatever you call "default functions manager" to the mod, seems fixed. Removing other links. https://www.dropbox.com/s/9pgdzixeny36gsp/%40FOCUS%20with%20Kill%20Ticker%20fixed.rar?dl=0 last ed: still has issues, should work 95% of the time tho, eating extra system resources than it should(I'm guessing). also the above "bis_functions..." causes a script error pop up, but strangely performance got a lot better with it, I don't understand... nor know what I have done. Share this post Link to post Share on other sites
Jackal326 1182 Posted July 25, 2016 You do have permission to redistribute right? Share this post Link to post Share on other sites
Quillon 2 Posted July 25, 2016 Haven't thought about it. But he says this: <Terms> You are free to use or modify the content of this mods for your own use. However you are always welcome to share it here first for us to see. I will also integrate it if it fits into my vision of this mod. Don't think I can find & ask him since he seems not active. Don't plan to share anywhere else, but I can remove the link if its breaking some rules(?) ps/unrelated: There is nothing integratable here that his mod didn't have, only a small part of it. Maybe I should move the download link to his thread? ps2: in mod.cpp file the author is him :) Share this post Link to post Share on other sites