DynamicCamo (Updated Version 1.5 ) 17/5/19
What does it do?
It takes account of players stance, uniform and environmental factors to adjust the players and/or AI unitTrait CamouflageCoef and audibleCoef
A low camouflageCoef and audibleCoef gives greater camouflage to the unit and makes it harder for ai to see and hear you.
Units appear to be created with camouflageCoef set t0 1 as default. This script dynamically resets this depending on
a number of factors. It does this each time player changes stance and at set intervals.
This is not just a "stealth" or Ghillie script and will provide camo benefit in all infantry combat. No distinct handling of urban environment at this time. Maybe later.
Why? Player may feel AI are not sufficiently impaired in detecting player by factors such as uniform camo, light level, rain, Overcast level, Fog, and Wind, and Trees, Bushes and rocks near player.
Script allows player to determine what impact these factors will have on AI ability to detect player or ai unit by sight and sound.
It does not alter AI ability to detect movement.
When the script is run on an ai unit it impacts the ability of other ai iunits to see or hear that uit depending on environmental factors etc just as for player.
What influences the Dynamic Camo?
Units stance, units uniform, Fog, Rain, Overcast, light level,wind and bushes or trees and some other objects ( rocks, telephone poles so far) adjacent to unit. Changes happen automatically on change of stance (a minimum 3 second cooldown is built in.) and at scheduled intervals of around five seconds.
Can the effect be adjusted ?
User can adjust impact of the Dynamic camo by passing the range for the impact for both caounflageCoef and AudibleCoef . These are passed as arguments when calling the script.
See guide to adjusting the effect.
Copy script as camoscript.sqf to mission folder.
In player init ( and/or the init of any other ai unit you want to have dynamicCamo running on) put camo = [this, "DEBUG", 0,1,0,1,5] spawn compile preprocessFile "camoscript.sqf"; will run script in DEBUG mode with a five second recalc delay and a full effect..
Remove DEBUG to turn off and just play.
IMPORTANT - the script monitors keys associated with stand/crouch and prone through the use of User1. It will work if you don't do this but you will only get the automatic calculation every five seconds and not the additional stance change triggered recalculation.
Go to the menu - controls>custom controls > User1 and ensure you set both the prone key AND the crouch stand key for User1. ( usually z and x keys)
If you want to use a different User number select User2... User20 as desired, set keys as stated and change User1 to your desired User,n in script.
You don't need to do anything other than occasionally crouch, stand up , go prone and watch the different camouflageCoef that is being set for you.
Try at night V day, with and without rain, fog etc and watch result. In general I am trying to adjust the impact of the various factors so that they combine together sensibly.
User can adjust impacts via linearconversion. If anyone doesn't understand anything please ask. Script prints calculated values when DEBUG on.
A BRIEF GUIDE TO ADJUSTING THE EFFECT -
NOTE 1- It takes quite low values of camouflageCoef to make detection quite hard so this version comes with the factors and the result scaled towards that direction.
2 - I am tuning the impact of factors as the script develops. If you want to try your own tuning try the graph calculator link below then adjust linear conversion output ranges
or specific values ( eg for stance) as required. The values currently in the script give a fairly good out of the box result though.
Plans 1) make specific calculation for audibleCoef- done.2) weighting for unit being near bush(s) - done 3) same for tree(s) 4) parameterise adjustables so that they are supplied by array? done 5) handling of weighting for uniform ( ie ghillie suits etc) done ( may upgrade further) 6) test and weight for inside building 7) useable for squad and other ai. (partly done) 8 ) consider MP and JIP compatibility.
Version/ Update Notes
This is an annotated fully working version. I trust the annotations make the script self explanatory.
Version 1.1 - included setting of audibleCoef. Make unit harder to hear. Separate scaling of effect for audibleCoef to allow user to define how much they want impact on audibleCoef.
Version 1.2 - handling of light level significantly improved around dawn and dusk. Light level impact adjustable via linearconversion.
Version 1.3 - audibleCoef calculation now uses specific factors which can be weighted separately from those for camouflageCoef. Other tweaks include adjustment of range values
Version 1.4 - 1) script now auto recalcs every 5 seconds as well as on stance change. Soldier can keep lower stance camo max five seconds on bob down and up. 2) calculated values shown by systemchat and hint for camouflagecoef , audiblecoef and number of trees/bushes/hides found in 2m radius. Turn of by setting DEBUG to empty string in call ie camo = [this,"DEBUG"] spawn etc. See installation.
3) calculation now influenced by near proximity of trees bushes and hides to player. 4) sleep after stance change calculation shortened to 2s for better responsiveness.
Version 1.5 1) script now has parameters which can be passed to it allowing easy adjustment of Dynamic Camo impact. See USE. 2) Script now gives different DynamicCamo depending on uniform type. 3) Script works with ai to ai. Ai running the script benefit from DynamicCamo. 4) Recalc interval can be specified per instance of the script.
The Script - The script was starting to clutter up this first post so I have removed it. The script is available via the download link for the test scenario at the bottom of this post. If you have any problems getting it from there let me know.
All comments welcome.
I set up this graphical calculator to show how the function works - just mess with the sliders. https://www.desmos.com/calculator/buiia4zs2j
Test scenario mission with v1.5 https://www.dropbox.com/s/xf6x34963ixjue0/camouflagescript.Altis.zip?dl=0
Watch camo level change on stance change. Watch values change as you move about (script in this version also shows opfor man knowsabout unit value with debug set.) Try to escape across the patrolled fields. For me the effect is a bit strong at this point but you can change values in script call. See adjusting the effect above. Make sure to set User1 keys to x and z as instructed above before playing or recalc on stance change wont work.
Sept 2022 - Now available on steam Workshop as a MOD whcih autoruns on player unit at teh start of any scenario, ,mission etc with standard settings giving a reasonable camo impact. THis autorun dynamic Camo can be stopped and mission makers can still use their own parameters or mess with debug mode using the mod.