aliens

Author Topic: [Answered] 100% chance of a unit catching on fire?  (Read 2406 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
[Answered] 100% chance of a unit catching on fire?
« on: June 02, 2020, 07:42:02 pm »
I've been trying to use FireThreshold: to make an explosion that sets struck units on fire 100% of the time if they are in the blast radius.

But I have been unsuccessful.

From what I've read on the UFOpaedia's Incendiary section it appears that the chance of igniting a unit is random:
Quote
Initial "impact" damage from incendiary ammunition is either for no points (unit does not catch fire), or between 5-10 points (unit catches fire). Since the distribution is randomly chosen from the set [ 0, 5, 6, 7, 8, 9, 10 ] (seven values), the probability of remaining unharmed is 14% (1/7), while there is an 86% chance (6/7) a unit will take some damage. The average damage is 6.4.

Is there a way to make a weapon that always ignites the unit it strikes?
« Last Edit: February 12, 2023, 09:40:16 am by Meridian »

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: (OXCE) 100% chance of a unit catching on fire?
« Reply #1 on: June 02, 2020, 08:00:12 pm »
Script onHit checking for that particular weapon and then adding the fire status.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8595
    • View Profile
Re: (OXCE) 100% chance of a unit catching on fire?
« Reply #2 on: June 02, 2020, 08:07:09 pm »
Script onHit checking for that particular weapon and then adding the fire status.

There is no such thing. Why do you blindly guess?

But I have been unsuccessful.

Share what you got so far?

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: (OXCE) 100% chance of a unit catching on fire?
« Reply #3 on: June 02, 2020, 09:44:57 pm »
First I tried using a slightly altered Incendiary Grenade from the Final Mod Pack without damageAlter: and FireThreshold: being used.

Code: [Select]
  - type: STR_EXAMPLE_GRENADE_1
    size: 0.1
    costBuy: 250
    costSell: 200
    weight: 3
    bigSprite: 690
    floorSprite: 689
    handSprite: 3016
    power: 90
    damageType: 2
    battleType: 4
    armor: 20
    blastRadius: 6
    attraction: 6
    listOrder: 11500
    categories:
      - STR_CAT_ALL_EQUIPMENT
      - STR_CAT_EXPLOSIVE_EQUIPMENT

As you can see in these screenshots four of the soldiers are not set on fire by the blast.
Spoiler:



Then I used damageAlter: to set FireThreshold: to 1 and reduced the power: to 10 as I mostly just want this to set units on fire not damage them directly.

Code: [Select]
  - type: STR_EXAMPLE_GRENADE_2
    size: 0.1
    costBuy: 0
    costSell: 12000
    weight: 3
    bigSprite: 689
    floorSprite: 688
    handSprite: 3008
    power: 10
    damageType: 2
    battleType: 4
    blastRadius: 5
    damageAlter:
      ToHealth: 0.0
      ToTime: 0.0
      ToEnergy: 0.0
      ToStun: 0.0
      RadiusReduction: 0.0
      ToTile: 0.1
      ArmorEffectiveness: 1.0
      ToWound: 0.0
      RandomType: 3
      ToArmor: 0.0
      FireThreshold: 1
      TileDamageMethod: 2
    listOrder: 11100
    categories:
      - STR_CAT_ALL_EQUIPMENT
      - STR_CAT_EXPLOSIVE_EQUIPMENT

This time twelve of the soldiers did not catch on fire from the blast.
Spoiler:



After reading the UFOpaedia I tried a negative value on FireThreshold: of -100 in the hope that even if the damage rolled 0 the threshold for igniting a unit would be lower and thus produce guaranteed results.

Code: [Select]
  - type: STR_EXAMPLE_GRENADE_3
    size: 0.1
    costBuy: 0
    costSell: 12000
    weight: 3
    bigSprite: 688
    floorSprite: 687
    handSprite: 3000
    power: 10
    damageType: 2
    battleType: 4
    blastRadius: 5
    damageAlter:
      ToHealth: 0.0
      ToTime: 0.0
      ToEnergy: 0.0
      ToStun: 0.0
      RadiusReduction: 0.0
      ToTile: 0.1
      ArmorEffectiveness: 1.0
      ToWound: 0.0
      RandomType: 3
      ToArmor: 0.0
      FireThreshold: -100
      TileDamageMethod: 2
    listOrder: 11100
    categories:
      - STR_CAT_ALL_EQUIPMENT
      - STR_CAT_EXPLOSIVE_EQUIPMENT

This time another four of the soldiers did not get set on fire.
Spoiler:



I'm not sure if the chance to ignite a unit rolls for each point of damage equal and above FireThreshold: or if it just checks to see if the value has been met and then rolls the check one time.


If it is possible what I'd like the item to do is cause no HP loss to the units struck with it, but always cause all units in the explosion radius to be set on fire.
« Last Edit: June 02, 2020, 09:47:03 pm by The Martian »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1931
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: (OXCE) 100% chance of a unit catching on fire?
« Reply #4 on: June 02, 2020, 10:02:19 pm »
There is no way to get 100% chance to ignite. The code for determining if a unit lights on fire is this:

Code: [Select]
if (adjustedDamage >= type->FireThreshold)
{
float resistance = target->getArmor()->getDamageModifier(type->ResistType);
if (resistance > 0.0)
{
int burnTime = RNG::generate(0, int(5.0f * resistance));
if (target->getFire() < burnTime)
{
target->setFire(burnTime); // catch fire and burn
}
}
}

Once the FireThreshold is passed, there is still a RNG roll based on the unit's resistance to the damage time, and it will always has a chance of rolling a zero.

Edit: On a side note, reducing the ToHealth value looks like it will reduce adjustedDamage in the formula above, lowering the chance of getting over the FireThreshold.
« Last Edit: June 02, 2020, 10:05:16 pm by ohartenstein23 »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8595
    • View Profile
Re: (OXCE) 100% chance of a unit catching on fire?
« Reply #5 on: June 02, 2020, 10:04:22 pm »
ninjad :)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: (OXCE) 100% chance of a unit catching on fire?
« Reply #6 on: June 02, 2020, 10:22:02 pm »
Thank you for the help.