Bahger Posted February 7, 2013 Posted February 7, 2013 I think I already know the answer to this question but just to be sure: there's no way to create a condition for a group that is under fire, is there? I've jury-rigged it by using a "Group Less Alive than 100%" but that logic breaks down because it cannot take into account damage that does not kill and it can't be repeated for when the group moves on and I want to make another such condition (both are to generate SITREPS in the form of sound files ("We have reached X location and are in contact with enemy troops to the north, requesting close air support.") Any suggestions?
Grimes Posted February 7, 2013 Posted February 7, 2013 Well the group alive less than x% bases it off of the % of the group alive, not the total life of a group. With some creative usage of triggers you should be able to get two distinct messages, but honestly scripting is the way to go with something like this. Using the scripting engine there is the Unit.getLife() function which will return a number 0 to 1 of how much life the unit has remaining. I suppose the overall idea behind this question might be a useful feature for MIST to help augment AI communications and have AI accurately report which direction they are getting shot from. 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
Bahger Posted February 7, 2013 Author Posted February 7, 2013 Thanks Grimes. I'll only be able to jury-rig an approximation of an "under fire from" condition in this .miz but, yes, the idea of implementing "under fire" and, if possible "from [direction]" should really be implemented in a sim with such emphasis on CAS.
Speed Posted February 7, 2013 Posted February 7, 2013 (edited) Thanks Grimes. I'll only be able to jury-rig an approximation of an "under fire from" condition in this .miz but, yes, the idea of implementing "under fire" and, if possible "from [direction]" should really be implemented in a sim with such emphasis on CAS. Sounds like a good idea, but this is a logical nightmare. It's not an insurmountable problem, it's just a lot of work, a lot more work than the one might initially suppose. Examine, for example, the brute-force method: Say you want to detect incoming enemy fire on a group of units we can refer to as "Group A". - Each time the enemy fires ANY weapon, that weapon goes into a Lua table of fired weapons. - At least 10 times a second, every weapon is checked if: a) the weapon is still "alive" and if so, b) that weapon is within a certain radius of EACH unit in "Group A". c) if the weapon is no longer alive, remove it from the list of checked weapons If a) and b) are true, and we are not logically suppressed from creating a message (you would want to avoid sending up to hundreds of messages every second, so you would need some suppression logic to limit the rate at which the players receive messages) then we get that weapon's velocity, and convert the velocity direction into a compass direction, and then continue on with making an incoming fire message, However, consider the possibility that 500 enemy bullets are in the air at the same time, which is not a rare event, really, and you have 20 units in "Group A". Now, you are doing 500*20*10 = 100000 checks a second. Each check involves getting a unit by a name, then that unit's position, getting a weapon's position, and doing some calculations. This is clearly not ideal, and might lead to a big reduction in frame rate- especially if you had like, 200 units in "Group A" (in that case, "Group A" would probably dozens of groups) and thus you were doing 1,000,000 checks a second. It is possible to optimize this script though. One optimization might be to ignore weapon launches that were further than a certain distance away from your group. A better way would be to scale the rate at which the weapon positions are checked based on how close they are to your group. This starts to get very, very complicated logically. Of course, I mention the group itself. Another optimization might be to get the average position of the units in "Group A" and use that instead of the position of each individual unit- but what if the units are spread out? Do you revert to individual units, or can you analyze the positions of units and break them into clumps? So it gets even MORE complicated now. Oh yea, since cluster munitions are not generated with a shot event, you can't see them. Cluster munitions will not work with this. So, like I said, while the brute force method isn't too terribly complicated, once you add the necessary optimizations, this code gets very complicated, very fast. I did a number of optimizations with the Slmod weapons_impacting_in_zones functions, and got it to run pretty well.. but some of those optimizations are not applicable here. Anyway with the amount of time this takes, other, simpler things are going to take priority first. Edited February 7, 2013 by Speed Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
Bushmanni Posted February 7, 2013 Posted February 7, 2013 Maybe it would work well enough if you check if you have got more damage like Grimes suggested and then check the direction to nearest enemy ground unit with LOS and use that as attack direction. It will not be perfect but I think it could be made to work if the mission designer considers the simplifications and tries to avoid situations where this simplification wouldn't work. DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community -------------------------------------------------- SF Squadron
Bahger Posted February 8, 2013 Author Posted February 8, 2013 Thanks for responding in such detail, Speed. What you say makes a lot of sense and coincides with my (less high-level) understanding of how the ME works and what logic it uses to get the AI to do what it does.
Recommended Posts