aliens

Author Topic: [FIXED] Inconsistent loot received after mission if last enemy bleeds out  (Read 2211 times)

Offline DSeyka

  • Sergeant
  • **
  • Posts: 43
    • View Profile
So depending on whether last enemy is killed or bleeds out, the loot recovered after missions is different. Using OpenXcom Extended 7.12.8 (v2024-05-18).
Save game is provided, the only relevant mod is X-Com Files (I'm using the latest master version from https://github.com/SolariusScorch/XComFiles/archive/refs/heads/master.zip)
To reproduce:

1. Load saved game.
2. Shoot the anthropod with an aimed rifle shot with the active soldier (Leonel Pagano /T).
3. Note the received loot (1x Disruptor Rifle, 1x Heavy Disruptor, 3x Anthropod Corpse).
4. Load saved game again.
5. End the turn.
6. Note the received loot (1x Disruptor Rifle, 1x Acid Bolt, 2x Anthropod Corpse).

I also did not receive a live Anthropod which I assume I should have, unless it overbled or something? But I'd expect to receive a corpse and its equipment anyway in that case.
Thanks for your time.
« Last Edit: May 30, 2024, 11:03:09 am by DSeyka »

Online Delian

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #1 on: May 30, 2024, 12:45:55 pm »
Both Heavy Disruptor and Acid Bolt are consumables. Thus, they're affected by the "Statistical Bullet Conservation" optional feature. What you're experiencing is not a bug, but normal randomness in regards to recovering consumables.

Offline DSeyka

  • Sergeant
  • **
  • Posts: 43
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #2 on: May 30, 2024, 12:48:21 pm »
I see. Why does the corpse disappear in second case though?

Online Delian

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #3 on: May 30, 2024, 12:50:55 pm »
Maybe because you used too strong of a weapon and vaporised it.

Offline DSeyka

  • Sergeant
  • **
  • Posts: 43
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #4 on: May 30, 2024, 12:54:55 pm »
Second test case is just ending the turn and letting the alien bleed out. Should overbleeding be able to vaporize a corpse?

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #5 on: May 30, 2024, 03:45:11 pm »
Yeah, something seems off here. I tried, and if you let the third Anthropod bleed out, you never get their corpse or the big gun. But you do get both if you shoot the alien in the face. Sometimes the Acid Bolt disappears, as explained by Delian.

Not sure if it matters that the save was made via BOXCE. The end result is identical with both BOXCE 8.5.4 and plain OXCE 7.12.8.

Offline zRrr

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #6 on: May 30, 2024, 03:55:57 pm »
This is most likely a game issue.

Normaly, when a unit loses enough hp/gains stun to drop, game starts falling animation, at the end of which unit is marked as dead/unconcious, corpse is created and items drop from inventory. When battle ends, animation does not get to play, but this is known behaviour, and debriefing screen handles unmarked but dead units in a same way, so it is all good.

However XCF uses enviro effects. Even if they are not defined for hostiles and neutrals, they still cause another checkForCasualties run with parameters, that cause units to be marked as dead instantly as a side effect. So debriefing does not get to do it's thing.

Setting ecEnabledHostile and ecEnabledNeutral to false in save will give third corpse and heavy disruptor as a loot.
Setting globalChance: 0 for hostile and neutral environmentalConditions for all enviro effects in mod is possible, if quick fix is required.


Also, thank you Meridian and Yankes for maintaining the game. This is seriously complicated.


Offline DSeyka

  • Sergeant
  • **
  • Posts: 43
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #7 on: May 30, 2024, 06:02:13 pm »
Nice find, zRrr! This does indeed seem like the cause of issue. Reported to mod author, feel free to close this thread if this is deemed a content (non-engine) issue.
« Last Edit: May 30, 2024, 06:07:35 pm by DSeyka »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #8 on: June 02, 2024, 10:27:19 pm »
Actually, this doesn't seem like a mod issue. Please correct me if I'm wrong, but I can't see how I could fix it on my end... Maybe with stupidly extensive armour lists in enviro effects, but I can't say I understand the problem well.

Online CrazedHarpooner

  • Colonel
  • ****
  • Posts: 101
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #9 on: June 02, 2024, 11:35:03 pm »
By what I've understood from zRrr's explanation, the workaround rather than a fix that you can implement is to add
Code: [Select]
      STR_HOSTILE:
        globalChance: 0
      STR_NEUTRAL:
        globalChance: 0
to every single enviroEffects you've defined, under the environmentalConditions parameter, before or after the definition for STR_FRIENDLY.

With this said, I agree that this appears to be more an issue with how these effects are being handled and is not exclusive to this mod, but to any that uses enviroEffects. If the issue is as described, the workaround will work for your mod because you don't define any effects for those two factions and thus we can "disable" them without losing any of the mod's features.

As for what's happening, again based on zRrr's explanation and my understanding of it and the topic's title, is that when the last standing hostile unit dies from bleeding, probably from other DoT too, and environment effects are active, that part of the code will mark said unit as dead, but is not performing the part where a corpse item is generated nor is it dropping the unit's items to the ground effectively vanishing from the debriefing. If this is the case, this could happen with more than one unit, but rarely since they would all have to die on the same turn. When the game ends the mission without the environment effects it handles this last death properly by generating the corpse (or capture if it fell unconcious) and all of its equipment.
« Last Edit: June 02, 2024, 11:50:58 pm by CrazedHarpooner »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: Inconsistent loot received after mission if last enemy bleeds out
« Reply #10 on: August 25, 2024, 05:56:51 pm »
This is most likely a game issue.

Normaly, when a unit loses enough hp/gains stun to drop, game starts falling animation, at the end of which unit is marked as dead/unconcious, corpse is created and items drop from inventory. When battle ends, animation does not get to play, but this is known behaviour, and debriefing screen handles unmarked but dead units in a same way, so it is all good.

However XCF uses enviro effects. Even if they are not defined for hostiles and neutrals, they still cause another checkForCasualties run with parameters, that cause units to be marked as dead instantly as a side effect. So debriefing does not get to do it's thing.

Setting ecEnabledHostile and ecEnabledNeutral to false in save will give third corpse and heavy disruptor as a loot.
Setting globalChance: 0 for hostile and neutral environmentalConditions for all enviro effects in mod is possible, if quick fix is required.


Also, thank you Meridian and Yankes for maintaining the game. This is seriously complicated.

Fixed this corner case here: https://github.com/MeridianOXC/OpenXcom/commit/37466af118041d8175bf7a43f5a15f5da6e84225

But Debriefing is death and there are for sure more bugs lurking in the shadows.