Author Topic: [DONE][Suggestion] Power bonuses from firearm instead of ammo  (Read 1959 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
I think that "damageBonus" must work when described in weapon definition. If clip have it too, then gun one must prevale.

In fact, it will be great to have overwriting for "power", so a special weapon using standart ammo can make more (or less) damage.

But "damageBonus" for clip seems unnecessary, while for weapon - logical.
« Last Edit: July 23, 2024, 10:28:13 pm by Nord »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #1 on: July 23, 2024, 06:50:22 pm »
Whether it is logical or not is arguable, I don't have any strong preference or opinion.

The fact however is that all such attributes currently work in a way that ammo attribute has a bigger priority than the weapon attribute.
Simply changing this (to work the other way around) would break existing mods.
If there is a different/better solution, I don't know.
« Last Edit: July 23, 2024, 06:52:19 pm by Meridian »

Online Delian

  • Commander
  • *****
  • Posts: 502
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #2 on: July 23, 2024, 07:21:26 pm »
powerBonus is used on crafts. damageBonus is used on items.

In real life, all the power comes from the bullet, because bullet contains the chemicals that produce the power to propel the bullet. The gun doesn't produce any power.

In general, I disagree with this suggestion, because you can already write a yscript that changes damage based on what gun and ammo is used. There's also other possible solutions, for instance, simply have a stronger weapon use stronger ammo. Or don't have the weapon use an ammo item at all, in which case the power will only come from the weapon.

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #3 on: July 23, 2024, 09:37:55 pm »
In real life, all the power comes from the bullet, because bullet contains the chemicals that produce the power to propel the bullet. The gun doesn't produce any power.
Rifling, and generally long barrels; chamber and bore sizes, etc disagree. While the power is due to the round itself, the weapon can magnify that power, and not trivially. Otherwise, everyone would saw off their rifle barrels and go with less clumsy, more carry-convenient guns.


One solution would be to give weapons an attribute that allows them to modify round power, by either replacing, multiplying or flat addition to the ammo's value. I suppose it's already possible via y-scripts, though?
« Last Edit: July 23, 2024, 09:39:41 pm by Juku121 »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #4 on: July 23, 2024, 10:17:39 pm »
Rifling, and generally long barrels; chamber and bore sizes, etc disagree. While the power is due to the round itself, the weapon can magnify that power, and not trivially. Otherwise, everyone would saw off their rifle barrels and go with less clumsy, more carry-convenient guns.


One solution would be to give weapons an attribute that allows them to modify round power, by either replacing, multiplying or flat addition to the ammo's value. I suppose it's already possible via y-scripts, though?
Yes you can easy make global script that will multiply bullet power bonus based on "barrel".

If I recall correctly, script hook should be named `damageBonusBonusStats`.

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #5 on: July 23, 2024, 10:25:12 pm »
...
Simply changing this (to work the other way around) would break existing mods.
...
Yes, that's problem. Maybe flag-parameter in "vars" can do? Like "GunOverAmmo: true" will set gun in priority and vice versa.
powerBonus is used on crafts. damageBonus is used on items.
Oh, thanks. It's a typo, of course.

Quote
In general, I disagree with this suggestion, because you can already write a yscript that changes damage based on what gun and ammo is used.
It is possible, but will misguide player, as this changes not show changed damage in Ufopedia (sadly, almost no one really reads texts)
One solution would be to give weapons an attribute that allows them to modify round power, by either replacing, multiplying or flat addition to the ammo's value. I suppose it's already possible via y-scripts, though?
Yes, but "damageBonus" looks just as what you saying. For "power" defining ammo strength, and "Bonus" defining gun special properties, like barrel, etc.
In fact, i always thinked that it is just like so, and only today catched my mod working not as i expect. (right when debugging scripted power bonuses)
...
If I recall correctly, script hook should be named `damageBonusBonusStats`.
But will it show bonus in Ufopedia?
« Last Edit: July 23, 2024, 10:27:28 pm by Nord »

Offline Juku121

  • Commander
  • *****
  • Posts: 1799
  • We're all mad here.
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #6 on: July 23, 2024, 11:11:02 pm »
But will it show bonus in Ufopedia?
Well, no, but a) perhaps one can also hook up the pedia 'power' stat to y-scripts? And b) you can make a fictional gun with whatever values for pedia display. Decouple it from ammo, too, if you wish. 

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #7 on: July 23, 2024, 11:41:29 pm »
a) doubt.
b) if nothing else, yes.

As an example of what i try to do, i want to make an universal battery for energy weapons, that will provide,  lets say, 33 shots for pistol, 25 for rifle and 20 for cannon, while each of this weapon have different damage.
« Last Edit: July 23, 2024, 11:46:02 pm by Nord »

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #8 on: July 27, 2024, 12:39:38 pm »
Will be great if "powerRangeThreshold" and "powerRangeReduction" will work in same manner too.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #9 on: September 22, 2024, 09:24:31 pm »
I'll check this next week.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [Suggestion] Power bonus for gun, not clip.
« Reply #10 on: September 27, 2024, 08:25:15 am »
The good solution here is using y-scripts. I have 2 guns using same ammo, but one of those gun has greater power due to its longer barrel. Can be done with hitUnit script hook

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [DONE][Suggestion] Power bonuses from firearm instead of ammo
« Reply #11 on: September 28, 2024, 07:39:39 pm »
Done.

All weapons except firearms with ammo (incl. HWP weapons) remain unaffected:
- gunbutts: `meleePower` and `meleeBonus` unaffected
- environmentalCondition `weaponOrAmmo` items unaffected
- pre-battle explosions unaffected
- self-destruct power on corpses unaffected
- glow range on flares unaffected
- AI psi stuff unaffected


Power (`power`), power bonus (`damageBonus`), and power range reduction (`powerRangeReduction` and `powerRangeThreshold`) are affected.

All other attributes are unaffected, including:
- explosion radius unaffected... so make sure it is correctly defined by ammo power, power bonus, radius effectiveness, fixradius, fireblastcalc and other attributes
- damage type unaffected... so make sure it is correctly defined by ammo damage type
- and so on...

Ufopedia power and power bonus display updated.
Damage preview in Inventory updated.
Damage preview on crosshair updated.

Sample ruleset:

Code: [Select]
extraNerdyPediaInfoType: 2
items:
  - type: STR_HEAVY_CANNON
    ignoreAmmoPower: true     # default false
    power: 7
    damageBonus:
      flatHundred: 0.2

  - type: STR_TANK_ROCKET_LAUNCHER
    ignoreAmmoPower: true
    power: 42
« Last Edit: September 28, 2024, 07:47:05 pm by Meridian »

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: [DONE][Suggestion] Power bonuses from firearm instead of ammo
« Reply #12 on: September 29, 2024, 02:01:07 am »
Oh, this is just wonderful. Thank you very much.