Damage question

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
Gunner98
Posts: 5539
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

Damage question

Post 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
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
User avatar
michaelm75au
Posts: 11895
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Damage question

Post by michaelm75au »

ScenEdit_SetUnitDamage({side='NATO', guid='aa9559a7-0c1e-4afd-8da4-067839800a5c', dp=0})
Michael
User avatar
Gunner98
Posts: 5539
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: Damage question

Post 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
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
KnightHawk75
Posts: 1579
Joined: Thu Nov 15, 2018 7:24 pm

RE: Damage question

Post 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.)
User avatar
Gunner98
Posts: 5539
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: Damage question

Post by Gunner98 »

Thanks

I'll be able to take a good look this weekend. Appreciate the help

B
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
Parel803
Posts: 607
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Damage question

Post 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
User avatar
Gunner98
Posts: 5539
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: Damage question

Post 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.
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
Parel803
Posts: 607
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Damage question

Post 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
KnightHawk75
Posts: 1579
Joined: Thu Nov 15, 2018 7:24 pm

RE: Damage question

Post 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'.

Parel803
Posts: 607
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Damage question

Post by Parel803 »

Thank you
wirthlin
Posts: 12
Joined: Sat Dec 26, 2020 11:22 pm

RE: Damage question

Post 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.
Post Reply

Return to “Lua Legion”