• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Applying a buff to a trap?

I'm working on a new trap and am not sure how to add an effect to it.  When it collides with the player or zeds and does damage I want there to be a chance for an effect, such as bleeding or burning. How can I tie this into a trap? Something like a flaming blade trap or a razor-sharp blade trap.

 
I'm working on a new trap and am not sure how to add an effect to it.  When it collides with the player or zeds and does damage I want there to be a chance for an effect, such as bleeding or burning. How can I tie this into a trap? Something like a flaming blade trap or a razor-sharp blade trap.


Check how they do with either the electric fences or spike traps, I believe those apply buffs (electric shock, bleeding).

 
I checked the "barbedFence" and saw none, didn't think of the "electricfencepost". Thanks for making my brain work again. The example I provided above does make for a cool concept. Elemental blade traps. Applies burning, freezing, or bleeding damage. Yes, blood is now an element!

Update:

For others who want to do this, to add a buff (damage like shock) when a trap or whatever hits a target, the following two lines must be in your block definition.

Code:
<property name="Buff" value="buffShocked"/>
<property name="BuffChance" value="1"/>
I am assuming that BuffChance is 0.1 through 1.0, with 1 being 100% chance to apply, and 0.1 being a 10% chance to apply.

 
Last edited by a moderator:
Okay, I have a new problem. For whatever reason, I get console errors when the game attempts to apply the bleeding buff to me. See the attached screenshot. I have tried "buffInjuryBleedingBarbedWire", "buffInjuryBleedingTwo", and "buffInjuryBleeding". All three fail to apply but do give errors. The thing is, I am not sure why. Clearly I am doing something wrong, but I do not know what.

For reference, I simply made a modlet to test with that contains the following in "Blocks.xml". Nothing else!

Code:
<configs>

    <insertAfter xpath="/blocks/block[@name='bladeTrap']/property[@name='TakeDelay']">
        <property name="Buff" value="buffInjuryBleedingBarbedWire"/>
        <property name="BuffChance" value="0.35"/>
    </insertAfter>

</configs>

It applies without warning or error, but when you walk into a blade trap you get the screenshot below.

251570_20230807214238_1.png

 
I have tried this with "BuffShocked" and the same thing happens. Not sure what is causing this, but my gut tells me that the fence and barbed wire have special C# code that the blade trap does not have. Maybe it's because the blade trap physically hits you (spinning blades) and needs the buff applied on hit? Is that possible?

 
I will see if I recall anyone adding traps with buffs, but at the top of my head, I can't think of any

 
The electric fence does it, and I literally copy/pasted at one point to test the shock buff. It did not work. I cannot figure out why that buff only works on the fence. My gut again tells me something in  C# makes the electric fence work with buffs but nothing else.

 
Back
Top