Author Topic: [Suggestion] Medikit Priority  (Read 6014 times)

Offline Delian

  • Commander
  • *****
  • Posts: 507
    • View Profile
[Suggestion] Medikit Priority
« on: April 30, 2021, 03:50:41 pm »
Currently, if there are multiple units that are stunned on the ground on the same tile, you are unable to choose which one you wish to use a medikit on. This is problematic because, if there's one unit bleeding and about to die, you are unable to save them because, well, the medikit decided that it wants you to heal a perfectly healthy unit instead.

So, I'd like to suggest to either customize the medikit target selection, or fix the way in which the medikit prioritizes its target. I can think of several possible solutions, ordered by difficulty of implementation:
1. Add a button to the medikit usage screen that would allow the player to cycle through the targets, similar to how you can cycle between units in the inventory screen.
2. If the target is ambiguous, first show a dialogue that would allow the player to choose which unit to use the medikit on.
3. Use the medikit on the unit that is closest to dying. Calculate how many turns it would take for each unit to die and choose the one that has the lowest number.
4. Use the medikit on the first bleeding unit (if it exists, otherwise default behavior).
« Last Edit: April 30, 2021, 05:12:57 pm by Delian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #1 on: April 30, 2021, 03:55:03 pm »
0. move the unit one tile away

Offline Delian

  • Commander
  • *****
  • Posts: 507
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #2 on: April 30, 2021, 04:32:20 pm »
Takes TU and a free hand (which you generally won't have with a medikit there). So you gotta store the medikit item, pick up the body, move, drop the body, move the medikit back in the hand, and have the TU left to heal the unit. Not very practical.
« Last Edit: April 30, 2021, 04:39:06 pm by Delian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #3 on: April 30, 2021, 04:40:40 pm »
Sounds fair to me.

TU cost is not so big... around 30 TU? (pick up + one step + drop)
Medikit is on your belt normally, not in a hand, until you need it.

But most importantly, the vast majority of units will fall unconscious on different tiles.
Having units on the same tile is a rare exception.

Unless you carry them to the same tile manually... in which case, it's your own fault, right?

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #4 on: April 30, 2021, 04:53:53 pm »
Unless you carry them to the same tile manually... in which case, it's your own fault, right?
What if you tried to heal a wounded unconcious unit and then got shot, so your soldier falls unconcious ontop of an unconcious unit? Then your next soldier tried to pick up said unit to heal it, but also got shot?  ::)

Offline Delian

  • Commander
  • *****
  • Posts: 507
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #5 on: April 30, 2021, 05:01:07 pm »
Quote
Having units on the same tile is a rare exception.
Perhaps if we're talking about player units. But it's quite common if we're talking about enemies which you downed with reaction fire, and you'd like to bring more of them home alive. Lives are important, right? :)

Quote
Sounds fair to me.
It's... not fair. If you have two bodies lying on the ground, doesn't it make logical sense that you'd know which one you want to heal? Am I really asking for something unreasonable? Every TU matters.

Currently, the medikit default target a unit with the lowest id, right? Would it really be too difficult to change that to the solution 4?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #6 on: April 30, 2021, 05:43:36 pm »
Perhaps if we're talking about player units. But it's quite common if we're talking about enemies which you downed with reaction fire, and you'd like to bring more of them home alive. Lives are important, right? :)

Depends on your playstyle I guess.
For me, it is super-uncommon to have multiple enemies on the same tile.
I just leave enemies lying where they were shot, I never felt the need to stockpile them anywhere in the last 26 years.
It also costs tons of TUs. Every TU matters, right?
The cleanup crew will get them at the end of the mission automatically, you don't need to carry them back to the craft (or anywhere else).

It's... not fair. If you have two bodies lying on the ground, doesn't it make logical sense that you'd know which one you want to heal? Am I really asking for something unreasonable? Every TU matters.

I was talking about the action cost being fair.

But if you open the topic of two units being on the same spot... that also doesn't make logical sense. If there's barely enough space in one tile for one standing unit... logically there should be barely enough space for one or maybe two unconscious/dead units there as well.

And those two bodies on the floor would most likely be on top of each other (purely caused by lack of space)... so if you wanted to heal the bottom one, you'd need to push the top one away (to the next tile) anyway.

Would it really be too difficult to change that to the solution 4?

All four options are easy to do.

I just like the fifth option the most as it makes the most sense to me.

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #7 on: April 30, 2021, 06:37:20 pm »
Well, you can make the body in the medic's hands the priority target for the first aid kit.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #8 on: April 30, 2021, 06:47:58 pm »
Well, you can make the body in the medic's hands the priority target for the first aid kit.
I think this is reasonable suggestion, this will not require lot of code and should fix most of cases left.
Then final order should be:
Hands -> Front -> Ground -> Self?

Offline Delian

  • Commander
  • *****
  • Posts: 507
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #9 on: April 30, 2021, 07:01:29 pm »
Quote
I just leave enemies lying where they were shot.
How cruel :'( Well, so do I haha, but for me it's common because I like to use the strategy of camping the choke points. Either with firearms or melee weapons. I don't usually waste TUs moving the bodies unless it's important for their survival, because every TU matters, but they still often end up on top of one another. It's interesting to hear that you haven't used such a strategy, but please don't let your personal bias disreagard other player's playstyle preferences.

Quote
logically there should be barely enough space for one or maybe two unconscious/dead units there as well
If it wasn't possible to have more than one body on a single tile, then we wouldn't be having this conversation now, would we? :D

Quote
so if you wanted to heal the bottom one, you'd need to push the top one away
Alas, the game logic tells us that each tile has infinite amout of space and that bodies and items have no volume.

Anyway, if we have a hundred different items on a tile, we're able to precisely pick out the item that we want, without needing to carry it to a different tile first.
The point is, it's logically inconsistent that we're able to choose which body we want to carry, but not choose which body we want to use a medikit on. And I'd love it if you could help me here~

Well, you can make the body in the medic's hands the priority target for the first aid kit.
That would be a step in the right direction, however it wouldn't be a good solution to the problem. You'd still need to spend TU picking up the body, but now you'd need both hands free. Freeing up both hands would take more TU than it would take to use one hand to relocate the body.

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #10 on: April 30, 2021, 08:56:23 pm »
Hands -> Front -> Ground -> Self?

Yes, this is a good solution.

That would be a step in the right direction, however it wouldn't be a good solution to the problem. You'd still need to spend TU picking up the body, but now you'd need both hands free. Freeing up both hands would take more TU than it would take to use one hand to relocate the body.

Reduce the time spent using the first aid kit.

Offline BlackStaff

  • Colonel
  • ****
  • Posts: 336
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #11 on: April 30, 2021, 09:16:03 pm »
0. move the unit one tile away
Yes, I like this solution too.
And in 27 years I have never wasted a dose of care for a little grey (or red... or green...)!  ;D   8)

Offline spawi

  • Sergeant
  • **
  • Posts: 24
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #12 on: May 15, 2021, 12:07:06 pm »
+1 for this feature. Not so infrequently I end up piling up stunned enemies in one tile, with my soldier standing guard. Note I also use the handcuffs script, as I play X-COM Files.

Sometimes one of the stunned enemies wakes up, I over-stun him, and now I want to apply medikit, but I cannot do it easily due to the discussed restrictions.

Offline Delian

  • Commander
  • *****
  • Posts: 507
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #13 on: March 20, 2022, 05:14:32 pm »
I'd like to add that in the TileEngine::validMeleeRange(), you already have a comment that says:
Code: [Select]
// or, if we're using a medikit, prioritize whichever friend is wounded the most.

So there was supposed to be some prioritizing? But this is bugged. If there are multiple unconscious units on the same tile, using medikit will usually target the wrong one. Even if there's a friendly bleeding unit among them, it's random whether it will be selected by the medikit or not.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: [Suggestion] Medikit Priority
« Reply #14 on: March 20, 2022, 05:33:36 pm »
I'd like to add that in the TileEngine::validMeleeRange(), you already have a comment that says:
Code: [Select]
// or, if we're using a medikit, prioritize whichever friend is wounded the most.

Not sure if you're talking about me, or somebody else.
In case you mean me, I have not added that comment.

Try asking OXC devs.

Anyway, the function returns just a bool... it doesn't make any difference what target it finds.

So there was supposed to be some prioritizing? But this is bugged. If there are multiple unconscious units on the same tile, using medikit will usually target the wrong one. Even if there's a friendly bleeding unit among them, it's random whether it will be selected by the medikit or not.

Don't know, ask OXC devs: https://github.com/OpenXcom/OpenXcom/commit/6e0aeb3ee4f2cda58ca175b631d778ca4a2c67d8