How to cancel damage/destroy on an acft - Invincible mode

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
Cheche
Posts: 11
Joined: Sun Feb 05, 2023 6:23 pm

How to cancel damage/destroy on an acft - Invincible mode

Post by Cheche »

Hello everyone,

I need your help for a simulation scenario please.

Basicaly, i have an aircraft flying. A SAM shooting at it. SAM hit and Destroy the aircraft.
But ... i want this aircraft to remain "alive" and to continue flying. So either cancel all damages &/or destruction. The goal is to have something like "invicible mode".

I've tried to set up an event with Damage trigger (UnitDamaged) and Lua Script action (with SE_SetUnitDamage & UnitX) but it does not work...

Any idea how to do that ?

Thanks by advance.

YH
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

Re: How to cancel damage/destroy on an acft - Invincible mode

Post by KnightHawk75 »

Cheche wrote: Sun Feb 26, 2023 7:49 pm Hello everyone,

I need your help for a simulation scenario please.

Basicaly, i have an aircraft flying. A SAM shooting at it. SAM hit and Destroy the aircraft.
But ... i want this aircraft to remain "alive" and to continue flying. So either cancel all damages &/or destruction. The goal is to have something like "invicible mode".

I've tried to set up an event with Damage trigger (UnitDamaged) and Lua Script action (with SE_SetUnitDamage & UnitX) but it does not work...

Any idea how to do that ?

Thanks by advance.

YH
You kinda can't generally.
With ships and some facilities most of the time you can usually catch it in time while sinking or when less then 100% upon the initial damage event, assuming the hitting munition isn't wildly overpowered in relation to the unit's damage points and armor. Then use lua like you wanted to reverse both the % damage, and restore all the destroyed components...(I assume you're attempting that as well, or at least doing it for engines) and not just the % value. You can get that list you need to restore via unit.components. Thing is often but not always with aircraft (at least in the past) it rarely works because the initial damage is already 100%, meaning the unit is technically already destroyed, even if the destroyed event hasn't happened yet because it quickly follows the dmg event in the same cycle. Now for things that use % components for DP% it's more variable. You could maybe try giving it a bunch of dummy mounts and other components, so that there is at least more stuff to soak up the initial random damage such that the first damage even is something less then 100%, but it may not work well if their is a direct head with high powered warhead,etc.

Probably not very helpful but there it is.
Cheche
Posts: 11
Joined: Sun Feb 05, 2023 6:23 pm

Re: How to cancel damage/destroy on an acft - Invincible mode

Post by Cheche »

Thanks for your answer.
Indeed it's what i thought what happened. So the only way is to modify either the damage point of the ammo or of the target in order to let it survive and then repair it with event(trigger and action).
Does DP is modifiable on C.PE ?
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

Re: How to cancel damage/destroy on an acft - Invincible mode

Post by KnightHawk75 »

Cheche wrote: Mon Feb 27, 2023 5:56 am Thanks for your answer.
Indeed it's what i thought what happened. So the only way is to modify either the damage point of the ammo or of the target in order to let it survive and then repair it with event(trigger and action).
Does DP is modifiable on C.PE ?
In CPE (depending on license) you can edit the database for facility\ship\etc damage, but aircraft I believe are still dp=1.0 component % based (idk for sure I don't have a current license to CPE, but I assume it's the same model so to spreak). HOWEVER since in CPE you can export to XML ...do that, and then you can probably try changing the DP entry for the specific unit's entry which is save there as I recall (from when we used to be able to look at saves) of 1 or 1.0 to like 15000 and then I think it will switch to damage point reduction mode and you'd catch it in-time nearly every time (short of maybe nuke right on top of it).
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

Re: How to cancel damage/destroy on an acft - Invincible mode

Post by michaelm75au »

In CPE, there are other ways to do this. I would suggest following up thru the CPE support channel.
Michael
Cheche
Posts: 11
Joined: Sun Feb 05, 2023 6:23 pm

Re: How to cancel damage/destroy on an acft - Invincible mode

Post by Cheche »

Thanks lot for all your answer. Will see how it gonna work on CPE.
Post Reply

Return to “Lua Legion”