Author Topic: Recovering friendly spawned units?  (Read 2479 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Recovering friendly spawned units?
« on: January 12, 2022, 01:08:27 am »
Is it possible to recover a friendly unit at the end of combat that was spawned from an item via:
Code: [Select]
items:
  - type: STR_EXAMPLE_ITEM
    spawnUnit: STR_EXAMPLE_UNIT
    spawnUnitFaction: 0

I have a remote controlled robot drone but at the moment X-Com just discards it if deployed in the field which seems silly.

Offline Filip H

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Recovering friendly spawned units?
« Reply #1 on: January 12, 2022, 09:14:36 pm »
Using builtInWeaponSets to add a dummy item with recoveryTransformations to change it back to the original item could probably do it.
Something like this:
Code: [Select]
units:
   - type: STR_EXAMPLE_UNIT
     builtInWeaponSets:
       - - STR_DUMMY_ITEM
items:
   - type: STR_DUMMY_ITEM
     fixedWeapon: true
     recover: true
     recoveryTransformations:
        STR_EXAMPLE_ITEM: [1]

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Recovering friendly spawned units?
« Reply #2 on: January 16, 2022, 02:11:34 am »
Great idea!

And since it is assigned fixedWeapon: true if the unit is destroyed it won't drop the item, perfect!

I'll try it out and post the result.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Recovering friendly spawned units?
« Reply #3 on: March 26, 2022, 03:04:15 am »
Using builtInWeaponSets to add a dummy item with recoveryTransformations to change it back to the original item could probably do it.
Something like this:
Code: [Select]
units:
   - type: STR_EXAMPLE_UNIT
     builtInWeaponSets:
       - - STR_DUMMY_ITEM
items:
   - type: STR_DUMMY_ITEM
     fixedWeapon: true
     recover: true
     recoveryTransformations:
        STR_EXAMPLE_ITEM: [1]

I just tested your solution and it worked perfectly!

Thank you for the help.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Recovering friendly spawned units?
« Reply #4 on: March 28, 2022, 04:01:48 am »
Or at least I thought it was working but it appears that nothing was actually being recovered and that I had made a mistake when reading the base's inventory screen.  :-[

I'm attaching the mod I'm trying to create that allows deploying of a small drone that is supposed to be recoverable at then end of battle:
Test-Spawn-Recover V0-1.zip


It would be kind of strange if X-Com threw away its functional equipment after every mission so I'm hoping that this is possible.


Has anyone got a spawned friendly unit to recover as an item successfully?
« Last Edit: March 28, 2022, 04:07:38 am by The Martian »

Offline Buscher

  • Colonel
  • ****
  • Posts: 167
    • View Profile
Re: Recovering friendly spawned units?
« Reply #5 on: March 28, 2022, 05:55:11 pm »
In X-Com Files you can recover a scientist who is spawned with a spawner grenade.

The civilianRecoveryType statement seems to do the trick.

Spoiler:
Code: [Select]
  - type: STR_DAVID_VINCENT
    civilianRecoveryType: STR_DAVID_VINCENT

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Recovering friendly spawned units?
« Reply #6 on: March 28, 2022, 06:38:42 pm »
Thank you that got it.

I just ran a few test missions and civilianRecoveryType: appears to have caused it to recover as expected.
« Last Edit: March 28, 2022, 06:40:30 pm by The Martian »