aliens

Author Topic: [Solved] More "Explodes on Death" control  (Read 2783 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
[Solved] More "Explodes on Death" control
« on: September 18, 2020, 12:05:43 pm »
The specab: setting on units allows them to set fires as they move and/or explode when killed.

I would like to be able to better control what happens when a unit "Explodes on Death".
Code: [Select]
specab:  |  Special ability of this unit:

    0 = None
    1 = Explodes on Death (Requires power and blastRadius properties to be set on the corpse)
    2 = Burns Floor
    3 = Burns Floor and explodes on Death


Specifically if specab: could be granted a fourth setting and an extra variable that references an already configured grenade in the items: section.

The specab: variable would now look like this:
Code: [Select]
specab:  |  Special ability of this unit:

    0 = None
    1 = Explodes on Death (Requires power and blastRadius properties to be set on the corpse)
    2 = Burns Floor
    3 = Burns Floor and explodes on Death
    4 = Explodes on Death (Uses item: STR_GRENADE_NAME to determine explosion effect)
    5 = Burns Floor and explodes on Death (Uses item: STR_GRENADE_NAME to determine explosion effect)


And an additional variable would be added to the unit using setting 4 or 5 similar to this:
specabItem: STR_GRENADE_NAME

This way a unit could explode on death but instead of an explosion it could activate a smoke grenade effect or an incendiary grenade effect. (Or whatever the modder had configured STR_GRENADE_NAME to do.)

An additonal value of this is that any scripts running off tags on the referenced grenade would trigger allowing for new interesting combinations of exploding units.


I think the entire modding community could make good use of this.
« Last Edit: February 14, 2023, 11:02:32 am by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [SUGGESTION] More "Explodes on Death" control
« Reply #1 on: September 18, 2020, 01:00:39 pm »
What's the difference between configuring the explosion on the corpse item and configuring the explosion on some other new item?

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: [SUGGESTION] More "Explodes on Death" control
« Reply #2 on: September 18, 2020, 03:10:30 pm »
One feature of this is that several units could reference the same STR_GRENADE_NAME item which could theoretically making it easier to create groups of different units that have the same on death effect without having to define it individually on each unit's corpse.


Is it currently possible to have a unit explode as smoke, incendiary, etc instead of the normal explosion type damage?

I tried configuring specab: 1 on several enemies in the units: section and then configuring their corpse to be either smoke or fire type damage but they did not detonate on death, example:
Code: [Select]
units:
  - type: STR_SECTOID_SOLDIER
    race: STR_SECTOID
    rank: STR_LIVE_SOLDIER
    stats:
      tu: 54
      stamina: 90
      health: 30
      bravery: 80
      reactions: 63
      firing: 52
      throwing: 58
      strength: 30
      psiStrength: 40
      psiSkill: 0
      melee: 76
    armor: SECTOID_ARMOR0
    standHeight: 16
    kneelHeight: 12
    value: 10
    deathSound: 10
    intelligence: 3
    aggression: 2
    specab: 1

items:
  - type: STR_SECTOID_CORPSE
    size: 0.4
    costSell: 20000
    weight: 30
    bigSprite: 46
    floorSprite: 42
    invWidth: 2
    invHeight: 3
    recoveryPoints: 5
    battleType: 11
    armor: 26
    blastRadius: 5
    power: 50
    damageType: 2


I assumed that this wasn't possible when the sectoids didn't explode, but is it instead that my code is wrong?

Edit:
For convenience I have attached a .rul file with the exploding incendiary sectoid units & corpse.
« Last Edit: September 18, 2020, 03:32:37 pm by The Martian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [SUGGESTION] More "Explodes on Death" control
« Reply #3 on: September 18, 2020, 04:11:11 pm »
Your code worked for me.

Sectoid exploded in flames, video attached.

on unit:

Code: [Select]
    specab: 1

on item:

Code: [Select]
    blastRadius: 5
    power: 50
    damageType: 2
« Last Edit: September 18, 2020, 04:17:13 pm by Meridian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: [SUGGESTION] More "Explodes on Death" control
« Reply #4 on: September 20, 2020, 10:29:21 am »
Your code worked for me.

Embarrassingly after double checking my code I realized another .rul I've been working with has been overwriting the sectoid's values with their default stats causing me to think that non-explosion type damage based "Explodes on Death" settings were not supported.

Please disregard my request and thank you for testing the code and providing the burn.mp4 video.
« Last Edit: September 20, 2020, 10:32:32 am by The Martian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [SUGGESTION] More "Explodes on Death" control
« Reply #5 on: September 20, 2020, 03:10:05 pm »
This is why we have "StatsForNerds" you can check most important properties and what value is finally set.