Author Topic: [Solved] Fatal wounds and days of treatment.  (Read 481 times)

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
[Solved] Fatal wounds and days of treatment.
« on: October 27, 2024, 12:32:51 pm »
I recently encountered something strange - a soldier had full health at the end of a battle, but 10 fatal wounds. He received 0 days of treatment. I don't think this is right. Each fatal wound should increase the duration of treatment by 10 days or so.

In general, it would be good to have a global option that would regulate the number of days of treatment for each fatal wound remaining after the battle.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9092
    • View Profile
Re: [Suggestion] Fatal wounds and days of treatment.
« Reply #1 on: October 27, 2024, 01:12:17 pm »
This is already  doable via scripts.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion] Fatal wounds and days of treatment.
« Reply #2 on: October 27, 2024, 01:52:44 pm »
Days of recovery are modifiable by `returnFromMissionUnit` by `recovery_time` parameter, you can set any logic you want there.

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: [Suggestion] Fatal wounds and days of treatment.
« Reply #3 on: October 27, 2024, 04:50:01 pm »
Thanks for the answers, but I’m still not a good scripter. But I'll try.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion] Fatal wounds and days of treatment.
« Reply #4 on: October 27, 2024, 08:20:50 pm »
One thing you look for is `getFatalwoundsTotal` function that get all fatal wounds from every body part.
Usage look like `unit.getFatalwoundsTotal total;` where `total` is local variable you define and after this line it will have total of wounds.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9092
    • View Profile
Re: [Solved] Fatal wounds and days of treatment.
« Reply #5 on: November 03, 2024, 11:18:20 am »
Here's a script that adds 10 days extra recovery for each fatal wound:

Code: [Select]
extended:
  scripts:
    returnFromMissionUnit:
    - new: YSCRIPT_EXTRA_RECOVERY_AFTER_MISSION
      offset: 10
      code: |
        var int total;
        unit.getFatalwoundsTotal total;
        mul total 10;
        add recovery_time total;
        return;