damotr 49 Posted April 27, 2017 Okay, I don't know if anybody made it before me, but I finally solve the problem of "in-OFP/CWA-Nigh-Vision-Scopes". It uses Fwatch First of all: I made it for my modification and models used in video are not mine. I don't know if mod will be released. Okay: to the technicals - Any living unit in my mod has looped script checking some conditions. For AI it's 5sec loop, for player it's 1sec loop. - Weapon "Checker2" is just binocular used for checking empty space in items - All NV Scopes has opticsZoomMin and opticsZoomMax equal 0.19 - There is matrix of all NVS-equiped weapons:_weapons_NVscope = ["M16A2_PVS4","CAR15_PVS4","CAR15_SD_PVS4","M16A2_M203_PVS4","CAR15_M203_PVS4","CAR15_SD_M203_PVS4","M14_PVS4","M14_SD_PVS4","MP5A4_PVS4","MP5SD6_PVS4","M60E4_PVS4","M60_PVS4","AKML_NSPU","AKML_GP25_NSPU","AKML_SD_NSPU","AKML_SD_GP25_NSPU","AK74N_NSPU","AK74N_GP25_NSPU","AK74N_SD_NSPU","AK74N_SD_GP25_NSPU","PKMSN_NSPU","RPK74N_NSPU","SVD_NSPU","VSS_NSPU"] - There is a matrix of all NVS-weapons initialized soldiers (global, contains soldiers that actually running NVS-script)NVScope_Units_Units - Looped script has line: Quote if (((primaryweapon _soldier) in _weapons_NVscope) and (_soldier == PLAYER) and not (_soldier in NVScope_Units_Units)) then {[_soldier] exec "\SoldiersInit\NVScope.sqs"} else {} - Now NVS-script: Quote ; Damotr's Night Vision Scope Script [] exec "..\fwatch\data\MemMulti.sqs" @Format ["%1",count FWATCH_MEM_MULTI] != "scalar" _soldier = _this select 0; _weapon = primaryweapon _soldier _fov = "0.253333" ; FOV that is for opticsMin and Max equal 0.19 _item = "none" _map = false if(format[{%1},NVScope_Units_Units]==SLX_Null)then{NVScope_Units_Units=[]} else {} if (_soldier in NVScope_Units_Units) then {goto "end"} else {} ; we only need soldiers that are man-class. No cargo, driver etc. if (typeOF (driver _soldier) == typeOF (vehicle _soldier)) then {} else {goto "end"} ; Matrix with initalized units, so script won't be triggerd more than once NVScope_Units_Units = NVScope_Units_Units + [_soldier] _weapons_NVscope = ["M16A2_PVS4","CAR15_PVS4","CAR15_SD_PVS4","M16A2_M203_PVS4","CAR15_M203_PVS4","CAR15_SD_M203_PVS4","M14_PVS4","M14_SD_PVS4","MP5A4_PVS4","MP5SD6_PVS4","M60E4_PVS4","M60_PVS4","AKML_NSPU","AKML_GP25_NSPU","AKML_SD_NSPU","AKML_SD_GP25_NSPU","AK74N_NSPU","AK74N_GP25_NSPU","AK74N_SD_NSPU","AK74N_SD_GP25_NSPU","PKMSN_NSPU","RPK74N_NSPU","SVD_NSPU","VSS_NSPU"] #loop if ((ALIVE _soldier) and (_soldier hasweapon _weapon) and (_weapon in _weapons_NVscope)) then {} else {goto "end"} _fovnv = (FWATCH_MEM_MULTI select 0) select 5 _fovn = format ["%1",_fovnv] _nvgoggles = _soldier hasweapon "NVGoggles" _nvgprev = FWATCH_MEM_MULTI select 2 if (_fovn == _fov) then {goto "on"} else {goto "loop"} #on if (_nvgoggles or (_soldier hasweapon "NVGoggles")) then {goto "on2"} else {} ; here we check if unit has empty space for items _soldier addweapon "Checker2" if (_soldier hasweapon "Checker2") then {_soldier removeweapon "Checker2"; _soldier addweapon "NVGoggles"; goto "on2"} else {_soldier removemagazine "Checker"} ; if not we'll take least important equipment if (_soldier hasweapon "Shovel_East_Item") then {_soldier removeweapon "Shovel_East_Item"; _soldier addweapon "NVGoggles"; _item = "Shovel_East_Item"; goto "on2"} else {} if (_soldier hasweapon "M7_Bayonet_Knife_Item") then {_soldier removeweapon "M7_Bayonet_Knife_Item"; _soldier addweapon "NVGoggles"; _item = "M7_Bayonet_Knife_Item"; goto "on2"} else {} if (_soldier hasweapon "6H4_Bayonet_Knife_Item") then {_soldier removeweapon "6H4_Bayonet_Knife_Item"; _soldier addweapon "NVGoggles"; _item = "6H4_Bayonet_Knife_Item"; goto "on2"} else {} if (_soldier hasweapon "Binocular") then {_soldier removeweapon "Binocular"; _soldier addweapon "NVGoggles"; _item = "Binocular"; goto "on2"} else {} #on2 _map = FWATCH_MEM_MULTI select 1 _nvgon = FWATCH_MEM_MULTI select 2 if NOT (_nvgon) then {_soldier action [{NVGOGGLES}]} else {} _fovnv = (FWATCH_MEM_MULTI select 0) select 5 _fovn = format ["%1",_fovnv] if (_map) then {loadFile ":mem setmap 0"} else {} if ((_fovn == _fov) and (not _map)) then {goto "on"} else {goto "off"} #off if (_nvgoggles) then {} else {_soldier removeweapon "NVGoggles"} if (_item != "none") then {_soldier addweapon _item} else {} _item = "none" _map = false _nvgon = FWATCH_MEM_MULTI select 2 if ((_nvgon) and NOT (_nvgprev)) then {_soldier action [{NVGOGGLES}]} else {} goto "loop" #end NVScope_Units_Units = NVScope_Units_Units - [_soldier] exit Known bugs: - If weapon has multiple modes, always first will be selected after using NVS - There is no posibility of using map during aiming. That allows player to drop NVGoggles (on video You may see blinking - thats me pressing M) - AI won't be equiped with NVG, so it's not appering on their heads - Any idea of how it works in MP 3 Share this post Link to post Share on other sites
faguss 65 Posted April 27, 2017 Please use MemMulti.sqs script [] exec "..\fwatch\data\MemMulti.sqs" @Format ["%1",count FWATCH_MEM_MULTI] != "scalar" #loop _fovnv = (FWATCH_MEM_MULTI select 0) select 5 _nvgprev = FWATCH_MEM_MULTI select 2 ... #on2 _map = FWATCH_MEM_MULTI select 1 _nvgon = FWATCH_MEM_MULTI select 2 _fovnv = (FWATCH_MEM_MULTI select 0) select 5 ... #off _nvgon = FWATCH_MEM_MULTI select 2 1 Share this post Link to post Share on other sites
damotr 49 Posted April 27, 2017 Thanks, code updated, also _nvadd was meaningless Share this post Link to post Share on other sites
damotr 49 Posted May 16, 2017 MP compatibility checked. Works fine. Share this post Link to post Share on other sites