Applying damage bonus to poison cloud? (Solution found)

Place to get help with not working mods / modding interface.
Post Reply
Qatavin
Burner Inserter
Burner Inserter
Posts: 13
Joined: Mon Sep 20, 2021 7:42 pm
Contact:

Applying damage bonus to poison cloud? (Solution found)

Post by Qatavin »

Recently I've been messing around with capsules, trying to see how they could be balanced and improved for better long-term utility, and I noticed something odd about the damage bonuses I tried to apply. You can increase instant damage just fine with a simple bonus applied to the capsule's category. Stickers also take the bonus, as do fires and the submunitions of the cluster grenade. But entities such as poison clouds (created by type = "create-entity") do not.

I checked a couple other mods that add advanced capsules, and found the same issue. Does anyone know of a way to boost the damage of these cloud entities with a bonus from tech, or do I just have to work around it?


Update: I finally decided to come back to this after some time, and found a solution. There is no way to boost the damage of a smoke-with-trigger, or anything created by type = "create-entity", so as far as I've been able to discover, the only way to do this is to make a fire and have it act like a smoke cloud. This is done in three steps.

The capsule projectile must create both a visible fire and an invisible smoke-with-trigger at the target location. The fire's damage_per_tick can be 0; instead, the damage is done using on_damage_tick_effect, with the same action as the original poison cloud's smoke-with-trigger. Damage done in this way will show up in the tooltip if you want it to. Unfortunately, this has the problem that on_damage_tick_effect only triggers when the fire damages something, so to make this work right, I want there to be exactly one object directly under the fire at all times. To help with this, I gave the fire a tiny collision_box.

The rest of the trick involves the invisible smoke-with-trigger and a series of invisible flying combat-robots. Smoke will not take damage from fire. It only exists because it can use its action to cyclically produce combat-robots in the same place, and these will take damage. With huge health and healing_per_tick, they can never be destroyed, and by setting is_military_target = false and flagging them as placeable-neutral, enemies will seemingly always ignore them unless they are primed to target flying robots by the presence of the player's construction or combat bots. Not exactly sure what that's about, but whatever. With a time_to_live of 10 and the smoke producing another every 10 frames to match how fire's damage_per_tick triggers every 10 frames, the combat-robot should always be there to trigger the damage.

But what if there's something else directly under the fire? A worm or a spawner, or just a biter running around underneath, for example. Then there would be multiple entities triggering the fire's damage. Fortunately, the solution to this is simple. Combat-robots must have a collision_box of size 0x0, but they can still have a collision_mask. By setting check_buildability = true for the smoke's create-entity action and making the combat-robot collide with the object-layer, the combat robot will not spawn on any cycle in which there is another entity present to trigger the fire, so on_damage_tick_effect will also only trigger once, keeping everything nice and consistent.

Post Reply

Return to “Modding help”