Author Topic: [DONE][Suggestion] Self-destruct can spawn items and units  (Read 2204 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
[DONE][Suggestion] Self-destruct can spawn items and units
« on: October 13, 2023, 08:09:08 pm »
Is it possible to allow "corpseBattle" items of non 11 type?
 It will be useful first for units that spawn someone on death.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #1 on: October 13, 2023, 08:32:31 pm »
No, this is enforced because lot of logic is linked to item type and lot of recovery logic break when its changed.

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #2 on: October 13, 2023, 10:22:46 pm »
Oh, ok. How about scripted explosion of corpses with "power"? Is it posible maybe? Without "specab".

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #3 on: October 13, 2023, 10:37:20 pm »
side question, this is related to globe corpse "specab" problem? if yes then I discussed this problem with SupSuper and we come to conclusion that we will fix it,
current solution will be new property `selfDestructItem:` that will override globe corpse item when used for self destruct.

for scripts itself, currency you can force self destruct using script hook `damageSpecialUnit` and one of parameters control "explosiveness" of given unit.

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #4 on: October 13, 2023, 11:56:01 pm »
No, it is not related. As about `damageSpecialUnit` - it is a great opportunity, thank you very much. Going to try. :)

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #5 on: October 14, 2023, 12:40:51 am »
Ok, i have discovered that i have encountered this problem earlier here.
I want to create resurrecting enemy unit, but exploding corpse can not spawn new unit.
Only way i found - is to add special item to the unit inventory, which will fall and detonate. But it is ugly and causes many odd situations ingame.
Best decision (for modders) will be support of spawning units not only from grenades, but from corpses too.
I see no script possibilities to spawn new unit from corpse, so maybe it will stay as it is now.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #6 on: October 21, 2023, 06:37:34 pm »
OXCE 7.9.15 now self destruct can spawn items and units, and you can define what items type is used for this by `selfDestructItem:` in armor.

Edit: https://github.com/MeridianOXC/OpenXcom/commit/b6c1eb0760540ac97bf249674c5ca165c20b26d8
« Last Edit: December 09, 2023, 10:37:22 am by Meridian »

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #7 on: October 22, 2023, 10:47:32 am »
Thanks, will try.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9089
    • View Profile
Re: [Suggestion] Not corpse-type corpses.
« Reply #8 on: December 09, 2023, 10:38:18 am »
Hi Nord, can you confirm if this is working or not?

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [DONE][Suggestion] Self-destruct can spawn items and units
« Reply #9 on: January 15, 2024, 03:14:08 pm »
Checked. Work just fine. Thank you very much.

Offline mutantlord

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: [DONE][Suggestion] Self-destruct can spawn items and units
« Reply #10 on: January 15, 2024, 05:05:38 pm »
Sample ruleset please?

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [DONE][Suggestion] Self-destruct can spawn items and units
« Reply #11 on: January 15, 2024, 06:21:32 pm »
Sample ruleset please?
Spoiler:
Code: [Select]
items:
  - type: STR_PHOENIX_BLAST
    categories: [STR_CORPSES]
    size: 0.2
    weight: 5
    bigSprite: 1550
    floorSprite: 1550
    invWidth: 2
    invHeight: 2
    power: 24
    damageType: 2
    recover: false
    damageAlter:
      RandomType: 2
      FireBlastCalc: false
      ToItem: 10
    spawnItem: STR_PHOENIX_CORPSE
    spawnItemChance: 100
    battleType: 11
    armor: 1
    listOrder: 10747
    ignoreInCraftEquip: true
    fixedWeapon: false

  - type: STR_PHOENIX_CORPSE
    categories: [STR_CORPSES]
    size: 0.2
    costSell: 8500
    weight: 5
    bigSprite: 1550
    floorSprite: 1550
    invWidth: 2
    invHeight: 2
    power: 24
    damageType: 2
    damageAlter:
      RandomType: 2
      FireBlastCalc: false
    recoveryPoints: 5
    spawnUnit: STR_PHOENIX
    spawnUnitFaction: 1
    battleType: 4
    isExplodingInHands: false
    fuseType: -3
    armor: 32
    listOrder: 10747
    ignoreInCraftEquip: true
    fixedWeapon: false
    scripts:
      createItem: |
        item.setFuseTimer 0;
        return;
armors:
  - type: PHOENIX_ARMOR
    corpseBattle: [STR_PHOENIX_BLAST]
    selfDestructItem: STR_PHOENIX_BLAST
...