Author Topic: [DONE][Suggestion] Random soldier bonuses on purchase/recruit  (Read 349 times)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11811
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
[DONE][Suggestion] Random soldier bonuses on purchase/recruit
« on: January 25, 2025, 11:52:21 am »
Continued from: https://openxcom.org/forum/index.php?topic=11828.0

I would like to request adding random soldier recruitment bonuses on normal hire, when the soldier is bought from the purchases menu.

To mirror the data structure from manufacturing:

Code: [Select]
soldiers:
  - type: STR_SOLDIER
    costBuy: 40000
    costSalary: 20000
    spawnedSoldier:
      transformationBonusesCount: 3   # default is 1
      randomTransformationBonuses:    # this is a weighted list of soldier bonuses, each item can be chosen only once
        STR_STARTING_BONUS_X1: 500         # 50%
        STR_STARTING_BONUS_X2: 200         # 20%
        STR_STARTING_BONUS_X3: 100         # 10%
        STR_STARTING_BONUS_X4: 100         # 10%
        STR_STARTING_BONUS_X5: 100         # 10%
    armor: STR_NONE_UC
    standHeight: 22
    kneelHeight: 14
...

This will allow a modder to introduce some thematic diversity among the soldiers, if they wish to do so.
« Last Edit: January 25, 2025, 05:19:45 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9303
    • View Profile

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11811
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
« Reply #2 on: January 29, 2025, 07:14:23 pm »
Fantastic, and so fast! :)
Thanks!


EDIT: Did some initial testing. The feature seems to work splendidly so far.

A note: the random bonuses don't apply to the initial soldiers set. I don't know if it's intended or not, I don't mind either way, just wanted to confirm it's supposed to be like this.
And one extra minor request: would it be feasible to hide the relevant Ufopaedia article until you actually get a soldier with the particular bonus? Similar to how commendations can be hidden until you get them. It's not critical, but I think it could improve the fun factor.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9303
    • View Profile
Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
« Reply #3 on: January 29, 2025, 08:11:26 pm »
A note: the random bonuses don't apply to the initial soldiers set. I don't know if it's intended or not, I don't mind either way, just wanted to confirm it's supposed to be like this.

It applies to soldiers who are purchased/recruited via the Purchase/Recruit GUI.

For initial soldiers (which are not purchased/recruited), you can define it in the startingBase ruleset.

And one extra minor request: would it be feasible to hide the relevant Ufopaedia article until you actually get a soldier with the particular bonus? Similar to how commendations can be hidden until you get them. It's not critical, but I think it could improve the fun factor.

It's a lot of ugly code, but can probably be done.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11811
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
« Reply #4 on: January 29, 2025, 08:45:31 pm »
It applies to soldiers who are purchased/recruited via the Purchase/Recruit GUI.

For initial soldiers (which are not purchased/recruited), you can define it in the startingBase ruleset.

Yes, that works for me.
...as long as you tell me the syntax, since my attempts failed. :)

It's a lot of ugly code, but can probably be done.

I see. Well, like I said, it's not that critical for my mod, but I can imagine doing fun stuff with this. So please at least consider it.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9303
    • View Profile
Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
« Reply #5 on: January 29, 2025, 09:17:00 pm »
Yes, that works for me.
...as long as you tell me the syntax, since my attempts failed. :)

Might be missing then.
I'll check over the weekend.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11811
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
« Reply #6 on: January 29, 2025, 10:22:56 pm »
I decided I don't want this on the initial crew in my mod anyway, since they get the Original Member commendation, which is an equivalent.

I can't say if other modders would need it.