Jump to content

Infections


Iceburg71

Recommended Posts

I am working on learning about infections and how to make them work.  I wrote a simple modlet creating a food that (i hoped) would automatically infect you.  Just a test to learn with.  But it doesn't work.  When I go into the command console, and I try to give myself "buff buffinfectioncatch"  it tells me I am immune???  Is this because I am too low a level in my test world?  I didn't think there was any protection like that.  Anyway, code is below and any help appreciated.  I though food would be easy to test with.. LOL...

 

Spoiler

    <append xpath="/items">

        <item name="foodCanBeef2">
            <property name="Tags" value="food"/>
            <property name="HoldType" value="31"/>
            <property name="DisplayType" value="foodRaw"/>
            <property name="Meshfile" value="#Other/Items?Misc/parcelPrefab.prefab"/>
            <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
            <property name="Material" value="Mmetal"/>
            <property name="Weight" value="5"/>
            <property name="EconomicValue" value="60"/>
            <property name="Stacknumber" value="10"/> <!-- STK food -->
            <property class="Action0">
                <property name="Class" value="Eat"/>
                <property name="Delay" value="1.0"/>
                <property name="Use_time" value="..."/>
                <property name="Sound_start" value="player_eating"/>
                <property name="Create_item" value="drinkCanEmpty"/>
            </property>
            <property name="Group" value="Food/Cooking,CFFood/Cooking"/>

            <effect_group tiered="false" name="Food Tier 0">
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="15"/>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="7"/>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffProcessConsumables"/>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffInfectionCatch"/>
            </effect_group>
        </item>

    </append>
 

 

Link to comment
Share on other sites

It looks "good" to me.  I have some thoughts, just as a second pair of eyes:

1. When you tested it, did you test by eating the "foodCanBeef2"?  like, are you sure you're eating it and not the vanilla "foodCanBeef"?
2. Maybe? put the "buffInfectionCatch" line before "buffProcessConsumables"?

3. Maybe? There's a buff called "triggerInfection" in buffs.xml that has a comment "<!-- trigger buffs to reliably cause crits for testing: -->".  Maybe put this buff in instead just to see if it works?  It is a tiny bit different than the vanilla buff buffInfectionCatch, but if it works then maybe that small difference in this buff needs to be used?

4. Maybe using "dm" and giving yourself infection buffs doesn't work or possibly Did you go into god mode by accident?

Link to comment
Share on other sites

dough - 

1. yes. I am eating the correct food.  Double and triple check that one.  LOL

2.   will try that.  thought about it, but hadn't tried it yet.

3.  I don't remember if I tried that or not.  I tried a few different things, but will make sure I try that one next time I am playing with it.

4. I have exited and entered the game several times and have not entered the "god mode" commands each time.  is it persistent between reloads of the game?

 

bdubah - 

It is a new world (fairly).  I did give myself enough xp to get the "newbie" buff to no longer be in effect.

 

Thanks for the suggestions.  Keep them coming!

 

Link to comment
Share on other sites

2 hours ago, Iceburg71 said:

4. I have exited and entered the game several times and have not entered the "god mode" commands each time.  is it persistent between reloads of the game?

I don’t actually know, but I have found some things seem to persist when the game is shut down. When I do lots of modding changes, especially with localization changes, I always exit and close the game all the way out to Steam. 
 

I haven’t tested much, but I swear I had issues with some things (like localization.txt) if the game wasn’t closed all the way down to Steam. I’m likely wrong or just not paying attention or maybe was just too tired from trying to get some mod to work, but yeah “turn it off and on again ;)”

 

I also think (someone on the forums may have said it) some block or item

properies have to come before others, but it’s not many. Unless they were making this up, or trolling me , by extrapolating that information that “some things must come before others” , it makes sense that some effect might also have to be in some order (or at least “come first/last” for some esoteric reason, even though to me it doesn’t make logical sense given how the triggers should work (all be independent)

Link to comment
Share on other sites

  • 3 weeks later...

Man, I thought this would be easier than it is.  I still don't know hoe to give a player an infection.  I wanted to test this mechanic out on something simple like a can of food, but I can't get it to work.  Anyone have any insight on how to do this?

 

Tried multiple variations of things.

This was my last one....

Spoiler

        <item name="foodCanBeef2">
            <property name="Tags" value="food"/>
            <property name="HoldType" value="31"/>
            <property name="DisplayType" value="foodRaw"/>
            <property name="Meshfile" value="#Other/Items?Misc/parcelPrefab.prefab"/>
            <property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
            <property name="Material" value="Mmetal"/>
            <property name="Weight" value="5"/>
            <property name="EconomicValue" value="60"/>
            <property name="Stacknumber" value="10"/> <!-- STK food -->
            <property name="CustomIcon" value="foodCanBeef"/>
            <property name="CustomIconTint" value="ff8d00"/>
            <property class="Action0">
                <property name="Class" value="Eat"/>
                <property name="Delay" value="1.0"/>
                <property name="Use_time" value="..."/>
                <property name="Sound_start" value="player_eating"/>
                <property name="Create_item" value="drinkCanEmpty"/>
            </property>
            <property name="Group" value="Food/Cooking,CFFood/Cooking"/>

            <effect_group tiered="false" name="Food Tier 0">
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="15"/>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="7"/>
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffProcessConsumables"/>
                <passive_effect name="BuffProcChance" operation="base_set" value=".99" tags="buffInfectionCatch"/>
                <!-- <triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffInfectionCatch"/> -->
                <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" target="other" cvar="infectionCounter" operation="add" value="10"><!--InfectionRegular-->
                    <requirement name="CVarCompare" target="other" cvar="infectionCounter" operation="GT" value="0"/></triggered_effect>
            </effect_group>
        </item>
 

 

 

Any help appreciated.

Link to comment
Share on other sites

You need to lower your buff resistance before you can apply that buff. If you type 'buff buffInfectionCatch' in console, it says you are immune to that buff. This is due to players having a buff resistance of 1 by baseline. It's only when the player is hit that this is lowered. It seems they use 'triggerInfection' for testing infections. This lowers the resistance by 5, then applies the infectioncatch buff. So either you need a step between eating and applying the debuff, or find another way around it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...