aliens

Author Topic: [OXCE] Randomized Stat Caps for Soldiers  (Read 11910 times)

Offline Firaa

  • Sergeant
  • **
  • Posts: 11
    • View Profile
[OXCE] Randomized Stat Caps for Soldiers
« on: September 18, 2019, 10:31:05 pm »
Changelog
v1.1 (06-20-2020)
- Primary experience gain using intelligence should now work on recent versions of OXCE.
- New MinMind and MaxMind tags must now be defined in the soldier ruleset. These tags set the range for primary experience gain on a soldier-to-soldier basis, as opposed to the previous method of 70% to 130%.

What is this?
I've played an embarrassing amount of X-Com: UFO Defense in my life, and probably so have most of you. But, in my opinion, a lot of mods have started to run into a problem with the vanilla mechanics that didn't really become an issue itself in the original game - late-game stat caps. I have a lot of fun outfitting soldiers in the early/mid-game of basically every mod I've played. I enjoy micromanaging soldiers to have effective and unique loadouts, and the sheer girth of equipment lists in many mods really feed into that enjoyment. Then, when the end-game rolls around, I end up having a few common loadouts that get pasted onto my ever-growing group of well-trained veterans, as everyone's stats begin to become... samey. I've played a lot with this script active, and it has made veterans so much more exciting for me, since I was dealing with soldiers who had variable stats once again. Some soldiers will make better snipers, heavy weapon specialists, or grenadiers than others, and you will encounter the rare soldier who is truly elite. Anyway, I hope someone else gets some enjoyment out of this.

How it Works
Tags are assigned to the soldier ruleset. These tags are a random 'penalty', which stats cannot grow beyond. By raising the stat caps by 10 and applying a random penalty between 0 to 20, you effectively create a random stat that is either up to 10 lower or 10 higher than the original stat cap. When a battle begins, this script calculates the stat caps for any soldiers present who have not yet been assigned stat caps. When the battle ends, after experience is awarded, the script 'trims the fat'. This script is easily applied to any mod, and is safe to add to any in-progress game.

A secondary function is that this script also generates an "intelligence" tag for each soldier. This is a multiplier applied to all experience earned, meaning some soldiers will just grow faster than others, and some soldiers will grow slower than normally. This intelligence modifier is assigned to a soldier at the same time they are initialized with their stat caps, and is completely invisible. The only way to know a soldier's intelligence modifier is via their actual growth rate. If you don't like this, you can easily disable it by opening script.rul and deleting the line near the end of the document that includes the text "awardExperience" and everything after it.

This script trims excess stats at the end of combat, so if you play with training facilities, make sure your training caps aren't higher than the minimum stat caps. This script also does not affect Psi-strength or Psi-skill. It also doesn't affect Bravery, since some people will just have better vision than others, but everybody has the capacity to be completely and utterly mentally broken desensitized to high-impact alien violence. Also, I assume that anyone who trains their entire force's bravery to capacity is an ABSOLUTE PSYCHOPATH. :P

Known Issues
- After a battle, the experience screen may show secondary stats (TUs, Stamina, Strength) as a negative change. This is only a display error, and these stats are at their current cap. You can safely ignore this if it occurs.

Attached Downloads
Standard - The vanilla soldier version. Soldiers are given a random stat cap that is 10 above or below the old stat cap. You will most likely not notice this mod in a normal vanilla playthrough (although it is fully functional for it), what with the limited gear options and comparatively short campaign, but this download will work with any mod that uses the default soldier, like XenoOps, or FMP.
40k - This version is already configured for the 40k mod. Guardsmen have more tame stat ranges, while units like Ogryn, Sisters of Battle, and Space Marines can generate certain stat caps at much greater ranges. Tags aren't modified when a soldier is transformed, so units will retain their strengths and weaknesses when they become officers/dreadnoughts while still gaining the benefits of the increased stat caps. This means that some soldiers are clearly superior candidates for advancement!
« Last Edit: June 16, 2020, 07:57:21 am by Firaa »

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #1 on: May 09, 2020, 06:41:51 pm »
Hi I edited around and got this working for the xpiratez mod. However for some reason soldiers are not gaining any primary stats, is there anything you think I might have missed?

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #2 on: May 09, 2020, 07:00:34 pm »
Hi I edited around and got this working for the xpiratez mod. However for some reason soldiers are not gaining any primary stats, is there anything you think I might have missed?

Upload file please?

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #3 on: May 10, 2020, 06:51:31 am »
Seems to load with it. deleted the end bit because it wasnt giving out firing accuracy experience.

Also tested slightly with the 40k version in the 40k mod, doesnt seem to be giving out xp there either.
« Last Edit: May 10, 2020, 07:06:53 am by peirceg »

Offline Firaa

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #4 on: June 16, 2020, 06:58:13 am »
Sorry for taking so long to reply. Replace the awardExperience section of this script with the following:

Code: [Select]
    awardExperience:
      - offset: 1 ## Apply the soldier's learning speed
        code: |
          var int expMulti;
          var int temp;
          var ptr GeoscapeSoldier currentSoldier;
          attacker.getGeoscapeSoldier currentSoldier;
          currentSoldier.getTag expMulti Tag.SOLDIER_MIND;
          if eq expMulti 0; ## If the unit doesn't have a soldier mind, then don't modify experience gain
            set expMulti 100;
          end;
          muldiv experience_multipler expMulti 100;
          return experience_multipler;

This should fix every version of the script, whether it's the ones in the original post, or your modification for xpiratez. Note: "experience_multipler" is not a typo, but is the returning variable for awardExperience. The new versions of this script include this change.
« Last Edit: June 16, 2020, 07:58:54 am by Firaa »

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #5 on: December 09, 2020, 05:26:49 pm »
Hello, I am getting a quite a few +- messages on mission completes on exp gained, is this normal?

Offline Firaa

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #6 on: December 13, 2020, 11:19:32 pm »
Hello, I am getting a quite a few +- messages on mission completes on exp gained, is this normal?
It is only a cosmetic error. This means those stats have reached the cap for the soldier, and gains during the mission are being removed to keep them at their randomized stat caps. It makes the stat gain screen after combat seem a little messy, but it's otherwise harmless. It should only appear on secondary stat gains, such as TUs, stamina, or strength.

(If you are seeing this, it also means that the script is working, and is capping stats as expected.)
« Last Edit: December 13, 2020, 11:21:08 pm by Firaa »

Offline Kozinsky

  • Colonel
  • ****
  • Posts: 128
  • Sorry for my bEd English
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #7 on: July 12, 2023, 11:57:45 am »
I have updated this submod for use with the X-Com Files mod (requires XCF version 3.0.0 or higher).
The submod system affects all types of player soldiers, taking into account their features, as well as transformations that change the type of soldier. This submod also affects "psi strength" and "mana" parameters.
I also added my own rerolling system (which the author promised to do, but never finished) - with a very small chance, depending on the soldier's "mind", his stat limits will be increased.

Offline Agoelia

  • Squaddie
  • *
  • Posts: 2
    • View Profile
Re: [OXCE] Randomized Stat Caps for Soldiers
« Reply #8 on: August 13, 2024, 06:53:34 pm »
Hey, does anyone have a version of this submod that is compatible and tuned for Xpiratez?