Author Topic: [submod] X-Com Files: Random Enemy Stats (1.0.1)  (Read 1084 times)

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 128
  • Sorry for my bEd English
    • View Profile
[submod] X-Com Files: Random Enemy Stats (1.0.1)
« on: August 27, 2024, 11:44:07 am »
A small submod that changes the stats of enemies and neutral units between 80-120% of their base value at the start of a ground battle. So now you can meet a sectoid who can fight well, or a muton who doesn't have enough strength to use a blaster launcher. Or even a ethereal who is bad at psi.

Requires:
  - OpenXcom Extended any version
    OR Brutal-OXCE any version.
  - The X-Com Files mod any version.

Compatibility:
  - Compatible with any other submod.

Notes:
  - You can activate this submod at any stage of your game.
  - All of the above images are taken in developer mode to show the differences in the modified stats of the different sectoid soldiers.
  - If you want to customize the enemy's stat range to your taste, open the ..\OpenXCom\user\mods\XComFiles_RandomEnemyStats\XCF_RandomEnemyStats.rul file with any text editor (Windows Notepad or Notepad++), find the set minPercent 80; and set maxPercent 120; strings and change the numbers 80 and 120 to your desired values (specify adequate values, otherwise the script will not work without notifying the player).

Languages:
  - The submod does not contain strings visible to the player.

Download link:
  - https://mod.io/g/openxcom/m/x-com-files-random-enemy-stats

Changelog:
Spoiler:
    1.0.0 (27.08.2024):
Spoiler:
    - Initial release.
    1.0.1 (27.08.2024):
Spoiler:
    - Fixed randomization of current TU, health, energy, and sanity.
« Last Edit: October 10, 2024, 10:45:28 am by Kozinsky »

Offline Juku121

  • Commander
  • *****
  • Posts: 1798
  • We're all mad here.
    • View Profile
Re: [submod] X-Com Files: Random Enemy Stats (1.0.0)
« Reply #1 on: August 27, 2024, 03:15:58 pm »
Hmm, interesting.

I recall there was a mod for doing this to X-Com soldiers, too, but I don't think anyone ever made an XCF version of it.

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 128
  • Sorry for my bEd English
    • View Profile
Re: [submod] X-Com Files: Random Enemy Stats (1.0.0)
« Reply #2 on: August 27, 2024, 05:43:10 pm »
I recall there was a mod for doing this to X-Com soldiers, too, but I don't think anyone ever made an XCF version of it.

Soldiers? But soldiers are already “born” with random stats and they don't need to randomize them again.
I was told that there is a similar submod for X-Pirates, but I didn't know about it until today.
In any case: this submod I made completely by myself.

Offline psavola

  • Commander
  • *****
  • Posts: 827
    • View Profile
Re: [submod] X-Com Files: Random Enemy Stats (1.0.0)
« Reply #3 on: August 27, 2024, 05:53:52 pm »
Maybe Juku121 was referring to randomizing soldier stat caps.. which has apparently already been do by you :o (https://openxcom.org/forum/index.php?topic=7416.msg134748#msg134748)

Offline zRrr

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: [submod] X-Com Files: Random Enemy Stats (1.0.0)
« Reply #4 on: August 27, 2024, 06:33:23 pm »
You may want to add call to unit.setHealth unitStat;. BattleUnit.Stats.* sets maximum stat value, current health value needs to be set separately to avoid stat penalties for missing health. Also setTimeUnits, setEnergy and setMana.

Code: [Select]
          #health:
          unit.Stats.getHealth unitStat;
          if gt unitStat 0;
            set minValue unitStat;
            set maxValue unitStat;
            muldiv minValue minPercent 100;
            muldiv maxValue maxPercent 100;
            battle_game.randomRange unitStat minValue maxValue;
            unit.Stats.setHealth unitStat;
            unit.setHealth unitStat; ### <--- here
            #debug_log "Unit" unitID "Health (" minValue "-" maxValue "):" unitStat;
          end;

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 128
  • Sorry for my bEd English
    • View Profile
Re: [submod] X-Com Files: Random Enemy Stats (1.0.0)
« Reply #5 on: August 27, 2024, 07:53:03 pm »
You may want to add call to unit.setHealth unitStat;. BattleUnit.Stats.* sets maximum stat value, current health value needs to be set separately to avoid stat penalties for missing health. Also setTimeUnits, setEnergy and setMana.

Ok, thanks, fixed.



New version!

Changelog:
    1.0.1 (27.08.2024):
      - Fixed randomization of current TU, health, energy, and sanity.

Offline Juku121

  • Commander
  • *****
  • Posts: 1798
  • We're all mad here.
    • View Profile
Re: [submod] X-Com Files: Random Enemy Stats (1.0.1)
« Reply #6 on: August 27, 2024, 09:23:38 pm »
Yeah, I somehow forgot that Kozinsky had already done the makeover for that mod. :-[