Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Weapon damage loss with range. Does it happen? Moddable?  (Read 802 times)

rogerbacon

  • Commander
  • ***
  • Posts: 151
    • View Profile
Weapon damage loss with range. Does it happen? Moddable?
« on: January 15, 2021, 08:16:55 AM »

Do weapons lose damage with range? If not, is it moddable?

I sort of did this but since I'm new to modding stuff here its probably not the best way.
I made an energy torpedo modeled after the Starfleet Battles plasma torpedo. In the csv it lists 1 damage but in tn the script I override OnHit and calculate the range it has traveled since launch and apply the real damage there as a formula.

I assume this would work for any projectile weapon but how would I do something similar for a beam weapon? To keep it simple let's say I want the beam weapon to do one-half damage if the target is beyond one-half of the beam's max range. Any ideas?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Weapon damage loss with range. Does it happen? Moddable?
« Reply #1 on: January 15, 2021, 09:11:35 AM »

There'll be stuff in the next release that makes this doable with some scripting (via a DamageDealtModifier added to the source ship). As far as doing it now, hmm - I'm not sure. I'd imagine any workaround would be pretty hacky, but, again, not sure.
Logged

MesoTroniK

  • Admiral
  • *****
  • Posts: 1731
  • I am going to destroy your ships
    • View Profile
Re: Weapon damage loss with range. Does it happen? Moddable?
« Reply #2 on: January 15, 2021, 04:06:30 PM »

In the csv it lists 1 damage but in tn the script I override OnHit and calculate the range it has traveled since launch and apply the real damage there as a formula.
This isn't a great idea as it will both make the stat card read wrong and mess with the AI's threat assessment for the weapon.

The way you want to do something like this is an everyframe combat plugin, that looks for the shot ID, and sets the damage to what you want while putting the at-muzzle damage in the .csv. Well that is the very short version but yea along those lines :)

rogerbacon

  • Commander
  • ***
  • Posts: 151
    • View Profile
Re: Weapon damage loss with range. Does it happen? Moddable?
« Reply #3 on: January 19, 2021, 01:39:39 PM »

In the csv it lists 1 damage but in tn the script I override OnHit and calculate the range it has traveled since launch and apply the real damage there as a formula.
This isn't a great idea as it will both make the stat card read wrong and mess with the AI's threat assessment for the weapon.

The way you want to do something like this is an everyframe combat plugin, that looks for the shot ID, and sets the damage to what you want while putting the at-muzzle damage in the .csv. Well that is the very short version but yea along those lines :)

Thanks. EveryFrame sounds like a very CPU intensive solution though. I only need to check at the moment of impact before damage is done. I've found out that OnHit() seems to happen AFTER the projectile has already done its damage. Is there a method that can be called for the projectile right BEFORE it does its damage?

If not, and I have to go with EveryFrame(), how do I find the IDs of the projectiles associated with a specific weapon?
Logged