Jump to content

How to accurately get Scenery Objects initial Health in LUA?


Draken35

Recommended Posts

Scenery Objects does not have a getLife0 method, so, on mission start, I use their getLife method and store the result as the initial health. This value matches with the value of the attribute in getDesc. Now, the issue is that this value is not accurate! The initial reported health goes up after the first weapon hit in that target!  See screenshot and attached mission and script please

So, How to accurately get Scenery Objects initial Health in LUA? Or what am I doing wrong?

image.png

 

sceobj.lua test-sceobj-life-CA.miz

Link to comment
Share on other sites

5 hours ago, Draken35 said:

...So, How to accurately get Scenery Objects initial Health in LUA? Or what am I doing wrong?...

I am not sure, something is a bit weird.

I've checked that for Static units, the Life at impact (hit event) is the same as initial Life (ex: Workshop A, 1600 pts at hit event, which is correct initial life DCS-miscScripts/Workshop A.lua at master · mrSkortch/DCS-miscScripts · GitHub ). Units behave differently (damaged at hit). Scenery Objects seem to have the same way to take damage than Statics.

To get the life points after hit damage (for Statics and scenery) you have to delay getLife() from Hit event (1s in my test). I run your test mission with several Mk82 attacks until Scenery object is destroyed and all seem OK.

The weird thing is that the scenery object life points vary from mission start to hit event. And sometimes it doesn't.

GetLife-scenery.jpg

test-sceobj-life-CA-mod.miz

Link to comment
Share on other sites

1 hour ago, toutenglisse said:

 

The weird thing is that the scenery object life points vary from mission start to hit event. And sometimes it doesn't.

 

 

That's the thing... After the first hit, The scenery objects seem to behave but in none of my tests, the behavior of the initial health (before any impact) has been correct...

Thanks for taking the time to test it!

Link to comment
Share on other sites

  • 9 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...