OpenXcom Forum

OpenXcom Forks => OXCE Support => OpenXcom Extended (OXCE) => OXCE Support Y-scripts => Topic started by: Ethereal on October 27, 2024, 12:32:51 pm

Title: [Solved] Fatal wounds and days of treatment.
Post by: Ethereal 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.
Title: Re: [Suggestion] Fatal wounds and days of treatment.
Post by: Meridian on October 27, 2024, 01:12:17 pm
This is already  doable via scripts.
Title: Re: [Suggestion] Fatal wounds and days of treatment.
Post by: Yankes 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.
Title: Re: [Suggestion] Fatal wounds and days of treatment.
Post by: Ethereal on October 27, 2024, 04:50:01 pm
Thanks for the answers, but I’m still not a good scripter. But I'll try.
Title: Re: [Suggestion] Fatal wounds and days of treatment.
Post by: Yankes 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.
Title: Re: [Solved] Fatal wounds and days of treatment.
Post by: Meridian 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;
Title: Re: [Solved] Fatal wounds and days of treatment.
Post by: Ethereal on February 15, 2025, 08:38:01 am
Here's a script that adds 10 days extra recovery for each fatal wound:

Thank you. It works.