Author Topic: [Documentation] Soldier Transformations  (Read 18807 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #15 on: January 31, 2020, 07:54:02 pm »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #16 on: May 14, 2020, 08:43:07 pm »
Added new atribute 'upperBoundType'.

Determines how strictly to apply 'upperBoundAtMaxStats' and 'upperBoundAtStatCaps'.
Possible values:

    0 = dynamic (i.e. soft when not changing the soldier type; hard when changing the soldier type)
    1 = soft (if the soldier is already above the maximum before the transformation, don't reduce his overflown stats)
    2 = hard (always reduce if above the maximum)

Default 0.

Offline psavola

  • Commander
  • *****
  • Posts: 835
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #17 on: November 30, 2022, 05:53:56 pm »
I noticed (in TWoTS: implant a mind control protection or convert to a cyborg) that if you can apply this to a gravely wounded soldier, the excess wounds get healed up when doing a transformation.

Example: current wound recovery 20 days, transformation requires 15 days of recovery - after transformation the recovery is 15 days.

I would have expected the greater of the two, i.e., 20 - I'm assuming a soldier can both recover from battle wounds and surgery at the same time.

This would likely be a very simple code change, but I wonder if in some other contexts of transformations this might be undesirable. So I'm not sure if it would be worth it.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #18 on: November 30, 2022, 06:31:18 pm »
The primary inspiration for this feature was xcom2012's MECs.

If I remember correctly, the conversion heals them.

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #19 on: February 25, 2023, 01:06:30 pm »
Hi,

I'm really interested by this amazing feature  :o  (once more  ::)), but I fail to download zip file attached in first post

May it be this zip archive is corrupted?

EDIT: not sure if zip contains interesting resources or if it has only to do with programming, anyway I succeeded to mod it, very good feature
« Last Edit: February 25, 2023, 08:36:51 pm by Aldorn »

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: [EXE] Soldier Transformations
« Reply #20 on: February 25, 2023, 01:10:15 pm »
Here's the ruleset documentation for the modders out there, it's also contained as a text file in the mod attached to the post above:

Code: [Select]
soldierTransformation:
  - name: STR_PROJECT_NAME # (REQUIRED) The name of this project listed in the Soldier Transformations screen
    listOrder: 100 # The list order of this project, defaults to increasing by 100 for each project in the mod when not defined
    requires: # A list of research projects required before this project appears in the list of available transformations, the default empty list means this project is available from the beginning of the game
      #- STR_SOME_RESEARCH
    requiresBaseFunc: # A list of base functions required at a base in order to do this project, the default empty list means no special facilities are required
      #- SOME_BASE_FUNC
    producedSoldierType: STR_SOLDIER # The type of soldier produced by this project - any soldier undergoing this transformation will be switched to this type. If left empty, the soldier type does not change.
    producedSoldierArmor: STR_NONE_UC # The armor the soldier produced will have when the project finishes, only used when keepSoldierArmor is false. Leaving it empty will give the soldier the armor defined by the type in the soldiers: ruleset.
    keepSoldierArmor: false # Default false, this parameter determines whether or not the soldier will keep the armor they're wearing through this transformation
    createsClone: false # Default false, this parameter determines whether the selected soldier has the transformation done to them or a new soldier is created that is a copy of the original and the transformation is done to the new soldier.
    needsCorpseRecovered: true # Default true, if your project allows dead soldiers, this determines whether or not you needed to have a corpse item available at the end of the battle in which the soldier died. This does not mean you need the corpse item in your stores, just that it would have been recovered if recover: true was set on the item
    allowsDeadSoldiers: false # Default false - can dead soldiers undergo this transformation?  If so, they are brought back to life at the base you started this project in
    allowsLiveSoldiers: false # Default false - can live, non-wounded soldiers undergo this transformation?
    allowsWoundedSoldiers: false # Default false - can wounded soldiers undergo this transformation?
    allowedSoldierTypes: # (REQUIRED) This list determines which soldier types can undergo this transformation, the default empty list means nobody can have this project done to them.
      #- STR_SOLDIER
    requiredPreviousTransformations: # A list of transformation projects that must be done to a soldier before they're eligible for this project, the default empty list means no previous projects are required.
      #- STR_SOME_TRANSFORMATION
    forbiddenPreviousTransformations: # A list of transformation projects that a soldier cannot have undergone in order to be eligible for this project, the default empty list means no previous projects are forbidden
      #- STR_SOME_OTHER_TRANSFORMATION
    requiredMinStats: # The minimum stats a soldier must have in order to be eligible for this project, defaults to all 0 so any soldier is eligible
      tu: 0
      stamina: 0
      health: 0
      bravery: 0
      reactions: 0
      firing: 0
      throwing: 0
      strength: 0
      psiStrength: 0
      psiSkill: 0
      melee: 0
    requiredItems: # A list of items that must be consumed from the base's stores in which you start this project, the default empty list means no items are used
      #STR_SOME_ITEM: 1
    cost: 50000 # The cost of the project in dollars
    transferTime: 0 # Soldiers can be put in a transfer back to the base where they started if this parameter is greater than the default of 0 hours. New clones or resurrected soldiers are automatically given a transfer to the base with a default of 24 hours.
    recoveryTime: 0 # The amount of wound recovery time a soldier is given after this project completes and the transfer, if any, is completed. The default value is 0 days.
    flatOverallStatChange: # A direct change to the soldier's overall stats when undergoing this project, can be positive or negative - tu: 5 means the soldier will gain 5 max time units, while tu: -5 means the soldier will lose 5 max time units. The default of 0 means no change.
      tu: 0
      stamina: 0
      health: 0
      bravery: 0
      reactions: 0
      firing: 0
      throwing: 0
      strength: 0
      psiStrength: 0
      psiSkill: 0
      melee: 0
    percentOverallStatChange: # A percent change to the soldier's overall stats when undergoing this project, can be positive or negative - tu: 5 means the soldier will gain an extra 5% of their max time units, while tu: -5 means the soldier will lose 5% of their max time units. The default of 0 means no change.
      tu: 0
      stamina: 0
      health: 0
      bravery: 0
      reactions: 0
      firing: 0
      throwing: 0
      strength: 0
      psiStrength: 0
      psiSkill: 0
      melee: 0
    percentGainedStatChange: # A percent change to the soldier's stats, but instead of taking a portion of the overall stats, this only applies to the stats they've trained up from their initial values, can be positive or negative - firing: -100 means the soldier will lose all of the firing accuracy they trained since joining, while firing: 10 means they gain 10% of the amount they trained over their initial values. The default of 0 means no change.
      tu: 0
      stamina: 0
      health: 0
      bravery: 0
      reactions: 0
      firing: 0
      throwing: 0
      strength: 0
      psiStrength: 0
      psiSkill: 0
      melee: 0
    useRandomStats: false # Default false, when true, this parameter overrides the stat changes above and has the produced soldier roll random stats according to their new soldier type from this transformation project.
    lowerBoundAtMinStats: true # Default true, this parameter determines whether or not any changes in stats from this project should go below the minStats defined on the new soldier type.
    upperBoundAtMaxStats: false # Default false, this parameter determines whether or not any changes in stats from this project should go above the maxStats defined on the new soldier type.
    upperBoundAtStatCaps: false # Default false, this parameter determines whether or not any changes in stats from this project should go above the statCaps defined on the new soldier type.

The associated strings are:
Code: [Select]
extraStrings:
  - type: en-US
    strings:
#SoldierTransformationAssignState.cpp
      STR_TRANSFER_TIME: "Transfer Time>{ALT}{0}"
      STR_RECOVERY_TIME: "Recovery Time>{ALT}{0}"
      STR_CURRENT_STATS: "Current stats"
      STR_CHANGES: "Changes"

Explanation are really great !!

Providing new features is wonderful, explaining how to implement, with so much details, is paradise  :)

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #21 on: February 25, 2023, 09:03:51 pm »
Hi,

I'm really interested by this amazing feature  :o  (once more  ::)), but I fail to download zip file attached in first post

May it be this zip archive is corrupted?

EDIT: not sure if zip contains interesting resources or if it has only to do with programming, anyway I succeeded to mod it, very good feature

The ZIP archive was a copy of the executable for testing purposes, not necessary anymore since this is part of OXCE's codebase. Glad you enjoy the feature!

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #22 on: February 26, 2023, 03:19:16 pm »
Perfect, thanks for your answer !

Offline 0xEBJC

  • Colonel
  • ****
  • Posts: 180
  • Y'all are awesome! Thankful for this community.
    • View Profile
    • My Projects
Re: [Documentation] Soldier Transformations
« Reply #23 on: November 22, 2023, 01:56:50 am »
is there a way to make the cost as a function vs a fixed value?

I was looking at the untouchables mod that does regeneration and resurrection.

I'm just tinkering with some ideas at the moment, but was thinking it would be useful to have the cost based off the soldiers specific stats.

my particular thought is for regeneration a function of days wounded
cost: 20000 * currentRecovery

but this feature could enable a lot of other useful mod options like making cost specific to other stats like the higher you go in strength a strength transformation cost more
transform + 20 strength
cost: 2000 * currentStrength

also would be helpful to have the requiredItems allow for a function as well
reqiredItems:
  STR_ENERGENIC_BLOOD_PLASMA: currentStrength / 10

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #24 on: November 22, 2023, 09:58:09 am »
is there a way to make the cost as a function vs a fixed value?

no

Offline Kronos913

  • Colonel
  • ****
  • Posts: 124
    • View Profile
Re: [Documentation] Soldier Transformations
« Reply #25 on: June 03, 2024, 05:44:08 pm »
If a soldier is in psi training, how can the psi training be maintained during the transformation process? (So ​​that the current month gives an increase)