Author Topic: [DONE] Weapon range in paedia  (Read 1267 times)

Offline Scamps

  • Sergeant
  • **
  • Posts: 48
    • View Profile
    • Email
[DONE] Weapon range in paedia
« on: August 08, 2022, 06:30:35 pm »
Can weapon ranges (auto/snap/aimed) be extracted into pedia article?

Also could you please direct me to documentation on paedia templates in general? Or which files in mods contain examples?

Sorry if answered before, I have poor google skills.
« Last Edit: August 11, 2022, 08:51:49 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7806
    • View Profile
Re: Weapon range in paedia
« Reply #1 on: August 08, 2022, 08:05:10 pm »
There is no more space to display anything in the pedia articles.
But you can see the weapon ranges under the INFO button (if you're using OXCE).

Documentation here: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#UFOpaedia_Article

Offline Scamps

  • Sergeant
  • **
  • Posts: 48
    • View Profile
    • Email
Re: Weapon range in paedia
« Reply #2 on: August 08, 2022, 11:46:04 pm »
Thank you for the answer. After some more research I think I answered my question myself.

The mod which led me to the question is 40k. Weapon articles in this mod have unusual composition, by the time of writing I did not recognize TFTD style. So there are only two paedia temlates - UFO and TFTD.
Problem is there are like 20 bolters in mod, wich share very similar characteristics (and half of them share the same picture, which TFTD allows). Comparing these without a spreadsheet is a pain. I was thinking of making a submod for my own use. Ranges could be displayed for example like that:
Auto (x3)/5   35%   50%
Snap/11        50%   40%
Hence the question.
Looking in localization files there are strings like STR_SHOT_TYPE_SNAP: "Snap (x{0})". Was wondering if it is possible to change into something like "Snap (x{0})/{1}", where {1} is optional. Looking into the code, they are hardcoded. Another option would be adding to STATS FOR NERDS, but it seems more confusing than helping. And the string is also hardcoded.
So the question turns into suggestion with tiny chances to implement. Ranges do not boter me that bad to make a fork of OXCE ))

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1493
    • View Profile
Re: Weapon range in paedia
« Reply #3 on: August 10, 2022, 05:17:38 am »
Mods often have their own ranges, but the default range in the original game is infinite, and the default range with UFO Extender accuracy is 7 for auto shot, 15 for snap shot, 200 for aimed shot, and a dropoff of 2.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7806
    • View Profile
Re: Weapon range in paedia
« Reply #4 on: August 11, 2022, 08:52:28 pm »
Was wondering if it is possible to change into something like "Snap (x{0})/{1}", where {1} is optional.

Done.

Offline Scamps

  • Sergeant
  • **
  • Posts: 48
    • View Profile
    • Email
Re: [DONE] Weapon range in paedia
« Reply #5 on: August 13, 2022, 06:43:10 pm »
Thank you, kind sir! You made the life of gun collector a bit easier.

It works wonderfully. It can be configured per language. If strings are too long, they do not hide accuracy. They even show default ranges, that are not displayed in INFO. Only tiny issue is that default aimed range of 200 unexpectedly turned to be three-digit. I thought it was 20. But that is not a problem.

Offline howareyou32ny

  • Sergeant
  • **
  • Posts: 35
  • Work hard and play hard lol
    • View Profile
    • Email
Re: Weapon range in paedia
« Reply #6 on: August 16, 2022, 03:37:04 am »
Done.
Thanks Mer- How can we use that new feature now?

Offline Scamps

  • Sergeant
  • **
  • Posts: 48
    • View Profile
    • Email
Re: [DONE] Weapon range in paedia
« Reply #7 on: August 18, 2022, 11:15:40 am »
Here is an example mod https://openxcom.org/forum/index.php/topic,10723.0.html
Range replaces {1} in corresponding strings.

Offline R1dO

  • Colonel
  • ****
  • Posts: 412
    • View Profile
    • Email
Re: [DONE] Weapon range in paedia
« Reply #8 on: August 28, 2022, 02:56:41 am »
While fiddling with this functionality (yup ... curiosity again) i noticed something unexpected.

If a mod only uses the ``maxRange`` variable in order to limit weapon range (and thus does not bother with ``aimRange``,  ``snapRange`` and/or  ``autoRange``) the default values for each shot type are shown
even if ``maxRange`` is lower.

Is this intended?

Offline howareyou32ny

  • Sergeant
  • **
  • Posts: 35
  • Work hard and play hard lol
    • View Profile
    • Email
Re: [DONE] Weapon range in paedia
« Reply #9 on: August 28, 2022, 06:09:58 am »
Here is an example mod https://openxcom.org/forum/index.php/topic,10723.0.html
Range replaces {1} in corresponding strings.
Using it now. AmaZing. TY.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7806
    • View Profile
Re: [DONE] Weapon range in paedia
« Reply #10 on: August 28, 2022, 03:27:23 pm »
While fiddling with this functionality (yup ... curiosity again) i noticed something unexpected.

If a mod only uses the ``maxRange`` variable in order to limit weapon range (and thus does not bother with ``aimRange``,  ``snapRange`` and/or  ``autoRange``) the default values for each shot type are shown
even if ``maxRange`` is lower.

Is this intended?

can't answer yes or no, it was not specified

Offline Scamps

  • Sergeant
  • **
  • Posts: 48
    • View Profile
    • Email
Re: [DONE] Weapon range in paedia
« Reply #11 on: August 28, 2022, 08:01:52 pm »
Totally missed that case. I am not that familiar with OpenXcom modding )
Would be good to account for max range, though, please.
I guess, the lowest of two should be displayed?
« Last Edit: August 28, 2022, 08:03:23 pm by Scamps »

Offline Bonakva

  • Colonel
  • ****
  • Posts: 185
    • View Profile
Re: [DONE] Weapon range in paedia
« Reply #12 on: September 04, 2022, 10:24:58 am »
Totally missed that case. I am not that familiar with OpenXcom modding )
Would be good to account for max range, though, please.
I guess, the lowest of two should be displayed?

Great mod!
Perhaps this is the thing that should go by default in OXCE.
And definitely need to limit the maximum range

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7806
    • View Profile
Re: [DONE] Weapon range in paedia
« Reply #13 on: September 08, 2022, 07:42:57 pm »
Totally missed that case. I am not that familiar with OpenXcom modding )
Would be good to account for max range, though, please.
I guess, the lowest of two should be displayed?

done