Author Topic: [Solved] no eXPerience for hitting downed enemies  (Read 601 times)

Offline Dioxine

  • Commander
  • *****
  • Posts: 5488
  • punk not dead
    • View Profile
    • Nocturnal Productions
[Solved] no eXPerience for hitting downed enemies
« on: April 13, 2025, 02:09:36 pm »
Well, exactly what it say in the title. You should not be rewarded with XP for beating up defenseless opponents. OXCE option to disable XP for hitting enemies who are down, and maybe another to disable XP for hitting enemies (and reacting to enemies) who already are flagged for surrender (even if they are flagged as never surrendering, if possible). These two are the most typical exploits (shoot enemies on the ground with non-lethal weapons, or those which can't break their armor; or wake enemy up, stun, repeat). This suggestion is simply for XP ticks manipulation, I'm not talking about stuff like Commendations, this would be separate topic.

Online Delian

  • Commander
  • *****
  • Posts: 706
    • View Profile
Re: [Suggestion] no eXPerience for hitting downed enemies
« Reply #1 on: April 13, 2025, 04:28:20 pm »
I would agree with attacking the bodies on the ground not rewarding exp, but as long as the enemy is standing, I think it's fair to reward exp.

What's the difference between shooting at a wall and shooting at an enemy? Logically, both can be considered as "target practice". But the difference is that, the enemy is a moving target, and the wall is not. So based on this logic, it makes sense that, even if the enemy is standing, surrendering or not, it's considered a moving target, and thus should reward exp.

In practice, does it even matter? In the end, the player wastes a lot of personal time just to decrease the amount of missions it takes to reach unit's stat caps. So like, out of hundreds, maybe even thousands of missions a unit will participate in, between reaching trainingStatCaps and statCaps, only the first 15 or so are the ones where the stats are increasing, so >95% of the game the exp gain is irrelevant. So does it even matter whether a unit reaches stat caps in 10 missions instead of 20?

But yeah, I think attacking the enemies on the ground is just too easy and is, how should I say, it's got the the biggest bang for the buck, because a player doesn't need to TOIL LIKE A WORM trying to max out a unit's exp when hitting downed enemies so easy.

Offline ontherun

  • Colonel
  • ****
  • Posts: 480
  • public troll no. 1
    • View Profile
Re: [Suggestion] no eXPerience for hitting downed enemies
« Reply #2 on: April 13, 2025, 04:50:00 pm »
+1

but that would conunt as killed enemy? And some commenda tions require a certain number of wasted enemies, so that should not apply to commenndation award system?

Offline Dioxine

  • Commander
  • *****
  • Posts: 5488
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [Suggestion] no eXPerience for hitting downed enemies
« Reply #3 on: April 15, 2025, 03:25:13 am »
Stunned enemy can be easily changed into an unstunned & unarmed enemy, I seen that being done to a single enemy 20 times in one round on one stream (stun, revive, stun, revive) argument about 'shooting wall' not valid. By the same token you currently don't get XP for hitting neutrals or friendlies despite them not being 'walls'.

However, I have to agree that removing XP for shooting panicking enemies would be too much. It would be taking away too much fun (and it'd be unfair, you don't have control over enemy panic in normal circumstances, and even in fully controlled environment there is no full control, AFAIK unit at 0 Morale is not guaranteed to panic), so perhaps make an enemy unviable for XP gains only from the moment they get KO'd (and for the rest of the battle since KO).

I will reiterate again this is only about XP, not commendations. These are a separate topic. However I do think that getting multiple stun commendations for a single enemy is wrong. Otherwise this change should not influence commendations in any way. A kill is a kill, you get award for enemy kills (or civilian, or friendly, which there is no XP for) not fighting the enemy.

About toiling or not toiling, this is not really relevant IMO. I just think that game should limit opportunities to gain XP from not actually fighting, because that breaks immersion. And also when we request and add new OXCE features, like shooting bodies on the ground, we should take responsibility to bring up other related mechanics to date with them, so the new feature enhances gameplay without creating excessive exploits.

Online Delian

  • Commander
  • *****
  • Posts: 706
    • View Profile
Re: [Suggestion] no eXPerience for hitting downed enemies
« Reply #4 on: April 15, 2025, 08:29:51 pm »
you currently don't get XP for hitting neutrals or friendlies

And I find that to be unrealistic hehe. There's no logical reason why shooting friendlies or neutral units shouldn't award exp, and you already get punished with negative score if you do that.

I seen that being done to a single enemy 20 times in one round on one stream

That looks like an exploit, right? But is it really?
1. Only the small minority of players use the revive+stun training tactic, because it's a huge waste of their personal time. I've also seen JS+SM streams where players were whipping downed enemies, but other than that, practically no one was reviving enemies for exp. If this was a highly-beneficial exploit, then a lot of people would be using it.
2. It's costly. It's not free, because you consume freshness every turn, lose glamour, and there's a chance of the stunned enemies dying. It's also not 100% safe, beause there are still live enemies on the map, while your units lose morale. You may end up with your panicking units running somewhere and getting shot, or the stunned enemies waking up and you not having anyone nearby to stun them again. I've seen players fooling around and getting burned this way.
3. The few perfectionistic players that use the training tactic do have a lot of fun doing that. You'd be taking away their fun, and prevent them from achieving... what? Reaching stat caps faster? If reaching stat caps fast is a problem, there are other ways to mod that.
4. It's inconsequential. As I mentioned before, the majority (>95%) of the game is played after units reach the stat caps. Your perception may be skewed if you only look at streams of people playing the early game.
5. It's not immersion-breaking. What is immersion and how does it get broken? In this context, we're talking about the consistency of game mechanics. A player will have their immersion broken if a game mechanic is bugged, inconsistent, or otherwise unpredicatable to the player. The player will have their game engagement disrupted if they find a game mechanic to feel unrealistic, unnatural or forced.

Shoot at a target to get exp
Shoot at a unit to get exp
Shoot at a unit and hit it to get exp
Shoot at an enemy unit and hit it to get exp
Shoot at a standing enemy unit and hit it to get exp
Shoot at a standing enemy unit that hasn't yet been unconscious and hit it to get exp

The more conditions you add, the less realistic a particular game mechanic becomes. Does that make sense?
Of course, a game doesn't need to be immersive to be fun to play. People who play on JS+SM play it for the challenge, and the type of fun you get from beating a hard challenge is completely different than the one you get from experiencing a deep story.
Would making this change (preventing revive+stun training) make the mod more fun to play? For me personally, it would make it a lot less fun. At the same time, I don't see what sort of game balancing benefits are there. It wouldn't make any missions easier or harder. Especially in the early game, it feels like a good tradeoff to sacrifice freshness and glamour for extra soldier exp. Does this tradeoff break the game balance in some way?
« Last Edit: April 15, 2025, 11:01:08 pm by Delian »

Offline zRrr

  • Sergeant
  • **
  • Posts: 39
    • View Profile
Re: [Suggestion] no eXPerience for hitting downed enemies
« Reply #5 on: April 17, 2025, 04:00:47 am »
Quote
so perhaps make an enemy unviable for XP gains only from the moment they get KO'd (and for the rest of the battle since KO).

While this attempt to force everyone to keep hands above the covers is silly, feature as quoted above can be done with scripts. I've also added similar treatment of mindcontrolled enemies and broke/fixed melee medikits, which won't give xp for friendly bonking with this script. Side effects include less XP for AoE vs large and shotguns than in unmodded game, when unit gains enough stun before all hits are resolved, but that fits request as written.

Code: [Select]
extended:
  tags:
    BattleUnit:
      IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL: int
     
  scripts:
    newTurnUnit:
      - new: IXP_CHECK_IF_HOSTILE_IS_UNDER_MIND_CONTROL
        offset: -99
        code: |
          #
          # Hitting MC'd enemy unit does not give xp, and since they can't be uncontrolled until next faction half-turn,
          # change of half-turns is as good as anything to detect MC
          #
         
          var int currentFaction;
          var int originalFaction;
         
          unit.getFaction currentFaction;
          unit.getOriginalFaction originalFaction;
         
          if and eq originalFaction FACTION_HOSTILE
                 neq currentFaction FACTION_HOSTILE;
            unit.setTag Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL 2;
          end;
         
          return;
         
    damageSpecialUnit:
      - new: IXP_CHECK_IF_HOSTILE_UNIT_WILL_BE_STUNNED
        offset: 99 # need this to run last
        code: |
          # call order:
          #   hitUnit
          #   damageUnit
          #   damageSpecialUnit
          #   awardExperience
          #
          # so first attack that does stun need to give xp, but nothing after that
          #
         
          var int unitOriginalFaction;
          var int xpBlockLevel;
         
          #check if this is inflicted by player and not enviro/traps?
          #debug_log "IXP:::  damageUnitSpecial, unit:" unit;
         
          unit.getOriginalFaction unitOriginalFaction;
          if neq unitOriginalFaction FACTION_HOSTILE;
            return;
          end;
         
          unit.getTag xpBlockLevel Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL;
         
          if eq xpBlockLevel 1;
            #debug_log "IXP:::      unit was previously stunned, xp block <- 2";
            unit.setTag Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL 2;
          else eq xpBlockLevel 0;
            var int unitHealth;
            var int unitStun;
           
            unit.getHealth unitHealth;
            unit.getStun unitStun;
           
            #debug_log "IXP:::      hp:" unitHealth ", stun:" unitStun;
         
            # from BattleUnit::isOutThresholdExceed
            #   return getHealth() <= 0 || getHealth() <= getStunlevel();
            if le unitHealth unitStun;
              unit.setTag Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL 1;
            end;
          end;
         
          return;
     
    awardExperience:
      - new: IXP_NO_XP_FOR_YOU
        offset: 1
        code: |
          var int targetCurrentFaction;
          var int targetOriginalFaction;
          var int weaponIsMedikit 0;
          var int xpBlockLevel 0;
         
          #debug_log "IXP:::  awardExperience for unit:" unit;
           
          if eq experience_multipler 0;  # already no xp for this action, exit
            return 0;
          end;
         
          unit.getFaction targetCurrentFaction;
          unit.getOriginalFaction targetOriginalFaction;
         
          begin; # set weaponIsMedikit
            var ptr RuleItem weaponRule;
           
            weapon.getRuleItem weaponRule;
            weaponRule.getBattleType weaponIsMedikit;
            if eq weaponIsMedikit BT_MEDIKIT;
              set weaponIsMedikit 1;
            else;
              set weaponIsMedikit 0;
            end;
          end;
         
          # allow whatever xp medikit healing awards in oxce code,
          #   it's not like player would staple poor G.O.s for extra BRA when they have nice fat regenerating hyenas available
          # but bonkin frens with medikit is not allowed (then again, rod of bliss exists)
          if eq weaponIsMedikit 1;
            if eq battle_action BA_USE;
              return experience_multipler;
            else neq targetOriginalFaction FACTION_HOSTILE;
              #debug_log "IXP:::      no xp: friendly unit hit with melee medikit";
              return 0;
            end;
            # this is melee attack on hostile with medikit
          end;
         
          if neq targetOriginalFaction FACTION_HOSTILE; # if target is not alien, this script no longer cares
            return experience_multipler;
          end;
         
          # first attack that stuns this unit set xpBlockLevel to 1
          #   later attacks upgrade it to 2
          #   being mc'd makes it 2
          # attacks against this unit only give xp if level is 0 or 1
          unit.getTag xpBlockLevel Tag.IXP_HOSTILE_UNIT_XP_BLOCK_LEVEL;
          if gt xpBlockLevel 1;
            #debug_log "IXP:::      no xp: unit was stunned or mindcontrolled before";
            return 0;
          end;
         
          return experience_multipler;
       

As immersive as repeatedly knocking terminator down gets, awarding xp based on how threatening target actually is, increases script size too much.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5488
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [Suggestion] no eXPerience for hitting downed enemies
« Reply #6 on: April 20, 2025, 05:18:33 pm »
I can't into the scripts, so I guess all I can do is being silly. Thank you, I will try this out, looks pretty comprehensive.

As for the philosophical side, well, Delian makes a lot of good points, I won't argue against these. Now as the problem is solved, I did think about why do I care, why does this piss me off. I guess it's the matter of silly principles. If one person notices and says, 'Oh, so no xp for beating up defenseless enemies? Nice', that's worth a lot to me, even if it's irrational. I myself notice games which make such attempts. Of course there is always a gray area. If I wanted to not be silly, I'd work on a game where such things were not possible at all, or embrace it fully, not try to balance the unbalanceable.
« Last Edit: April 20, 2025, 05:49:35 pm by Dioxine »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9534
    • View Profile
Re: [Suggestion] no eXPerience for hitting downed enemies
« Reply #7 on: April 20, 2025, 06:06:46 pm »
These two are the most typical exploits (
1. shoot enemies on the ground with non-lethal weapons, or those which can't break their armor;
2. or wake enemy up, stun, repeat
).

This first script removes exp for stunned enemies (fixes #1)

Code: [Select]
extended:
  scripts:
    awardExperience:
      - new: NO_EXP_WHEN_STUNNED
        offset: 1
        code: |
          var int tmp;
          unit.isStunned tmp;
          if neq tmp 0;    # unit is stunned
            return 0;
          end;
          return experience_multipler;

This second script removes exp for stunned enemies and previously stunned enemies (fixes #1 and #2)

Code: [Select]
extended:
  scripts:
    awardExperience:
      - new: NO_EXP_WHEN_AND_AFTER_STUNNED
        offset: 2
        code: |
          var int tmp;
          unit.getTurnsSinceStunned tmp;
          if lt tmp 255;   # unit was stunned in the past
            return 0;
          end;
          return experience_multipler;

...the second script doesn't work in OXCE 8.2.3, Yankes broke it few days ago, I will fix it soon, but official OXCE 8.2 is working fine
« Last Edit: April 20, 2025, 06:28:42 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9534
    • View Profile
Re: [Solved] no eXPerience for hitting downed enemies
« Reply #8 on: April 21, 2025, 09:04:59 am »
...the second script doesn't work in OXCE 8.2.3, Yankes broke it few days ago, I will fix it soon, but official OXCE 8.2 is working fine

fixed in OXCE 8.2.4

https://github.com/MeridianOXC/OpenXcom/commit/170ed61ac77f20d2a76bc79dc94c50bf8fa8d891