Author Topic: First 2 UFOs with different races (clarified) and no mind probe (bug)  (Read 1475 times)

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Playing BOXCE but with mostly standard settings - so XC with some QoLs - no mods.

Just started the very first game.
From the time I played in the past (on XC) I remembered that at 2 pm on the 1st of Jan 2 UFOs appear - Small + Very Small. I remember that I would always see the same race in both. But today - surprise surprise - the small one is full of Floaters and the Very Small has a single Sectoid.

Is this normal / expected? I don't recall ever getting this in the original game.

To make the things more interesting the single Sectoid in the mini saucer forgot to take his Mind Probe - I thought it was guaranteed.

Does the OXC (or OXCE, or BOXCE) implement these 2 first ufos differently?

Thanks for the tips! cheers.
« Last Edit: February 01, 2024, 10:57:59 pm by krakp »

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: First 2 UFOs with different races and no mind probe
« Reply #1 on: February 01, 2024, 07:52:30 pm »
Just checked my save game (it is clear text now :-) - and indeed these 2 UFOs belong to 2 different missions: Terror and Research. So it actually could be expected that I may have different races.

However, the missing Mind Probe is still a mystery.  I checked alienDeployments.rul and each of the item sets contains the Probe:

- type: STR_SMALL_SCOUT
    data:
      - alienRank: 5
        lowQty: 1
        highQty: 1
        dQty: 0
        percentageOutsideUfo: 50
        itemSets:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_PLASMA_PISTOL_CLIP
            - STR_MIND_PROBE
          -
            - STR_PLASMA_RIFLE
            - STR_PLASMA_RIFLE_CLIP
            - STR_PLASMA_RIFLE_CLIP
            - STR_MIND_PROBE
          -
            - STR_HEAVY_PLASMA
            - STR_HEAVY_PLASMA_CLIP
            - STR_MIND_PROBE
    width: 40
    length: 40
    height: 4


My Sectoid only got one Pistol and one Clip.... Can it be that there is a rule that halves the amount of items when the UFO crashes as opposed to landing?
« Last Edit: February 01, 2024, 08:04:48 pm by krakp »

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: First 2 UFOs with different races and no mind probe
« Reply #2 on: February 01, 2024, 10:44:41 pm »
OK - this seems to be a small bug :-)

I managed to reproduce it (after several attempts) on a simple Battle - chose the Small Scout, minimum Tech, Sectoid and tried several times. When the randomized item set is the one with the pistol - I get a repro (no mind probe). When one of the other sets is chosen (Rifle or H.Plasma) - the mind probe is there all right.

Seems to be a problem inside the AddItem() in BattleUnit.cpp, but I am seeing the code for the first time and not quite figuring out the logic yet. Hope that someone smarter would notice where the problem is :-)

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: First 2 UFOs with different races (clarified) and no mind probe (bug)
« Reply #3 on: February 01, 2024, 11:11:18 pm »
OK I figured it out.

It seems to be related to "smart inventory" by Xilmi.

https://github.com/Xilmi/OpenXcom/commit/0c8514d416486f3778fbacc41b5e2fb2da573c0e

The code fails when the unit is holding a one-handed weapon (in this case a plasma pistol) and a non-weapon/non-ammo equipment (mind probe here) should be added. The code then (rightfully) calculates that the shortest way to the right hand is the left hand, skips the checks for 2 handed weapons (pistol is one handed) and then fails because the hand is not an inventory slot. I have no idea why the code would not want to give it to the left hand (why the check for the INV slot) - the code is a bit too complex to understand on the first read.

I would assume it to fail in a similar way for many different configs with one-handed weapons and "other" equipment, but it is still a very much corner case :-), Funny that I came across it.

@Xilmi - let me know if you should have issues with the repro.

PS. Just noticed another small bug - the cost calculation is getting the minimum of the right hand twice - I guess it should be comparing both the hands, right?
« Last Edit: February 01, 2024, 11:13:22 pm by krakp »

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 641
    • View Profile
Re: First 2 UFOs with different races (clarified) and no mind probe (bug)
« Reply #4 on: February 02, 2024, 10:39:38 am »
Interesting find.
When I read the first few posts, I thought "there's now way my changes cause this".
I'll have to look at why putting it in the hand when it is free doesn't work for aliens. I would have thought that the hand is indeed an inventory-slot, so it's weird to fail saying it's not. I thought I tested it with soldiers. But maybe alien-inventory is treated somehow differently.
« Last Edit: February 02, 2024, 10:42:51 am by Xilmi »

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: First 2 UFOs with different races (clarified) and no mind probe (bug)
« Reply #5 on: February 02, 2024, 12:24:29 pm »
Switching off your auto equip, the Mind Probe is there. So this seem to be indeed your code :-) (was also a surprise to me).

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 641
    • View Profile
Re: First 2 UFOs with different races (clarified) and no mind probe (bug)
« Reply #6 on: February 02, 2024, 08:57:52 pm »
It's fixed for the next version.

But gotta check whether my fix has unintended side-effects.

Offline krakp

  • Captain
  • ***
  • Posts: 66
    • View Profile
Re: First 2 UFOs with different races (clarified) and no mind probe (bug)
« Reply #7 on: February 02, 2024, 09:50:04 pm »
I can confirm that it works for my scenario - my sectoid got the probe back - thanks :-). The fix looks very reasonable, even though I am not quite sure why the check for the INV slot was there in the first place.

Anyway - thanks for the quick reaction Xilmi. Have a nice weekend!