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

Can't get mod buff to stay

Hello,
I'm tinkering with a mod that buffs me when I stand on it but the buff disappears the moment I leave the block. How do I get the buff to have a duration after I get off the block?
I have this line with a trap in a blocks.xml.
    <property name="BuffsWhenWalkedOn" value="buffDrugRecog" />
Which applies the buff.  What do I need to add that'll give that buff a duration ?

<property name="BuffsWhenWalkedOn" value="buffBurningMolotov"/>
Sets me on fire too and when set to,say,a dirt block,it turns the game into the floor is lava which is cool. So i'm looking to see how to add duration to all this.

 
Last edited by a moderator:
Alot of buffs use a cvar counter to determine the duration. I think recog one does,but not fully sure. Look at it in buffs.xml to see. If thats the case, you would need a primer buff as the one the player gets when stepping om block. This buff would then add the recog buff and set a cvar amount.

 
Looks like recog uses a cvar called: $buffDrugRecogDuration

It's subtracted from by the @$MetabolismDuration amount, and once the $buffDrugRecogDuration is LTE 0, it removes the recog buff. That check happens every 1 sec (buffs without a defined update_rate will default to 1 sec). So you'll need a buffer buff that applies the recog buff as well as sets a duration for that cvar.

 
Looks like recog uses a cvar called: $buffDrugRecogDuration

It's subtracted from by the @$MetabolismDuration amount, and once the $buffDrugRecogDuration is LTE 0, it removes the recog buff. That check happens every 1 sec (buffs without a defined update_rate will default to 1 sec). So you'll need a buffer buff that applies the recog buff as well as sets a duration for that cvar.
Is it even possible to put that in blocks.xml?

 
BuffsWhenWalkedOn triggers a buff from buffs.xml when that specific block is walked on. You'd have to add a new buff in that xml.

 
BuffsWhenWalkedOn triggers a buff from buffs.xml when that specific block is walked on. You'd have to add a new buff in that xml.
darn,I hoped it'd be as easy as adding a duration line. I'm new to all this modding stuff with the game. I have no idea on how to do that at all.
I appreciate your replies.

 
Last edited by a moderator:
darn,I hoped it'd be as easy as adding a duration line. I'm new to all this modding stuff with the game. I have no idea on how to do that at all.
I appreciate your replies.
I would suggest learning buffs.. It will open up a whole new world to modding. Most of all my mods have to do with buffs. If you attempt it and need help let me know.. But def try it yourself first. Buffs.xml is quite intimidating, but once you get the hang of it, everything is fairly straight forward in there. :)

 
I would suggest learning buffs.. It will open up a whole new world to modding. Most of all my mods have to do with buffs. If you attempt it and need help let me know.. But def try it yourself first. Buffs.xml is quite intimidating, but once you get the hang of it, everything is fairly straight forward in there. :)
So then i'd make changes in a buffs.xml to make the block give the buff with a duration? and not blocks.xml?

Are there any tools available to make this easier? currently i'm trying to use wrathmaniac's  mod creator and i've made a few very basic mods and used it to revive a old dead mod but the block buffing thing I'm not sure on how to get it working. I'm trying though lol.

Do you think it's at all possible to get this working the way I want it to with a block applying a buff and it giving a customizable duration when getting off the block?
I went over your modlets in your thread,pretty cool spider,plane,and gate mods. Will probably use them. 😎
 

 
Yeah its possible. What i would do is create a new buff.. call it say buffRecogDurationTrigger or w/e you want. have that as the buff that's given through the walkson property of the block... then in buffs.xml, inside this new buff you would do onSelfBuffStart, set the cvar (what i linked earlier) to w/e you want the duration as, then another onSelfBuffStart that would AddBuff the recog buff..

 
Bout to head to bed, so if you don't manage to get it working, i wrote this buff.. it should work, though i havent tested it. if anything it can be a starting spot for ya.. this is the buff that you'd reference in the walkson property.
 

<buff name="buffThisIsYourNewBuff" hidden="true">
<stack_type value="replace"/>
<duration value=".5"/>
<!-- you don't need a long duration for a buff that's just used as a trigger -->
<effect_group name="Set CVar">
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/>
<!-- set the value here to be w/e you want the duration of the recog buff to be. -->
</effect_group>
<effect_group name="Add Recog Buff">
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="buffDrugRecog" target="self"/>
<!-- this will add the recog buff, after this buff has finished (in .5 seconds) -->
</effect_group>
</buff>


Leave a post if you need help on it.. ill check tomorrow. GL!

 
Bout to head to bed, so if you don't manage to get it working, i wrote this buff.. it should work, though i havent tested it. if anything it can be a starting spot for ya.. this is the buff that you'd reference in the walkson property.
 

<buff name="buffThisIsYourNewBuff" hidden="true">
<stack_type value="replace"/>
<duration value=".5"/>
<!-- you don't need a long duration for a buff that's just used as a trigger -->
<effect_group name="Set CVar">
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/>
<!-- set the value here to be w/e you want the duration of the recog buff to be. -->
</effect_group>
<effect_group name="Add Recog Buff">
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="buffDrugRecog" target="self"/>
<!-- this will add the recog buff, after this buff has finished (in .5 seconds) -->
</effect_group>
</buff>


Leave a post if you need help on it.. ill check tomorrow. GL!
Awesome! thank you! i'll see what I can do with it here in a few. 😀

 
Bout to head to bed, so if you don't manage to get it working, i wrote this buff.. it should work, though i havent tested it. if anything it can be a starting spot for ya.. this is the buff that you'd reference in the walkson property.
 

<buff name="buffThisIsYourNewBuff" hidden="true">
<stack_type value="replace"/>
<duration value=".5"/>
<!-- you don't need a long duration for a buff that's just used as a trigger -->
<effect_group name="Set CVar">
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/>
<!-- set the value here to be w/e you want the duration of the recog buff to be. -->
</effect_group>
<effect_group name="Add Recog Buff">
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="buffDrugRecog" target="self"/>
<!-- this will add the recog buff, after this buff has finished (in .5 seconds) -->
</effect_group>
</buff>


Leave a post if you need help on it.. ill check tomorrow. GL!
I got it working thanks to your help! I really appreciate you taking the time to help me with all of this.
Now I have a better idea on how to put together the other mods I want that use buffs.  

I saw someone elses mod here with plate traps that stun or set on fire but I wanted them to be able to do a bunch of other different things too.

Now,how would you make something give you several buffs or debuffs at the same time? I tried making a drink before that took recog and fortbites that would apply both buffs at the same time to try and cutback on carrying multiple items at the cost of 3x but I kept getting red text and it wouldn't show up in game. 

With <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/> 

Would I put them ontop of each other like:
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/> 
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugFortBitesDuration" operation="set" value="300"/> 

so then it'd look like this?

 

<buff name="buffThisIsYourNewBuff" hidden="true">
<stack_type value="replace"/>
<duration value=".5"/>
<!-- you don't need a long duration for a buff that's just used as a trigger -->
<effect_group name="Set CVar">
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugFortBitesDuration" operation="set" value="300"/> 
<!-- set the value here to be w/e you want the duration of the recog buff to be. -->

</effect_group>
<effect_group name="Add Recog Buff">
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="buffDrugRecog" target="self"/>
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="buffDrugFortBites" target="self"/>
<!-- this will add the recog buff, after this buff has finished (in .5 seconds) -->
</effect_group>
</buff>




Also,is there anyway to add a buff that would increase your melee speed? I see run speed in buffs but not swing speed. But I also saw another mod :
Naked Gator by the user Stample that gives a cause bleeding buff so I'm not sure on whether or not there is a way to add a drink that gives a melee speed boost. I'm not sure where to get started with something like that that isn't very obvious in buffs.xml to me.

 
Last edited by a moderator:
I got it working thanks to your help! I really appreciate you taking the time to help me with all of this.
Now I have a better idea on how to put together the other mods I want that use buffs.  

I saw someone elses mod here with plate traps that stun or set on fire but I wanted them to be able to do a bunch of other different things too.

Now,how would you make something give you several buffs or debuffs at the same time? I tried making a drink before that took recog and fortbites that would apply both buffs at the same time to try and cutback on carrying multiple items at the cost of 3x but I kept getting red text and it wouldn't show up in game. 

With <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/> 

Would I put them ontop of each other like:
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugRecogDuration" operation="set" value="300"/> 
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffDrugFortBitesDuration" operation="set" value="300"/> 

so then it'd look like this?

 

Also,is there anyway to add a buff that would increase your melee speed? I see run speed in buffs but not swing speed. But I also saw another mod :
Naked Gator by the user Stample that gives a cause bleeding buff so I'm not sure on whether or not there is a way to add a drink that gives a melee speed boost. I'm not sure where to get started with something like that that isn't very obvious in buffs.xml to me.
Np glad to help! You can do it that way, for sure. Use one buff that then splits off. Idk the cvar name for fort bites, so you'd have to check that buff to find out what that is exactly, unless you did already. Another way you can do it is on the actual item itself in items.xml.. you can make a onselfprimaryactionend trigger that gives each buff. Me personally, i like to do as much as possible in one xml file. So i load down with buffs. Ill make the weapon / item give a single buff (usually i call it like.. buffThisWeaponStart) then from there i trigger other buffs via buffstart, buffupdate, or bufffinish/remove.. That's just how i do it.

As for melee attack speed, that's doable too. A bit different though. It's a passive effect, meaning it will last as long as the buff lasts, or if you use cvars (a bit more advanced..) Look in items.xml for the exact like, but i think its attacksperminute. It's a passive. Also to note, anything in items.xml that is inside the <effect_group> tags are usable through buffs. Magazine size, stamina loss, all that stuff.

 
Last edited by a moderator:
Np glad to help! You can do it that way, for sure. Use one buff that then splits off. Idk the cvar name for fort bites, so you'd have to check that buff to find out what that is exactly, unless you did already. Another way you can do it is on the actual item itself in items.xml.. you can make a onselfprimaryactionend trigger that gives each buff. Me personally, i like to do as much as possible in one xml file. So i load down with buffs. Ill make the weapon / item give a single buff (usually i call it like.. buffThisWeaponStart) then from there i trigger other buffs via buffstart, buffupdate, or bufffinish/remove.. That's just how i do it.

As for melee attack speed, that's doable too. A bit different though. It's a passive effect, meaning it will last as long as the buff lasts, or if you use cvars (a bit more advanced..) Look in items.xml for the exact like, but i think its attacksperminute. It's a passive. Also to note, anything in items.xml that is inside the <effect_group> tags are usable through buffs. Magazine size, stamina loss, all that stuff.
I got the recog one working correctly thanks to your help and from there I got the fortbite one working too.

I'm stuck again now though.
I made a plate give the RunSpeed buff but I can't figure out how to keep the buff once leaving the plate.

This is what I have:
 

    <buff name="buffSwiftLegs" name_key="buffSwiftLegsName" description_key="buffSwiftLegsDesc" tooltip_key="buffMegaCrushTooltip" icon="ui_game_symbol_pills">
        <stack_type value="replace"/><duration value="0"/>
        <display_value value=".buffSwiftLegsDisplay"/><display_value_format value="time"/>
        <effect_group>
            <triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="$buffSwiftLegsDuration" operation="subtract" value="@$MetabolismDuration"/>
            <triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="set" value="@$buffSwiftLegsDuration"/>
            <triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="divide" value="@$MetabolismDuration"/>
        </effect_group>
        <effect_group>
            <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffSwiftLegs">
                <requirement name="CVarCompare" cvar="$buffSwiftLegsDuration" operation="LTE" value="0"/>
            </triggered_effect>
            <triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="set" value="0"/>
            <triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar="$buffSwiftLegsDuration" operation="set" value="0"/>
        </effect_group>
        <effect_group>
            <passive_effect name="RunSpeed" operation="perc_add" value=".9" duration="500"/>
        </effect_group>
    </buff>
        
</append>

</configs>
 
What will make it work correctly?
I get the buff while on the pressure plate but lose it the instant I get off it.  

I tried using yours as a template at first but I couldn't get the buff to work,this is what I tried:
 

    <buff name="buffSwiftLegs" name_key="buffSwiftLegsName" description_key="buffSwiftLegsDesc" tooltip_key="buffMegaCrushTooltip" icon="ui_game_symbol_pills">
        <stack_type value="replace"/>
        <duration value=".5"/> 
        <!-- you don't need a long duration for a buff that's just used as a trigger -->
        <effect_group name="Set CVar">
            <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffSwiftLegs" operation="set" value="500"/> 
            <!-- set the value here to be w/e you want the duration of the buff to be. -->
        </effect_group>
        <effect_group name="Add RunSpeed Buff">
            <triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="buffSwiftLegs" target="self"/> 
            <!-- this will add the buff, after this buff has finished (in .5 seconds)  -->
        </effect_group>
        <effect_group>
            <passive_effect name="RunSpeed" operation="perc_add" value=".9" duration="500"/>
        </effect_group>
    </buff>
Also wanted to mention that the speed buff plate makes snakes move at light speed but it doesn't affect vehicles while on it lol.


Another smaller issue i'm having is that I have no idea where to put in a items in game description.

 
Last edited by a moderator:
Well, first thing.. Buffs are read top down. This means if you have an on update that subtracts a value, before that value is set, itll mess things up. So what your buff is doing is subtracting from the cvar which is set to 0, so you're going into negative.. then its removing that buff instantly cuz of the requirement update to remove further down the buff. Try setting the cvar at the very top of the buff and see what happens. I would also use a onselfbuffstart instead of update to set the cvar. If you use update, then every tick it will reset that cvar to the value you set. The buff i gave you will work, but it has a duration of half a second. You'll just need to change that, then add in an onselfbuffupdate to subtract from the cvar, as well as add the remove buff stuff with the same requirement.

 
Well, first thing.. Buffs are read top down. This means if you have an on update that subtracts a value, before that value is set, itll mess things up. So what your buff is doing is subtracting from the cvar which is set to 0, so you're going into negative.. then its removing that buff instantly cuz of the requirement update to remove further down the buff. Try setting the cvar at the very top of the buff and see what happens. I would also use a onselfbuffstart instead of update to set the cvar. If you use update, then every tick it will reset that cvar to the value you set. The buff i gave you will work, but it has a duration of half a second. You'll just need to change that, then add in an onselfbuffupdate to subtract from the cvar, as well as add the remove buff stuff with the same requirement.
I really don't know what i'm doing anymore lol.
 

    <buff name="buffSwiftLegs" name_key="buffSwiftLegs" description_key="buffSwiftLegsDesc" tooltip_key="buffMegaCrushTooltip" icon="ui_game_symbol_pills">
        <stack_type value="replace"/><duration value=".5"/>
        <display_value value=".buffSwiftLegsDisplay"/><display_value_format value="time"/>
        <effect_group>
            <passive_effect name="RunSpeed" operation="perc_add" value=".9" duration="500">
            <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="set" value="@$buffSwiftLegsDuration"/>
        <effect_group>
            <triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="buffSwiftLegs" target="self">
                <requirement name="CVarCompare" cvar="$buffSwiftLegsDuration" operation="LTE" value="100"/>
        </effect_group>
    </buff>
        


    <buff name="buffSwiftLegs" name_key="buffSwiftLegs" description_key="buffSwiftLegsDesc" tooltip_key="buffMegaCrushTooltip" icon="ui_game_symbol_pills">
        <stack_type value="replace"/>
        <duration value=".5"/> 
        <!-- you don't need a long duration for a buff that's just used as a trigger -->
        <effect_group name="Set CVar">
            <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="RunSpeed" operation="set" value="500"/> 
            <!-- set the value here to be w/e you want the duration of the recog buff to be. -->
        </effect_group>
        <effect_group>
        <effect_group name="Add RunSpeed Buff">
            <triggered_effect trigger="onSelfBuffFinish" action="AddBuff" buff="RunSpeed" target="self"/> 
            <!-- this will add the recog buff, after this buff has finished (in .5 seconds)  -->
        </effect_group>
    </buff>
Been at this for hours. 
I changed it to onselfbuffstart,deleted several lines,shifted them around,and nothing has worked. At one point I had it give me a 50 second buff that lasted for 5 minutes until I closed it,assuming it had a infinite buff timer while not giving me the actual speed buff,only the text from it.
 

 
Last edited by a moderator:
I wrote this and tested it, it will give a 8 minute buff when you walk on a block that gives it.
 

<buff name="buffSwiftLegs" name_key="buffSwiftLegs" description_key="buffSwiftLegsDesc" tooltip_key="buffMegaCrushTooltip" icon="ui_game_symbol_pills">
<stack_type value="replace"/>
<duration value="0"/>
<display_value value=".buffSwiftLegsDisplay"/>
<display_value_format value="time"/>
<effect_group name="Set CVars">
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffSwiftLegsDuration" operation="set" value="500"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="set" value="@$buffSwiftLegsDuration"/>

<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="subtract" value="1"/>
</effect_group>
<effect_group name="Passive Effects">
<passive_effect name="RunSpeed" operation="perc_add" value=".9"/>
</effect_group>
</buff>



If you want it to do something else, let me know.

Not sure why it put all that in a quote... lol

 
Not sure why it put all that in a quote... lol
Woooow I was over complicating that to hell and back. What I was trying with 5-30 lines you've done in only a few.

When I trigger the buffs,I can't seem to reapply them if it's already going so if I trigger the 8minutes then I have to wait the full 8 minutes before being able to reapply the buff. Is there anyway I can get the plate to retrigger the buff and set it back to the 8 minute cap?
Also,by using what you posted as a template,I got the swing speed working and lol. Slowly turning 7 days into a punching doom mod.


I just reloaded my game when having the buff and when loading back in,the buff turned to 58 minutes long. Eating glass removes it but getting the buff and loading back in with it changes the duration to 58 minutes everytime. Is there anyway to prevent this?

 

 
For the reapplying it part, you can add a onSelfBuffStack just above the first onSelfBuffStart. Have it also set the cvars (basically copy paste the first two lines in Set CVars effect group and rename them to be onSelfBuffStack.) This will make it so when the buff triggers it's stack_type=Replace, it will reset the cvars. As for the reloading... i'm not sure ill have to try it out myself later today after work and get back to you on that.

 
For the reapplying it part, you can add a onSelfBuffStack just above the first onSelfBuffStart. Have it also set the cvars (basically copy paste the first two lines in Set CVars effect group and rename them to be onSelfBuffStack.) This will make it so when the buff triggers it's stack_type=Replace, it will reset the cvars. As for the reloading... i'm not sure ill have to try it out myself later today after work and get back to you on that.
Like this?
 

<buff name="buffSwiftLegs" name_key="buffSwiftLegs" description_key="buffSwiftLegsDesc" tooltip_key="buffMegaCrushTooltip" icon="ui_game_symbol_agility"  icon_color="0,255,0">
        <stack_type value="replace"/>
        <duration value="0"/>
        <display_value value=".buffSwiftLegsDisplay"/>
        <display_value_format value="time"/>
        <effect_group name="Set CVars">
            <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$buffSwiftLegsDuration" operation="set" value="500"/>
            <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="set" value="@$buffSwiftLegsDuration"/>
            <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="$buffSwiftLegsDuration" operation="set" value="500"/>
            <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="set" value="@$buffSwiftLegsDuration"/>
            
            <triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffSwiftLegsDisplay" operation="subtract" value="1"/>
        </effect_group>
        <effect_group name="Passive Effects">
            <passive_effect name="RunSpeed" operation="perc_add" value=".9"/>
            <passive_effect name="AttacksPerMinute" operation="perc_add" value=".9"/>
            <passive_effect name="JumpStrength" operation="perc_add" value=".9"/>
        </effect_group>
    </buff>
It doesn't reset the buff so i'm going to assume I did it wrong. What should it look like?

I've buffed then restarted the game and severytime it applies the buff at 59 minutes without fail on reloading back in when loading out with the buff. It's weird because it doesn't do that with the recog plate buff,also the recog plate buff can be reset without issue by touching the recog plate.
 

 
Back
Top