Exorcet Posted December 15, 2023 Share Posted December 15, 2023 I'm trying to bypass ME limitations and give ground attack planes STEIZ tasks for self defense. The annoying part is finding the position for the task. I thought it would simplify things to use a trigger zone in the mission to mark the position, but I'm not having success writing a script. I do get an error message running it in game, but the message is blank. Concept summary: -Place trigger zone in mission -Run script that: -Finds position of trigger zone -Translates position from Vec3 to Vec2 -Uses Vec2 position to define STEIZ task Code: local sdzone = trigger.misc.getZone('TZB1') --Trigger Zone Blue 1 local sdposV3 = sdzone.getPoint() --Vec3 local sdposV2 = { --convert Vec3 to Vec2, Vec3 = {x (N/S), y (alt), Z (E/W) > check this | LAlt + Y to show Vec2/3 in infobar live sdposV3.x, sdposV3.z } local _f0 = Group.getByName("B") --Get aircraft group local _f0c = Group.getByName("B"):getController() --Get group controller local AAsd = { id = "SDinZ1", params = { point = sdposV2, zoneRadius = 37040, -- 185200 = 100 nmi, 92600 = 50 nmi, 37040 = 20 nmi, 27780 = 15 nmi, 14816 = 8 nmi targetTypes = {"Fighters", "Multirole Fighters", "Interceptors"}, priority = 1, }, } _f0c:pushTask(AAsd) There may be a stupid mistake somewhere, but I'm just not seeing it. Awaiting: DCS F-15C Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files Link to comment Share on other sites More sharing options...
Exorcet Posted December 15, 2023 Author Share Posted December 15, 2023 Update the code seems to have correct Syntax now, but the AI will not engage, even with the enemy in proximity, the radius massively increased, and AWACS and EWR support available: local sdzone = trigger.misc.getZone('TZB1') --Trigger Zone Blue 1 local sdposV3 = sdzone.point --Vec3 local sdposV2 = { --convert Vec3 to Vec2, Vec3 = {x (N/S), y (alt), Z (E/W) > check this | LAlt + Y to show Vec2/3 in infobar live sdposV3.x, sdposV3.z } local _f0 = Group.getByName("B") --Get aircraft group local _f0c = Group.getByName("B"):getController() --Get group controller local AAsd = { id = "EngageTargetsInZone", params = { point = sdposV2, zoneRadius = 185200, -- 185200 = 100 nmi, 92600 = 50 nmi, 37040 = 20 nmi, 27780 = 15 nmi, 14816 = 8 nmi targetTypes = {"Fighters", "Multirole Fighters", "Interceptors"}, priority = 1, }, } _f0c:pushTask(AAsd) trigger.action.outText('X: ' ..sdposV2[1] .. ' Z:' ..sdposV2[2], 60, true) -- Confirm Vec2 array handled correctly Awaiting: DCS F-15C Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files Link to comment Share on other sites More sharing options...
Exorcet Posted December 16, 2023 Author Share Posted December 16, 2023 It is beginning to feel like STEIZ doesn't work at all, but that doesn't seem remotely right unless it's bugged in the current DCS version? I added the task to a CAP flight and it still won't work. Essentially the code for STE, not using a zone, works fine. If anyone has done this before some guidance would be really helpful. Awaiting: DCS F-15C Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files Link to comment Share on other sites More sharing options...
Solution toutenglisse Posted December 17, 2023 Solution Share Posted December 17, 2023 23 hours ago, Exorcet said: ...Essentially the code for STE, not using a zone, works fine... I think your sdposV2 is wrong. It is a table of 2 values, when it should be a table of 2 indexed values (x and y) : sdposV2 = {x=sdposV3.x,y=sdposV3.z} 1 Link to comment Share on other sites More sharing options...
Exorcet Posted December 17, 2023 Author Share Posted December 17, 2023 (edited) 3 hours ago, toutenglisse said: I think your sdposV2 is wrong. It is a table of 2 values, when it should be a table of 2 indexed values (x and y) : sdposV2 = {x=sdposV3.x,y=sdposV3.z} Thanks for taking a look, but the code seems to work the same with both formats for that variable. Further testing shows it is a bizarre AI issue. For some reason the AI refuses to attack in this particular setup: The code works, without any changes, in another mission where the red plane is in a different location. It also works in this mission if I move the red plane. This would all make sense if it was an issue with the AI being able to detect the other plane, but it's not. I added an AWACS and a player controlled fighter. I can see the enemy on the DL. The AI can't see what is on its left. EDIT I've looked deeper and it is actually even more strange, but at least now I think there is a solution. @toutenglisseis correct. However my incorrect code somehow only fails to work when the target is on the left. I guess what's happening is coincidence based on how the Vec2 variables are being handled. EDIT 2 The broken Vec2 positions made the zone default to Bullseye. By nothing but chance, this put the target out of the zone on the left, but not on the right. Problem solved. For reference, here is the correct code for anyone wishing to use it: local zr = 30 -- zoneRadius input nmi local sdzone = trigger.misc.getZone('TZB1') --Trigger Zone Blue 1 local sdposV3 = sdzone.point --Vec3 local sdposV2 = { --convert Vec3 to Vec2, Vec3 = {x (N/S), y (alt), Z (E/W) | LAlt + Y to show Vec2/3 in infobar live x = sdposV3.x, y = sdposV3.z } local _f0 = Group.getByName("B") --Get aircraft group local _f0c = Group.getByName("B"):getController() --Get group controller local AAsd = { id = "EngageTargetsInZone", params = { point = sdposV2, zoneRadius = zr*1852, targetTypes = {"Fighters", "Multirole Fighters", "Interceptors"}, priority = 1, }, } _f0c:pushTask(AAsd) -- trigger.action.outText('X: ' ..sdposV2.x .. ' Z:' ..sdposV2.y, 60, true) -- Confirm Vec2 positions Edited December 17, 2023 by Exorcet Awaiting: DCS F-15C Win 10 i5-9600KF 4.6 GHz 64 GB RAM RTX2080Ti 11GB -- Win 7 64 i5-6600K 3.6 GHz 32 GB RAM GTX970 4GB -- A-10C, F-5E, Su-27, F-15C, F-14B, F-16C missions in User Files Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now