Jump to content

Need help with adding to buffInfectionCatch behavior


Recommended Posts

I'm making a mod for our private server that changes the conditions of infection.


I was trying to co-opt the .InfectionNope part by having a second effect_group that checks for a particular custom buff on the entity that is attacking, and sets the .InfectionNope cvar to zero if the requirements are met.


It's not working as I'd expect. With the limited debugging capabilities, I can see that .InfectionNope is being set by the built in health based checks, and my triggers seem to be skipped.


An excerpt test case looks something like this:

<insertAfter xpath="/buffs/buff/effect_group[@name='a chance to nope out of infection that is based on health']">
<effect_group name="a chance to nope out of infection that is based on aggregate immunity">
	<!-- immune from regular K9 type zombies -->
	<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".InfectionNope" operation="set" value="0">
		<requirement name="HasBuff" target="other" buff="buffK9InfectionStrain"/>
		<requirement name="HasBuff" buff="buffK9Immunity"/>


It patches in just fine (I exported and checked.) I suspect that target="other" is invalid to this trigger type.


But, maybe someone can help me think through a solution here.


Basic gyst of it is, every enemy that spawns in gets a simple buff that identifies a type of infection strain, and the player may have an immunity buff to it. So if both buffs are present, the nope out chance should be set to zero.


or... any other way someone can think of to implement this... I'm all ears.


What we already have working is that a player can get an immunity buff to a type of infection. And currently, I assign infection type buffs to enemies on their spawn (which I can't verify are actually taking-- I see the buffs in debug on the player, but can't check the entities' buffs.) The two buffs are checked, and if the player doesn't have the required immunity, normal infection catch chances occur.


Everything else in our mod works great- this is the final hangup.


Any help would be appreciated!

Link to comment
Share on other sites

After looking more at how the zombie melee hand items work, I solved this by setting a cvar similar to the zombie hit count cvar that gets passed through.


So I modded all zombie related attacks to set a cvar InfectionZombieType on other based on the infection type buff they carry, and used that in buffs.xml to amend the .InfectionNope cvar.


Seems to be working as expected so far. I put the buffInfectionCatch duration up to 10 seconds so I could inspect the cvars. Saw them getting set, and stood in a crowd of 25 dogs with the appropriate immunity buff and did not get infected even when I met 100% infection rate conditions.


I might tinker around with this and see if I can use the BuffResistance passive effects in a similar manner on how zombie melee uses the BuffProcChance.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...