Page 1 of 1
Damage question
Posted: Sat Feb 13, 2021 10:28 pm
by Gunner98
Hay guys I'm fiddling with unit damage:
ScenEdit_SetUnitDamage({side='NATO', guid='aa9559a7-0c1e-4afd-8da4-067839800a5c', dp=1000})
The unit in question is a Runway and this puts it at 83% damage which is fine.
The problem is fixing the runway, I've tried several methods but none seem to work:
ScenEdit_SetUnitDamage({side='NATO', guid='aa9559a7-0c1e-4afd-8da4-067839800a5c', 'none'})
ScenEdit_SetUnitDamage({side='NATO', guid='aa9559a7-0c1e-4afd-8da4-067839800a5c', 'dp=1'})
ScenEdit_SetUnitDamage({side='NATO', guid='aa9559a7-0c1e-4afd-8da4-067839800a5c', {'runway', 'none'})
Etc
I somehow want to set the 'Overall Damage' to '0' - Just not quite sure how to do it.
Any advice?
B
RE: Damage question
Posted: Sun Feb 14, 2021 4:44 am
by michaelm75au
ScenEdit_SetUnitDamage({side='NATO', guid='aa9559a7-0c1e-4afd-8da4-067839800a5c', dp=0})
RE: Damage question
Posted: Sun Feb 14, 2021 12:40 pm
by Gunner98
Yeah I tried that with no luck. Just did it again, same result.
It seems that the initial command that inflicts damage affects the overall unit but applies the damage onto the 'runway' component. The command to repair or bring it back to '0' DP doesn't get applied to the component. That is just a guess
Tx
RE: Damage question
Posted: Sun Feb 14, 2021 4:04 pm
by KnightHawk75
fb.asp?m=4820766 (post #4 I have a sample there does it work for you as sample for this?, it shows running though all components.)
RE: Damage question
Posted: Wed Feb 17, 2021 7:59 am
by Gunner98
Thanks
I'll be able to take a good look this weekend. Appreciate the help
B
RE: Damage question
Posted: Tue Mar 02, 2021 5:26 pm
by Parel803
Not sure if it's still wordt something but seems to work for me on a ship with: dp=-50
Little different print answer, has extra dp_percent_now='xx,x'
{ fires = 'NoFire', dp_percent = '7,5', flood = 'NoFlooding', startdp = '530', dp = 490 }
{ fires = 'NoFire', dp_percent = '18,9', dp = 520, flood = 'NoFlooding', startdp = '530', dp_percent_now = '1,9' } . Before and after executing I guess
with regards Gert-Jan
RE: Damage question
Posted: Tue Mar 02, 2021 9:40 pm
by Gunner98
Wasn't able to get this working but have a fix. Will delete the runway and re-spawn it when needed.
I would like to figure this out for another scenario though, so the AI can get runways repaired faster.
RE: Damage question
Posted: Tue Jan 18, 2022 12:18 pm
by Parel803
Good afternoon,
An extra question on damage. Does anyone know what is the 'type' name to damage engineering/propulsion?
Could you state the dp in % instead of a nr. Probable not but just to make sure.
best regards GJ
RE: Damage question
Posted: Tue Jan 18, 2022 7:12 pm
by KnightHawk75
An extra question on damage. Does anyone know what is the 'type' name to damage engineering/propulsion?
look in unit's components table for comp_type, usually it's 'Engine'.
RE: Damage question
Posted: Wed Jan 19, 2022 9:41 am
by Parel803
Thank you
RE: Damage question
Posted: Wed Jan 19, 2022 12:13 pm
by wirthlin
Thank you for the sample code Knighthawk! For some reason, I had always thought ScenEdit_SetUnitDamage() only applied to components of units and not the units themselves. And specifying a negative dp for repairs never crossed my mind. Tried it on a simple scenario and it works great!
That really opens up some interesting possibilities.