Author Topic: [Suggestion] Make specab: be able to be activated by enviroEffects: & recovery:  (Read 3411 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
I'm hoping that it is possible to implement it so that one or both of the below methods can trigger the specab: 1 effect on unit death.

If a unit dies due to either having its armor cause negative health regen or via enviroEffects: damage the unit's death does not appear to trigger its specab: 1 effect and explode on death.


Armor with decaying health example:

Code: [Select]
armors:
  - type: AQUATOID_ARMOR
    spriteSheet: AQUATOID.PCK
    allowInv: false
    corpseBattle:
      - STR_AQUATOID_CORPSE
    frontArmor: 5
    sideArmor: 5
    rearArmor: 5
    underArmor: 5
    drawingRoutine: 4
    constantAnimation: true
    damageModifier:
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
    loftempsSet: [ 5 ]
    overKill: 10.0
    recovery:
      health:
        flatHundred: -0.5

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

enviroEffects: that causes harm to units example:

Code: [Select]
enviroEffects:
  - type: COND_P1
    mapBackgroundColor: 10
    environmentalConditions:
      STR_HOSTILE:
        chancePerTurn: 100
        firstTurn: 1
        lastTurn: 1000
        message: "STR_TEST"
        color: 29
        weaponOrAmmo: "STR_TEST_EFFECT"
        side: 4
        bodyPart: 1

items:
  - type: STR_TEST_EFFECT
    size: 0.3
    costSell: 9590
    weight: 3
    bigSprite: 25
    floorSprite: 33
    handSprite: 200
    hitSound: 31
    hitAnimation: 46
    power: 130
    damageType: 19
    clipSize: 10
    battleType: 2
    recoveryPoints: 1
    armor: 50
    attraction: 1
    vaporColor: 3
    vaporDensity: 30

armors:
  - type: AQUATOID_ARMOR0
    damageModifier:
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.6
      - 1.5
      - 1.0
      - 1.0 # Extra Resistances
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0
      - 1.0 # Enviroment Effect

items:
  - type: STR_AQUATOID_CORPSE
    size: 0.4
    costSell: 20000
    weight: 30
    bigSprite: 46
    floorSprite: 41
    invWidth: 2
    invHeight: 3
    recoveryPoints: 5
    battleType: 11
    armor: 26
    blastRadius: 5
    power: 100
    damageType: 2
« Last Edit: September 07, 2021, 08:50:44 am by The Martian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
1/ Don't know about negative health regen.

2/ For enviroEffect it is not possible.
Here are the limitations for enviroEffects:

Code: [Select]
// Note: there are limitations, since we're not using a projectile and nobody is actually shooting
// 1. no power bonus based on shooting unit's stats (nobody is shooting)
// 2. no power range reduction (there is no projectile, range = 0)
// 3. no AOE damage from explosions (targets are damaged directly without affecting anyone/anything)
// 4. no terrain damage
// 5. no self-destruct
// 6. no vanilla target morale loss when hurt; vanilla morale loss for fatal wounds still applies though
//
// 7. no setting target on fire (...could be added if needed)
// 8. no fire extinguisher

Offline Nord

  • Commander
  • *****
  • Posts: 1740
  • The Gate is open.
    • View Profile
You can create identical armor, one of them with desired effect, and then switch them via startingconditions.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
You can create identical armor, one of them with desired effect, and then switch them via startingconditions.

I don't see how that relates to the original question.
Probably a misunderstanding.

Offline Nord

  • Commander
  • *****
  • Posts: 1740
  • The Gate is open.
    • View Profile
Oh, my bad.
Then... are there some damage types, that bypass specab?
Like melee in vanilla.
Enviroeffect with this type of damage should work then.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Oh, my bad.
Then... are there some damage types, that bypass specab?
Like melee in vanilla.
Enviroeffect with this type of damage should work then.

The issue is not damage type.
Yes, some damage types bypass it... but that is already configurable.

The issue is that in some 'situations' the specab functionality is just not performed... for example in-between turns (like enviro damage, armor regen, and a few other things).
It is difficult or impossible to add it there.
For example for enviro damage it is very difficult to do and I explicitly said it in the feature description that self-destruct is not supported there.
(for negative regen, I didn't investigate how difficult would it be... but my guess is also between hard and impossible)

Offline Nord

  • Commander
  • *****
  • Posts: 1740
  • The Gate is open.
    • View Profile
Then make the corpse be the timed grenade, allready primed.

Offline Yankes

  • Commander
  • *****
  • Posts: 3309
    • View Profile
Corpse cannot have grenade type as this make holes in recovery logic, but on other hand we could allow corpses to explode same as grenades :D
We could consider specab a precedent of this feature.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
1/ Don't know about negative health regen.

2/ For enviroEffect it is not possible.
Here are the limitations for enviroEffects:

Code: [Select]
// Note: there are limitations, since we're not using a projectile and nobody is actually shooting
// 1. no power bonus based on shooting unit's stats (nobody is shooting)
// 2. no power range reduction (there is no projectile, range = 0)
// 3. no AOE damage from explosions (targets are damaged directly without affecting anyone/anything)
// 4. no terrain damage
// 5. no self-destruct
// 6. no vanilla target morale loss when hurt; vanilla morale loss for fatal wounds still applies though
//
// 7. no setting target on fire (...could be added if needed)
// 8. no fire extinguisher

Thank you for listing the enviroEffects: limitations.

You've saved me a lot of trial and error.

Corpse cannot have grenade type as this make holes in recovery logic, but on other hand we could allow corpses to explode same as grenades :D
We could consider specab a precedent of this feature.

If the problem is that the unit no longer exists after the 'between turn' damage then using the corpse as a way to pass the explosion data into the next turn sounds like a good solution.


You can create identical armor, one of them with desired effect, and then switch them via startingconditions.

I hadn't considered using those variables for units other than X-Com's own soldiers.

That really opens up some interesting options, thank you for pointing it out.

Spoiler:

Tinkering with this looks like its going to be a lot of fun.   8)


Then make the corpse be the timed grenade, allready primed.

Even if the corpse itself cannot be the grenade (currently) your post reminded me of a script I saw posted by Greenscarf in the [Documentation][y-script] OXCE Script examples thread.


Perhaps Greenscarf's 'Automatic Priming' script could be used to load enemy units with a pre-primed grenade that explodes on their death?

Although related its a bit off topic so as not to derail this thread I'll post a new topic in the [Modding -> Help] about using this script as a makeshift way to achieve something like the specab: 1 effect while using either enviroEffects: or decaying health. (Spawning a unit with builtInWeaponSets: that has a grenade?)

« Last Edit: September 12, 2021, 01:07:51 pm by The Martian »