Author Topic: [DONE] [Suggestion] Soldier bonuses (from transformations and commendations)  (Read 19409 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Quote
ohartenstein23Today at 2:27 PM
@Meridian The problem Solarius was having with transformations was that he wanted to use them to represent a number of advanced trainings unlocked by research to provide bonus stats; since they didn't change the soldier type and therefore the stat caps, if a player used them before a soldier reached the caps, they would have lower total stats than if they waited until the caps to use the training transformations. Using a new soldier type for each one was rejected since these trainings weren't mutually exclusive or to be done in a fixed order - Solarius had hoped that these would act like stat bonuses on an armor, but permanently attached to the soldier.

One possible solution we thought of would be to create a new ruleset data structure for bonuses added by transformations and commendations: these bonuses would be named by a unique type and define a set of parameters similar to an armor ruleset, then transformations and commendations could refer to them by that type. On creation of a battle unit from a soldier, these stats would be added to to what the unit's armor adds to the unit's stats, including trainable stats like TUs, firing, etc., as well as NV and recoveries.

A ruleset example might look like:
soldierBonuses:
  - name: STR_KARATE_TRAINING
    stats: # gives stats that don't count toward stat caps
      reactions: 5
      melee: 10
    recovery: # adds to recovery from armor
      energy:
        tuMax: 0.05 # extra energy recovery in all armors


soldierTransformation:
  - name: STR_TRAIN_IN_KARATE
    soldierBonusType: STR_KARATE_TRAINING

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Soldiers can now collect bonuses.
Bonuses can be manually awarded by the player via soldier transformations; or automatically awarded together with a soldier commendation/medal.
Bonuses of the same name/type don't stack.
(Different bonuses changing the same attributes do stack.)

Bonuses can improve soldier stats (even over any maximum), regeneration of resources every turn and visibility at dark (until global maximum).

Since OXCE 7.1.4 also armor values can be modified.

Here is an example of a very long bonus:

Code: [Select]
soldierBonuses:
  - name: STR_FIRST_TEST
    visibilityAtDark: 20     # +20 tiles
    stats:
      tu: 99                 # +99 TUs
      stamina: 0
      health: 99
      bravery: 0
      reactions: 0
      firing: 0
      throwing: 0
      strength: 99
      psiStrength: 0
      psiSkill: 0
      melee: 0
      mana: 0
    recovery:
      time:
        flatOne: -10
      energy:
        flatOne: 100
      morale:
        flatOne: -15       # -15 morale per turn
      health:
        flatOne: -5
      mana:
        flatOne: -1
      stun:
        flatOne: 4

These bonuses can be assigned to soldiers via transformations:

Code: [Select]
soldierTransformation:
  - name: STR_TEST_TRANSFORM
    keepSoldierArmor: true
    createsClone: false
    allowsDeadSoldiers: false
    allowsLiveSoldiers: true
    allowsWoundedSoldiers: true
    allowedSoldierTypes:
      - STR_SOLDIER
    cost: 0
    recoveryTime: 1
#    flatOverallStatChange:
#      tu: 99
#      health: 99
#      strength: 99
    reset: false                                  # don't reset previous transformations or previous bonuses
    soldierBonusType: STR_FIRST_TEST              # bonus to assign
    lowerBoundAtMinStats: true
    upperBoundAtMaxStats: false
    upperBoundAtStatCaps: true
#    requiredItems:
#      STR_UNIQUE_ITEM: 1

The reset flag can be used to clear the bonuses gained by previous transformations. It also clears the list of previously performed transformations.
For example:
1. you train karate and gain a bonus
2. then you transform the guy into a MEC and want to lose all the previous bonuses (since MECs can't benefit from karate training... I hope)

Note: stats gained by "classic" transformations (i.e. those that are NOT bonuses) will NOT be reset; only bonuses can be reset

Or via commendations:

Code: [Select]
commendations:
  - type: STR_MEDAL_ALIENS_KILLED
    description: STR_MEDAL_ALIENS_KILLED_DESCRIPTION
    sprite: 1
    soldierBonusTypes: [STR_KILL1, STR_KILL2, STR_KILL3, STR_KILL4]           # various bonuses for various decoration levels
    criteria:
      killsWithCriteriaCareer: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    killCriteria:
      -
        - [1, ["STATUS_DEAD", "FACTION_HOSTILE"]]

Bonuses are defined per decoration level.
You don't need to define all decoration levels... if a soldier has higher decoration level than defined, the highest available is used.

Test build: https://lxnt.wtf/oxem/builds//Extended/Extended-5.6.4-c50d95558-2019-09-15-win64.7z
« Last Edit: October 24, 2021, 06:18:42 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
GUI stuff.

Offline Meridian

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

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website


You're too good for this world.

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Dunno yet how to implement such thing... but it MUST be useful.
Also, how about random bonuses?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
I have already spent a lot of time on this feature, working with Dioxine on Piratez. It's as great as it sounds.

One additional request: from the menu where all bonuses are displayed (small button), could it be possible to middle-click a bonus and have a stat page ("anal") displayed? Otherwise there will be a lot of typing in commendation descriptions...

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
One additional request: from the menu where all bonuses are displayed (small button), could it be possible to middle-click a bonus and have a stat page ("anal") displayed? Otherwise there will be a lot of typing in commendation descriptions...

A normal ufopedia page or something more complicated?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
A normal ufopedia page or something more complicated?

Something like the INFO/ANAL section, I'd say. It should list all bonuses fairly clearly.

A Pedia page would require making a lot of pages (up to 10 per commendation...) and manually keeping them all updated. This is not something I am prepared to do, to be honest.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Like this?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Two more features:
1. soldier transformations can now require commendations as a pre-requisite
2. soldier transformations can now require a minimum soldier rank

Example:

Code: [Select]
soldierTransformation:
  - name: STR_TEST_TRANSFORM
    requiredCommendations:
      STR_MEDAL_ORIGINAL8_NAME: 0     # no decoration needed
      STR_MEDAL_ALIENS_KILLED: 1      # at least first bronze pin

Code: [Select]
soldierTransformation:
  - name: STR_TEST_TRANSFORM
    minRank: 1     # 0 = rookie, 5 = commander
« Last Edit: October 11, 2019, 04:05:39 pm by Meridian »

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
And it is possible to make so that bonuses were given together with a rank automatically?

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
And it is possible to make so that bonuses were given together with a rank automatically?

You'd have to check with the commendations code whether a commendation can be given for reaching a certain rank, and then have a bonus tied to that.

If you're okay with something that requires a bit of player input, you could do it with transformations:
  • Have the standard soldier type for your mod be limited to the rookie->squaddie promotion.
  • Create a transformation that requires squaddie rank, add a bonus to it, and transform the soldier to a new soldier type.
  • Have that new soldier type be limited to promoting to the next rank above squaddie and repeat the process.

This could even be used to make an XCOM2012-style branching promotion system where the primary stat gains are determined by the player through rank-up transformations.

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
I do not use commendations. Using transformations, you can give any bonuses without it. Here are the requirements for the rank previously were not.

By the way, if there is a bonus to regeneration and visibility at dark, like armor, can it be possible to expand the option for all the characteristics of the armor, so they can be used as a bonus?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
And it is possible to make so that bonuses were given together with a rank automatically?

I think this can be done already using scripts, not 100% sure.
(changing stats based on rank... without needing bonuses as such)

By the way, if there is a bonus to regeneration and visibility at dark, like armor, can it be possible to expand the option for all the characteristics of the armor, so they can be used as a bonus?

No... stats, regen and visibility are tracked on each unit separately... that's why I could affect them with bonuses.
Other attributes defined by armor are only on the armor itself, not on each unit, so they are the same for all units (having the same armor) and cannot be changed individually.
« Last Edit: October 12, 2019, 12:43:26 am by Meridian »