Author Topic: [DONE] [Suggestion] Item recovery transformation  (Read 7811 times)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
[DONE] [Suggestion] Item recovery transformation
« on: January 24, 2019, 03:59:01 pm »
requested by Drages
« Last Edit: January 26, 2019, 01:02:21 pm by Meridian »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #1 on: January 24, 2019, 03:59:14 pm »
The idea is that you recover something else than what you see on the battlescape.

Can be used for example:
1. to recover weapon fragments instead of weapons, a la xcom2012
2. to recover tons of various loot instead of a loot box (and skip the manufacturing project to open a loot box)
3. to recover some alien body parts instead of alien corpse (and skip dissection manufacturing project)
4. etc.

Sample ruleset:

Code: [Select]
items:
  - type: STR_PLASMA_PISTOL
    recoveryTransformations:
      STR_WEAPON_FRAGMENTS: [0, 50, 35, 15]    # 0% to recover 0 items, 50% to recover 1 item, 35% for 2 items, 15% for 3 items
      STR_RANDOM_BITS_OF_KNOWLEDGE: [10]       # always recover exactly 10 items

Specifying just one number means "recover that many items".

Specifying two or more numbers gives weights to recover 0, 1, 2, 3, 4, 5, etc. items, for example:
- [0, 50, 35, 15] = 0% to recover 0 items, 50% to recover 1 item, 35% for 2 items, 15% for 3 items
- [25, 25, 25, 25] = 25% for 0, 25% for 1, 25% for 2, 25% for 3 items
- [1, 1, 1, 1] = means the same as above = 25% for 0, 25% for 1, 25% for 2, 25% for 3 items

On the "transformed into" side, you cannot specify to recover live aliens from some random unorganic junk.

Also, you can (but should not) recover special items (alien alloys, food, entertainment, etc.) or bounty items, because the debriefing summary is done before the transformations and will not show correct values to the player.

The "transformed from" side supports transformation of:
- weapons
- ammo
- consumable medikits
- non-consumable medikits
- alien corpses
- corpses of live aliens who die because of lack of alien containment
- civilians recovered as items (which don't represent a live alien)
- bounty item

Not supported or irrelevant:
- live aliens EDIT: partially supported since March 25th 2020, OXCE v6.5, live aliens can now be recovered as items (not as other live aliens)
- civilians recovered as items (which do represent a live alien)
- special items (alien aloys, alien food, alien entertainment, etc.)
- xcom vehicles (HWP/SWS)
- xcom vehicle ammo
- automatically replaced armor of KIA xcom soldiers
- automatically replaced armor of MIA xcom soldiers
« Last Edit: May 14, 2020, 09:41:15 pm by Meridian »

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #2 on: January 24, 2019, 04:50:23 pm »
Hey again!

You already listed what we need this for. I always hated to have 150 heavy plasma just to sell.. alien tech should be alien tech, not ready for us to use at first moment, or not to handle them after i figure out where is the trigger.

Just it needs to have randomization to complete the random project. For example that weapon which destroyed or disassembled first, should able to give random items. More part or the most important "unique parts" can be survived after that self destruct or disassemble procedure.  As i explained why the randomization should be at manufacture-research-loot herehttps://openxcom.org/forum/index.php/topic,6867.0.html, we need to able to get things with percentages from this transformations. I just do not care if a heavy plasma gives me 4 or 5 weapon fragment but that very rare "weapon power core" to create my own human plasma weapons. It goes same to body parts as maybe the brain of the sectoid is not blown up this time.. how can someone miss that head anyway..

As the code example, as same as manufacture one:

Code: [Select]
recoveryTransformations:
      STR_WEAPON_FRAGMENTS: 1-3
      STR_PLASMA_CORE: 0,50-1,35-2,15 (%50 0 drop, %35 1 drop, %15 2 drop)
      STR_RANDOM_BITS_OF_KNOWLEDGE: 10

Thank you!

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #3 on: January 24, 2019, 05:06:04 pm »
One more useful innovation it be.
Agree with all my heart.
Maybe syntax can use lists as deployement?
Randomitemtransform:
 - variant1
 - 2
 -
   - parts1: 5
   - parts2: 3
?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #4 on: January 25, 2019, 10:51:49 am »
Added support for randomization.

Updated original post with ruleset syntax.

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #5 on: January 25, 2019, 11:25:35 am »
Added support for randomization.

Updated original post with ruleset syntax.

So, if i want to have %10 chance to get 1 item only,

Code: [Select]
STR_WEAPON_FRAGMENTS: [90, 10]    # 90% to recover 0 items, 10% to recover 1 item
and can it be more then 4?

Code: [Select]
STR_WEAPON_FRAGMENTS: [20, 20, 20, 20, 20]    # 0 to 4 item with %20 chance
are those correct?

And this confused me a bit, [1, 1, 1, 1] ,

I read this %1 chance to get 0-3 items.. how is this work with [25,25,25,25]? I mean this could be 25 items with %25 chance.. so this [1, 1, 1, 1] is unique to "1" only?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #6 on: January 25, 2019, 11:38:53 am »
So, if i want to have %10 chance to get 1 item only,

Code: [Select]
STR_WEAPON_FRAGMENTS: [90, 10]    # 90% to recover 0 items, 10% to recover 1 item

Yes.

and can it be more then 4?

Yes, unlimited.

Code: [Select]
STR_WEAPON_FRAGMENTS: [20, 20, 20, 20, 20]    # 0 to 4 item with %20 chance
are those correct?

Yes.

And this confused me a bit, [1, 1, 1, 1] ,

I read this %1 chance to get 0-3 items.. how is this work with [25,25,25,25]? I mean this could be 25 items with %25 chance.. so this [1, 1, 1, 1] is unique to "1" only?

I cannot use percentages... because modders could define something like this [100,100,100,100]... and then wtf should I do?

Instead the numbers are "weights".
If all weights add up to 100, then it is the same as percentages. If they add up to something else, corresponding portion is considered.

So [0, 50, 35, 15] adds up to 100 and corresponding chances are 0/100, 50/100, 35/100 and 15/100 = 0%, 50%, 35% and 15%.

Similarly [1, 1, 1, 1] adds up to 4 and corresponding chances are 1/4, 1/4, 1/4 and 1/4 = 25%, 25%, 25% and 25%.

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #7 on: January 25, 2019, 11:47:06 am »
I cannot use percentages... because modders could define something like this [100,100,100,100]... and then wtf should I do?

Instead the numbers are "weights".
If all weights add up to 100, then it is the same as percentages. If they add up to something else, corresponding portion is considered.

So [0, 50, 35, 15] adds up to 100 and corresponding chances are 0/100, 50/100, 35/100 and 15/100 = 0%, 50%, 35% and 15%.

Similarly [1, 1, 1, 1] adds up to 4 and corresponding chances are 1/4, 1/4, 1/4 and 1/4 = 25%, 25%, 25% and 25%.

I see, this is great solution! I got it now!

So same for manufacture will open a new era for XCom!!! :) again thx for your time!

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [DONE] [Suggestion] Item recovery transformation
« Reply #8 on: May 14, 2020, 09:47:43 pm »
Small update in OXCE v6.5:

The "transformed from" side supports transformation of:
- weapons
- ammo
- consumable medikits
- non-consumable medikits
- alien corpses
- corpses of live aliens who die because of lack of alien containment
- civilians recovered as items (which don't represent a live alien)
- bounty item

Not supported or irrelevant:
- live aliens EDIT: partially supported since March 25th 2020, OXCE v6.5, live aliens can now be recovered as items (not as other live aliens)
- civilians recovered as items (which do represent a live alien)
- special items (alien aloys, alien food, alien entertainment, etc.)
- xcom vehicles (HWP/SWS)
- xcom vehicle ammo
- automatically replaced armor of KIA xcom soldiers
- automatically replaced armor of MIA xcom soldiers

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE] [Suggestion] Item recovery transformation
« Reply #9 on: March 19, 2023, 12:17:09 pm »
I have a mission where you rescue some victims from a Deep Ones ritual. These victims are not civilian units, they are items (battleType: 0).
There are several types of such victims (for visual variety), but I'd like to recover them all as the same item (called Human Sacrifice), since I don't need to differentiate between them once they mission ends. How exactly should I specify that? The examples given are about complex cases like a multitude of items from one, with weights and such, and I just need a simple 1:1 transformation of item X to item Y. Help please :)

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [Suggestion] Item recovery transformation
« Reply #10 on: March 19, 2023, 12:34:25 pm »
On the "transformed into" side, you cannot specify to recover live aliens from some random unorganic junk.

Transforming inanimate objects into live aliens is not supported.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [DONE] [Suggestion] Item recovery transformation
« Reply #11 on: March 19, 2023, 12:42:39 pm »
In case your "Human Sacrifice" object is not a live alien, then you can use this example:

Code: [Select]
items:
  - type: STR_GRENADE
    recoveryTransformations:
      STR_ELECTRO_FLARE: [1]
  - type: STR_STUN_ROD
    recoveryTransformations:
      STR_ELECTRO_FLARE: [1]

This transforms all grenades and stun rods into electroflares.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [DONE] [Suggestion] Item recovery transformation
« Reply #12 on: March 21, 2023, 10:26:04 am »
Thank you, this is exactly what I needed.