RepoMan Posted July 11, 2018 Posted July 11, 2018 I have been trying to think a way around this. Is there anyway to make an enemy unit not immortal to select groups (for example the player)? I'm trying to create a prolonged fire fight with the enemy group only taking damage from the pilot or AI wing man. I did a search but didn't come up with anything. Seems like it would be possible? You can assign Immortal off with a flag and unit hit condition. But if anything hits it that would negate the function. Plus, if you have a lot of units it would take ages. Thank you, - Coffee Lake i7k @ 5.1GHz (delidded, custom loop) - EVGA 1060 6GB (video card crisis purchase) - 32GB DDR4 @ 3333 15 CAS
feefifofum Posted July 11, 2018 Posted July 11, 2018 You'd have to go into .lua land and create an event handler that detects when the player specifically hits the unit. On event hit with the player aircraft's unit name as the initiator. I'm not sure when exactly damage is distributed so you might need to use the shot or begin_shooting event rather than hit if that doesn't catch it quickly enough. THE GEORGIAN WAR - OFFICIAL F-15C DLC
Sedlo Posted July 12, 2018 Posted July 12, 2018 I had a similar scenario when I made Eastern Friendship Mission#2... I wanted a prolonged Red/Blue engagement going on, and the player to provide immediate CAS with guns. I didn't want the friendly ground units to destroy the enemy before the player gets to do the run in. I got a lot of help on the forum and this is what I ended up with. I set the Red group to immortal, with a switched condition that their immortal switches off when flag 7777 goes off. When the initial firefight was initiated, I ran this script: Handler = {} function Handler:onEvent(event) if event.id == world.event.S_EVENT_SHOOTING_START and event.initiator == Unit.getByName('COLT 51 PLAYER') then trigger.action.setUserFlag('7777', true) end end world.addEventHandler(Handler) So this script will activate flag 7777 when the unit name 'COLT 51 PLAYER' fires the gun. You can run another script with the unit name of the wingman to set flag 7778 to do the same, if you want. Change the unit name values and flag values to suit your situation, but this might be an answer to your problem. This only works for guns (and rockets, I think)... Not sure how exactly to make this work with bombs or missiles. My Youtube Channel MY DCS MISSIONS
RepoMan Posted July 12, 2018 Author Posted July 12, 2018 Thank you both very much for your reply. Sedlo, thank you for the script. The 9-Line CAS was going to be pilots discretion on weapons. But that's a great script! This only works for guns (and rockets, I think)... Not sure how exactly to make this work with bombs or missiles. - Coffee Lake i7k @ 5.1GHz (delidded, custom loop) - EVGA 1060 6GB (video card crisis purchase) - 32GB DDR4 @ 3333 15 CAS
RepoMan Posted July 12, 2018 Author Posted July 12, 2018 (edited) If this could possibly help anyone else...this is what I did. Kind of an easy work around. 1. I made a trigger...assigned a x flag=on, like a penalty key flag, with a message calling out troops at y location and "do not engage until cleared hot" (generalized example). 2a. On event destroy-Created a trigger if groups are destroyed while x flag=on: resulted in another assigned flag action to equal a mission score of zero. I also created end mission with Red winning message. 2b. edit- nevermind. I just remembered I can't use unit hits *face palm. Well the above remains true. 3. I then created a 9-line message with "cleared hot" taking x flag=off action, making it "ok" to take out the units. Edited July 13, 2018 by RepoMan - Coffee Lake i7k @ 5.1GHz (delidded, custom loop) - EVGA 1060 6GB (video card crisis purchase) - 32GB DDR4 @ 3333 15 CAS
Sedlo Posted July 13, 2018 Posted July 13, 2018 Nice! Good call about the penalty... I'm going to incorporate something like that in the future so you get penalized for firing without specific clearance. My Youtube Channel MY DCS MISSIONS
RepoMan Posted July 13, 2018 Author Posted July 13, 2018 (edited) Nice! Good call about the penalty... I'm going to incorporate something like that in the future so you get penalized for firing without specific clearance. Thank you! :-) It's funny because I came back to reference your script because I found your original post on S_EVENT_SHOOTING_START. Maybe we can get this streamlined in a future update. Secondly, after quite a bit a research" Cleared Hot" is taken pretty seriously in the controller community. I noticed the majority of cases, especially in populated areas, controllers make you verify you have the target by physical descirption (talk on target), that you know exactly where friendlies are (like, you see them in your tgp, etc) before they clear you. I'm trying to replicate that in a smooth manner. Edited July 13, 2018 by RepoMan - Coffee Lake i7k @ 5.1GHz (delidded, custom loop) - EVGA 1060 6GB (video card crisis purchase) - 32GB DDR4 @ 3333 15 CAS
RepoMan Posted July 13, 2018 Author Posted July 13, 2018 S_EVENT_HIT is what I would like, with simply the initiator being player or wingman with any weapon during my penalty flag=on. I'm new to lua...so If I figure it out, I'll report back. - Coffee Lake i7k @ 5.1GHz (delidded, custom loop) - EVGA 1060 6GB (video card crisis purchase) - 32GB DDR4 @ 3333 15 CAS
Majinbot Posted July 13, 2018 Posted July 13, 2018 I had a similar scenario when I made Eastern Friendship Mission#2... I wanted a prolonged Red/Blue engagement going on, and the player to provide immediate CAS with guns. I didn't want the friendly ground units to destroy the enemy before the player gets to do the run in. I got a lot of help on the forum and this is what I ended up with. I set the Red group to immortal, with a switched condition that their immortal switches off when flag 7777 goes off. When the initial firefight was initiated, I ran this script: Handler = {} function Handler:onEvent(event) if event.id == world.event.S_EVENT_SHOOTING_START and event.initiator == Unit.getByName('COLT 51 PLAYER') then trigger.action.setUserFlag('7777', true) end end world.addEventHandler(Handler) So this script will activate flag 7777 when the unit name 'COLT 51 PLAYER' fires the gun. You can run another script with the unit name of the wingman to set flag 7778 to do the same, if you want. Change the unit name values and flag values to suit your situation, but this might be an answer to your problem. This only works for guns (and rockets, I think)... Not sure how exactly to make this work with bombs or missiles. I think it's the script I posted long ago. S_EVENT_SHOOTING_START is for firing a weapon that has a high rate of fire like aircraft cannons. S_EVENT_SHOT is for bombs and missiles. PC: i7-13700K - Gigabyte RTX 5080 GAMING OC - 64GB DDR5 6400 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + LG OLED 32GS95UE - TrackIR5 - Quest 3
Recommended Posts