aliens

Author Topic: (Brutal AI) Accuracy tweak via submod or by changing game files  (Read 861 times)

Offline Istvaan 3

  • Squaddie
  • *
  • Posts: 2
    • View Profile
(Brutal AI) Accuracy tweak via submod or by changing game files
« on: November 15, 2024, 02:29:24 pm »
Hello everyone! I'm new to BOXCE modding.
Recently I found this (github.) /Xilmi/OpenXcom/blob/oxce-plus/src/Battlescape/Projectile.cpp, this file (along with OpenXcom/src/Battlescape/Projectile.h) contains variables (From line 38 in projectile.cpp) used to configure accuracy for RA. Is it possible to modify them in some way? I have already tried to change them by creating scripts but have failed (Mostly copied existing scripts and tried to implement changes in this variables).
Can anyone help me and point out how to change accuracy in the game (If it's possible)?

Code from github (Projectile.cpp), lines 36 to 53
namespace OpenXcom
{
AccuracyModConfig AccuracyMod = {
   1,      // MinCap         Minimum accuracy value
   300,   // MaxCap         Maximum accuracy value
   3,      // AimBonus         For aimed shot if total accuracy is 5% or less
   2,      // KneelBonus      For kneeling if total accuracy is 5% or less
   4,      // aimedDivider
   3,      // snapDivider
   3,      // autoDivider      Dividers are used for adding roll-based deviation
   1,      // twoHandsBonus   Less shots dispersion for one weapon in both hands
   3,      // distanceDivider   Additional 1 voxel of deviation per this number of distance tiles
   1.35,   // SizeMultiplier   Accuracy multiplier when targeting big units
   50,      // suicideProtectionDistance   // Minimal distance missing shot should fly, in voxels
   10,      // bonusDistanceMax   Improved accuracy distance - top threshold
   6,      // bonusDistanceMin   Improved accuracy distance - bottom threshold
   {0, 30, 50, 70, 100} // coverEfficiency Percentage of accuracy affected by target exposure
};

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9230
    • View Profile
Re: (Brutal AI) Accuracy tweak via submod or by changing game files
« Reply #1 on: November 15, 2024, 03:03:34 pm »
Moved to Brutal AI board.

Offline jnarical

  • Captain
  • ***
  • Posts: 81
    • View Profile
Re: (Brutal AI) Accuracy tweak via submod or by changing game files
« Reply #2 on: December 12, 2024, 01:08:18 am »
Hello everyone! I'm new to BOXCE modding.
Recently I found this (github.) /Xilmi/OpenXcom/blob/oxce-plus/src/Battlescape/Projectile.cpp, this file (along with OpenXcom/src/Battlescape/Projectile.h) contains variables (From line 38 in projectile.cpp) used to configure accuracy for RA. Is it possible to modify them in some way? I have already tried to change them by creating scripts but have failed (Mostly copied existing scripts and tried to implement changes in this variables).
Can anyone help me and point out how to change accuracy in the game (If it's possible)?

I wasn't checking the forum for quite a while, as like as participating in BOXCE development - real life takes its toll...
As for your question - it wasn't meant to be changed by users, but it would be useful to make those values available for modding... I just don't know how, this idea never came to my mind, honestly. I'll look into it.

Offline Istvaan 3

  • Squaddie
  • *
  • Posts: 2
    • View Profile
Re: (Brutal AI) Accuracy tweak via submod or by changing game files
« Reply #3 on: January 05, 2025, 10:22:58 am »
The temporal solution I found for it is to use a script that increases the overall accuracy stat for each unit. It's quite crude, but still works.
Code: [Select]
extended:

  scripts:
    createUnit:
      - offset: 1
        code: |
          unit.Stats.addFiring 100;

          return;
When I'll learn more advanced coding/scripting, there may be an option to multiply firing stats, like multiply twice for each unit.

Offline jnarical

  • Captain
  • ***
  • Posts: 81
    • View Profile
Re: (Brutal AI) Accuracy tweak via submod or by changing game files
« Reply #4 on: January 05, 2025, 01:09:27 pm »
The temporal solution I found for it is to use a script that increases the overall accuracy stat for each unit. It's quite crude, but still works.
...
When I'll learn more advanced coding/scripting, there may be an option to multiply firing stats, like multiply twice for each unit.
That way, you can change either base or final RA-modified accuracy, but not any internal numbers for intermediate calculations.