OpenXcom Forum

Modding => Help => Topic started by: The Martian on January 12, 2022, 01:08:27 am

Title: Recovering friendly spawned units?
Post by: The Martian 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.
Title: Re: Recovering friendly spawned units?
Post by: Filip H 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]
Title: Re: Recovering friendly spawned units?
Post by: The Martian on January 16, 2022, 02:11:34 am
Great idea! (https://openxcom.org/forum/Themes/InsidiousV1-k/images/post/thumbup.gif)

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.
Title: Re: Recovering friendly spawned units?
Post by: The Martian 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! (https://openxcom.org/forum/Themes/InsidiousV1-k/images/post/thumbup.gif)

Thank you for the help.
Title: Re: Recovering friendly spawned units?
Post by: The Martian 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 (https://openxcom.org/forum/index.php?action=dlattach;topic=10322.0;attach=56412)


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.
(https://openxcom.org/forum/index.php?action=dlattach;topic=10322.0;attach=56413)

Has anyone got a spawned friendly unit to recover as an item successfully?
Title: Re: Recovering friendly spawned units?
Post by: Buscher 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.

Code: [Select]
  - type: STR_DAVID_VINCENT
    civilianRecoveryType: STR_DAVID_VINCENT
Title: Re: Recovering friendly spawned units?
Post by: The Martian on March 28, 2022, 06:38:42 pm
Thank you that got it. (https://openxcom.org/forum/Themes/InsidiousV1-k/images/post/thumbup.gif)

I just ran a few test missions and civilianRecoveryType: appears to have caused it to recover as expected.