OpenXcom Forum

OpenXcom Forks => OpenXcom Extended (OXCE) => OXCE Suggestions DONE => Topic started by: Solarius Scorch on January 25, 2025, 11:52:21 am

Title: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
Post by: Solarius Scorch 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.
Title: Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
Post by: Meridian on January 26, 2025, 12:28:24 pm
Done.

https://github.com/MeridianOXC/OpenXcom/commit/596ece11d1fba15f788a5cb23206edaffbf26ee3

Syntax: see post above
Title: Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
Post by: Solarius Scorch 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.
Title: Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
Post by: Meridian 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.
Title: Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
Post by: Solarius Scorch 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.
Title: Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
Post by: Meridian 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.
Title: Re: [DONE][Suggestion] Random soldier bonuses on purchase/recruit
Post by: Solarius Scorch 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.