Author Topic: [DONE][SUGGESTION] Woundable Reapers  (Read 2017 times)

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
[DONE][SUGGESTION] Woundable Reapers
« on: August 19, 2019, 06:19:48 pm »
For those of us who use the option for alien bleeding, it would be nice if Reapers could be wounded. Of course, with their amount of health it would mostly be for flavor, but personally I care for flavor more than for practical consequences :)

Just to clarify: I'm completely fine with Sectopods and Cyberdiscs being immune to wounds, seeing as they are cybernetic units, but the Reaper, being organic, should bleed even though it is a 4-tile "tank".

I hope it's not too much work. I would implement it as a mod, with one script writing the amount of "wounds" to a tag, and another subtracting the correspondent amount of health at the beginning of a new turn, but such "wounds" would not be displayed in the Mind Probe screen.
« Last Edit: February 01, 2023, 11:09:33 am by Meridian »

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [SUGGESTION] Woundable Reapers
« Reply #1 on: August 19, 2019, 08:12:50 pm »
There is no need for scripts, this is already supported: `bleedImmune`.
Overall if one unit can do something and other can't then this is good candidate for config.

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: [SUGGESTION] Woundable Reapers
« Reply #2 on: August 19, 2019, 09:38:07 pm »
Oh, right. I just thought that since I enabled this option in the overall game settings and the Reapers are not affected, then they need some strong magic :) Obviously, I was wrong. Probably, the overall game setting doesn't affect 4-tile units. But enabling `bleedImmune` for REAPER_ARMOR did the trick. Thanks!

I also wanted to make them while woundable, but less susceptible to wounds than other units (since they are big and tough and have two hearts). However, I can't make work this code when placed inside their unit description. When it is placed in the global section, it works (but then it works for all units of course, not just Reapers). This is the code inside the unit description, it does not work:

Code: [Select]
units:
  - type: STR_REAPER_TERRORIST
    scripts:
      damageUnit: |
        debug_log 1 to_health;
        debug_log 2 to_wound;
        div to_wound 2;
        debug_log 3 to_wound;
        return;

This is what I place in the global scripts section, it works:
Code: [Select]
    damageUnit:
      - offset: 10
        code: |
          var int temp;
         
          # disregard damage negated by armor
          if eq to_health 0;
            return;
          end;
         
          # get frame for flashing red
          battle_game.getAnimFrame temp;
          unit.setTag Tag.LAST_HIT_FRAME temp;
         
          # wound reduction
          debug_log 1 to_health;
          debug_log 2 to_wound;
          div to_wound 2;
          debug_log 3 to_wound;

          return;

The code inside the unit description lacks the offset, but that's how it was in the examples given here: https://openxcom.org/forum/index.php?topic=5245.0. Is it wrong?

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [SUGGESTION] Woundable Reapers
« Reply #3 on: August 20, 2019, 12:06:22 am »
Your error is place where scripts are defined. `damageUnit` mean damaging unit but its defined in armor. As it common part between soldiers and units.
I probably will need add list of places where "main" script is defined.

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: [SUGGESTION] Woundable Reapers
« Reply #4 on: August 20, 2019, 05:18:57 pm »
Thanks, after putting it in REAPER_ARMOR it works :)