create_entity projectile: damage_multiplier, max_range

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

create_entity projectile: damage_multiplier, max_range

Post by Earendel »

When using create_entity to create a projectile, please allow damage_multiplier and max_range as optional parameters.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: create_entity projectile: damage_multiplier, max_range

Post by Rseding91 »

max_range is already a valid optional parameter for projectiles. damage_multiplier isn't supported as the projectile class doesn't support such a concept. The damage of a projectile is based off the prototype values and the ForceData (technology) bonuses. It's not adjustable outside that.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: create_entity projectile: damage_multiplier, max_range

Post by Earendel »

Hmmm. Ok, so the Issue that I'm having is that I'm spawning a projectile that is pretending to be a projectile fired form a vehicle turret. The vehicle gun would give the projectile a damage bonus, so what I wanted to do is spawn the projectile with a matching damage bonus.

Presumably then, when a normal projectile run its effect it looks up a reference to its spawning entity, or spawning entity prototype in order to properly calculate the entity and force damage bonuses? If so, is there a way to pass in the spawning entity as a create_entity parameter?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: create_entity projectile: damage_multiplier, max_range

Post by Rseding91 »

The projectile uses the force given to it through create_entity to calculate force-based bonuses.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: create_entity projectile: damage_multiplier, max_range

Post by Earendel »

So how does this work?

You have two guns on the same force, one has a damage bonus of +0% the other has a bonus of +100%.

They're both loaded with the same ammo type.

They both fire, and create the same type of projectile, and both projectiles have the same force.

They both hit the target. The first one deals 100% damage, the second deals 200% damage. The bonus damage is not from the force, it's from a damage multiplier on the gun.

How does the 2nd projectile know to deal more damage?

Post Reply

Return to “Modding interface requests”