aliens

Author Topic: Accuracy penalty when flying [OXCE]  (Read 5442 times)

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Accuracy penalty when flying [OXCE]
« on: August 27, 2019, 04:37:13 pm »
This little mod introduces a 20% penalty to firing and 10% to throwing accuracy of some units when they are flying. The rationale is that they don't have a proper foothold, and these flying suits are bound to have some bobbing. Also, the recoil is gonna affect flying units to a greater extent than standing on something firm.

That was the "realism" reason for the mod. The gameplay reason was that I wanted to nerf the flying suit somewhat. It already makes your life a lot easier, putting you out of reach of Chryssalids.

This mod has two versions: "Flying accuracy penalty" per se and "Flying accuracy penalty Plus".

The first one affects only X-COM soldiers, but not any other units: massive hovertanks and cyberdisks are not gonna be affected by this, and neither are "natively" flying aliens, since they would have some adaptations in their motor coordination because flying is their natural means of locomotion. Also, this version should work with all flying armors, vanilla or added by mods (without the need for these mods' authors to provide compatibility), since it checks whether a soldier is flying at the moment, and if yes, it applies the penalty.

The second one can be made to interact with other mods to affect also enemies. The drawback is that by default it affects only vanilla flying suit. If you have a flying armor from some mod, it is not gonna be affected by this penalty, unless its author knew of this mod and included the needed tag in his armor rule (or unless you do it yourself). The upside is that mod authors can apply the penalty to enemy units as well as X-COM soldiers, since the check is made on a per armor basis. (See readme.txt).

Do not install both versions alongside each other!

One warning: with both versions the chance of success of psi attacks is handled by the engine as accuracy. So this mod also decreases the chance of success of psi attacks. At first I thought of inserting a condition that would exclude psi attacks from this decrease. But then I thought that mental attacks are gonna take a lot of concentration, and it's gonna be hard to concentrate on such things when you are dangling several meters above the ground supported by something like a jetpack. So the penalty for psi attacks stays :)

Many thanks to Yankes and Meridian for explanations of the script engine and correction of my mistakes!

---
Upd. Attached a new archive. It contains the "Plus" version of the mod in addition to the original.
« Last Edit: August 28, 2019, 11:24:45 am by Kzer-Za »

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11783
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Accuracy penalty when flying [OXCE]
« Reply #1 on: August 27, 2019, 07:03:38 pm »
Very interesting, I like the concept. I would be interested in adding your feature to X-Com Files.
Still, I understand that it only really applies to X-Com units and not enemies/civilians, while I'd rather do it on a per unit basis (or actually better per armour). For example I agree that Floaters or Cyberdiscs should always have the same stats, since they never really stand, but many enemy units (at least in mods) are humanoids with flying gear just like you. Would that be doable?

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: Accuracy penalty when flying [OXCE]
« Reply #2 on: August 27, 2019, 09:01:45 pm »
On a per unit basis, definitely doable; on a per armor basis, I'm doubtful. I don't see a way to get RuleArmor from BattleUnit, but I'll ask Yankes.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Accuracy penalty when flying [OXCE]
« Reply #3 on: August 27, 2019, 09:11:09 pm »
On a per unit basis, definitely doable; on a per armor basis, I'm doubtful. I don't see a way to get RuleArmor from BattleUnit, but I'll ask Yankes.

Getting RuleArmor from a BattleUnit should definitely be doable (if not already possible).
Armor is the only thing all battle units have in common and only thing you don't need to check for null :)

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: Accuracy penalty when flying [OXCE]
« Reply #4 on: August 27, 2019, 09:21:32 pm »
Actually, I just thought that it may not be necessary to check for which armor is used. If the unit is not supposed to be flying without the armor, then, if it is flying (and the script checks exactly for that: if it is flying), it can be safely assumed that it is due to armor. Unless there will be different kinds of flying armors, some of which will have stabilizers or some kind of autopilot, in which case they wouldn't have this penalty. But unless there are such armors, per unit basis will be enough.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9144
    • View Profile
Re: Accuracy penalty when flying [OXCE]
« Reply #5 on: August 27, 2019, 09:50:19 pm »
Defining it on armor saves the modder a bit of work... there's more units than armors.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3375
    • View Profile
Re: Accuracy penalty when flying [OXCE]
« Reply #6 on: August 27, 2019, 11:24:17 pm »
One point, `getBattleType` from `RuleItem` store information if item is `BT_PSIAMP` or not.

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11783
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Accuracy penalty when flying [OXCE]
« Reply #7 on: August 28, 2019, 10:38:51 am »
Using armour instead of unit is also consistent with the rest of the engine, so it would be preferable.
Having movement penalties on units would be just counter-intuitive.
« Last Edit: August 28, 2019, 03:41:11 pm by Solarius Scorch »

Offline Kzer-Za

  • Colonel
  • ****
  • Posts: 140
    • View Profile
Re: Accuracy penalty when flying [OXCE]
« Reply #8 on: August 28, 2019, 11:23:36 am »
I uploaded a new version with the required feature. See the updated description. You need the "Plus" version, and give the armor you need to be affected by the penalty a tag ACC_PENALTY equal to 1 (well, not 0) in your mod. Vanilla flying suit is already specified in my mod itself.
« Last Edit: August 28, 2019, 11:26:12 am by Kzer-Za »

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11783
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Accuracy penalty when flying [OXCE]
« Reply #9 on: August 28, 2019, 03:41:50 pm »
Awesome, thanks! I'll give it a try.