"Force" on Damage Question

Place to get help with not working mods / modding interface.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

"Force" on Damage Question

Post by TheSAguy »

Hi,

What's the best way to ensure that my enemy units don't hurt each other, but do hurt the the player and his stuff?

I have an example below, where I've placed a force several places. Over-kill, but not sure where the best spot is.

Code: Select all

        -- Stream Spitters - Fire Streams (hydralisk)
    function Spitter_Attack_Stream_Fire(data)
        return {
            type = "stream",
            force = "enemy",
            ammo_category = "flamethrower",
            range_mode = "bounding-box-to-bounding-box",
            cooldown = data.cooldown,
            range = data.range,
            projectile_creation_distance = 1.9,
            damage_modifier = data.damage_modifier or 1.0,
            warmup = data.range * 1.5, -- 15,
            min_range = 6,
            turn_range = 1.0,
            fire_penalty = 30,
            gun_barrel_length = 1 * data.scale,
            
            gun_center_shift = {

                  north = {-0.4 * data.scale, -1.8 * data.scale},
                  east = {3 * data.scale, 4  * data.scale},
                  south = {-0.4 * data.scale, 8.8 * data.scale},
                  west = {0.65 * data.scale, 4 * data.scale}
            },
            
            ammo_type = {
                category = "flamethrower",
                action = {
                    type = "direct",
                    force = "enemy",
                    action_delivery = {
                        type = "stream",
                        force = "enemy",
                        stream = "ne-fire-stream",
                        source_offset = {0.15, -0.5},
                        --source_offset = {-100, -0.5},
                        max_length = data.range,
                        duration = 160
                    }
                }
            },
           
            sound = sounds.spitter_roars(data.roarvolume),
            animation = zerg_hydralisk_attackanimation("hydralisk", data.scale, data.tint1)
        }
    end
Is there something like Force = Same? That way the damage would match the entity that created it?

Thanks

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: "Force" on Damage Question

Post by Deadlock989 »

Projectiles have force_condition but streams don't - I'm 97% sure that streams (e.g. spitters, flamethrowers) are always going to damage everything they hit that isn't fully resistant. If that is actually the case, then you could try a scripted trigger effect and compare forces manually, but that will have a performance overhead.
Image

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: "Force" on Damage Question

Post by TheSAguy »

Thanks Deadlock989

Post Reply

Return to “Modding help”