attack_parameters.health_penalty

Place to get help with not working mods / modding interface.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1759
Joined: Sun Oct 14, 2018 8:13 am
Contact:

attack_parameters.health_penalty

Post by Pi-C »

According to the wiki,
a higher penalty will discourage turrets from targeting units with higher health. A negative penalty will encourage turrets to target units with higher health.
Does the actual value have any significance at all? Would "health_penalty = -1" and "health_penalty = -100" have the same effect, or would a turret with "health_penalty = -100" be so much more likely to target units with more HP?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
posila
Former Staff
Former Staff
Posts: 5448
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: attack_parameters.health_penalty

Post by posila »

When searching for new target, turret will calculate penalty for each target and chose the one with the minimal penalty.

Code: Select all

penalty = sqr(distance_of_enemy_from_turret)
          + signed_sqr(health_penalty * enemy.health) 
          + signed_sqr(rotate_penalty * turn_distance_to_enemy)

sqr(x) = x * x
signed_sqr(x) = x * abs(x)
Pi-C
Smart Inserter
Smart Inserter
Posts: 1759
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: attack_parameters.health_penalty

Post by Pi-C »

posila wrote: Sun Jul 12, 2020 1:57 pm When searching for new target, turret will calculate penalty for each target and chose the one with the minimal penalty.
Thanks! So, with health_penalty being a constant, and rotate_penalty = 0, the numeric value of health_penalty really doesn't matter and I could just set it to "-1" if I want my long-range sniper turret to prefer distant behemoth biters with 100% health over small biters close to the turret. That's all I needed to know. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”