JackDant Posted November 14, 2015 Posted November 14, 2015 Hi all, I'm working on some scripting to improve and automate ground AI behaviour and reactions, and I'm a bit stumped when it comes to an unit's engagement range. The range is visible in the mission editor and the F10 map, and I can see it defined in the .lua files under Scripts\Database\vehicles as "ThreatRange". But I can't figure out how to read that value from my Lua scripts. Right now I'm just doing an approximation based on unit type, but that's not very scalable. Any ideas? Thanks,
Grimes Posted November 14, 2015 Posted November 14, 2015 There are several unit functions that can be used to derive the data you seek. Unit.getDesc() gives you some basic information about the unit itself like max speed, approx size, list of attributes, etc. Unit.getSensors() gives you a table of information on each sensor the object has. The detection distances I believe are displayed are for objects that have an RCS of 5m^2. Larger objects will yield larger detection distance. Unit.getAmmo() gives you an idea of what each weapon on board is capable of along with other information that can be used to decipher the type of weapon it is. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
JackDant Posted November 14, 2015 Author Posted November 14, 2015 Thanks Grimes, I've looked into those functions, and while I can get speed from them (another thing I was missing), I still can't get the maximum engagement range. I'm talking in particular about the guns of armored vehicles, not missiles. Is there any other option?
Recommended Posts