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

Issue with Item Modifiers granting/loosing Buff on Equip

Bladestorm Games

New member
Hey, so while working on a mod I've encountered an odd issue/bug.

I have 3 different item modifiers which socket into a Chest Armor. 

If you were to equip the 3 item modifiers while the Chest Armor is in the inventory (not equipped) and then equip the Chest Armor, you'll gain the buff from each item modifier.

If you were to equip the 3 item modifiers while the Chest Armor is Equipped, then the issues start, where as you equip a modifier, the previous modifier falls off.

Here is a video that showcases this:

https://youtu.be/4OCipG-WZeI

Here is the code I am running:

item_modifiers.xml:

<configs>
<append xpath="/item_modifiers">
<!-- Test Item #1 -->
<item_modifier name="modGiveBuff1" installable_tags="armorChest" modifier_tags="mod_test_buff1" blocked_tags="noMods" type="attachment">
<property name="Extends" value="modGeneralMaster"/>
<property name="CustomIcon" value="modBuffTest1"/>
<property name="DescriptionKey" value="modBuffTestBasicDesc"/>

<effect_group name="grant_buff">
<triggered_effect trigger="onSelfEquipStart" action="AddBuff" buff="buffEquipTest1"/>
<triggered_effect trigger="onSelfEquipStop" action="RemoveBuff" buff="buffEquipTest1"/>
</effect_group>
</item_modifier>

<!-- Test Item #2 -->
<item_modifier name="modGiveBuff2" installable_tags="armorChest" modifier_tags="mod_test_buff2" blocked_tags="noMods" type="attachment">
<property name="Extends" value="modGeneralMaster"/>
<property name="CustomIcon" value="modBuffTest2"/>
<property name="DescriptionKey" value="modBuffTestBasicDesc"/>

<effect_group name="grant_buff">
<triggered_effect trigger="onSelfEquipStart" action="AddBuff" buff="buffEquipTest2"/>
<triggered_effect trigger="onSelfEquipStop" action="RemoveBuff" buff="buffEquipTest2"/>
</effect_group>
</item_modifier>

<!-- Test Item #3 -->
<item_modifier name="modGiveBuff3" installable_tags="armorChest" modifier_tags="mod_test_buff3" blocked_tags="noMods" type="attachment">
<property name="Extends" value="modGeneralMaster"/>
<property name="CustomIcon" value="modBuffTest3"/>
<property name="DescriptionKey" value="modBuffTestBasicDesc"/>

<effect_group name="grant_buff">
<triggered_effect trigger="onSelfEquipStart" action="AddBuff" buff="buffEquipTest3"/>
<triggered_effect trigger="onSelfEquipStop" action="RemoveBuff" buff="buffEquipTest3"/>
</effect_group>
</item_modifier>
</append>
</configs>






buffs.xml

<configs>
<append xpath="/buffs">
<!-- Buff #1 for Testing-->
<buff name="buffEquipTest1" name_key="buffEquipTestName" description_key="buffEquipTestDesc" showonhud="true" icon="modBuffTest1" icon_color="0,255,0">
<stack_type value="replace"/>
<duration value="0"/>
<effect_group name="handling">
<!-- Apply Effect -->
<passive_effect name="HealthMax" operation="base_add" value="5"/>
</effect_group>
</buff>

<!-- Buff #2 for Testing-->
<buff name="buffEquipTest2" name_key="buffEquipTestName" description_key="buffEquipTestDesc" showonhud="true" icon="modBuffTest2" icon_color="0,100,255">
<stack_type value="replace"/>
<duration value="0"/>
<effect_group name="handling">
<!-- Apply Effect -->
<passive_effect name="HealthMax" operation="base_add" value="10"/>
</effect_group>
</buff>

<!-- Buff #3 for Testing-->
<buff name="buffEquipTest3" name_key="buffEquipTestName" description_key="buffEquipTestDesc" showonhud="true" icon="modBuffTest3" icon_color="165,0,255">
<stack_type value="replace"/>
<duration value="0"/>
<effect_group name="handling">
<!-- Apply Effect -->
<passive_effect name="HealthMax" operation="base_add" value="15"/>
</effect_group>
</buff>
</append>
</configs>






And if anyone were to want to see the project/mod, heres a link:

(Includes the icons and localization)

https://drive.google.com/file/d/1rqNa03Y1ldnBdgsykMdfiUCYvB30xpPr/view?usp=share_link

 
I am not a modder currently, so just wildly guessing, but maybe stack_type "replace" and them being in the same effect group means a buff gets replaced by other buffs of the same group (or name_key) ?

 
I am not a modder currently, so just wildly guessing, but maybe stack_type "replace" and them being in the same effect group means a buff gets replaced by other buffs of the same group (or name_key) ?


Thanks for the idea! I will go ahead and test that out later tonight, and report back.

Update: I've changed the buff's effect_group name, to be different from each other, and also changed stack_type "replace" to "ignore".

Unfortunately still getting the same issue.

 
Last edited by a moderator:
If you don't find a solution I would definitely look into making a bug report for it. I know onSelfEquip has had issues, but I don't know if they ever fixed them.

 
If you don't find a solution I would definitely look into making a bug report for it. I know onSelfEquip has had issues, but I don't know if they ever fixed them.


I just updated my reply to meganoth, and sadly the issue still persists after changing the effect_group and stack_type bits.

I will be trying to mess with it a bit more over the next few days, and if I can't figure anything out, I'll make a bug post.

Update: While typing this post, I got an idea:

The core game has a modifier "Bandolier", does it also suffer from the issue/bug?

Well I just made a quick edit to the buffs.xml giving the Bandolier mod an icon, and yes it also suffers from the issue/bug:

https://youtu.be/77U7Fi5MgvU

 
I did some testing too, unfortunately I didn't find a solution to your problem but found out some consistencies on how the buffs applied. It seems that if you equip an even amount of mods, the mods in even positions (starting from the top) are used and apply the buff. So if you have two or four mods on, the buffs from slots two and four are used. Same works with uneven amounts. If you have one or three mods, the buffs from slots one and three are used. So, for example, if you have modGiveBuff1 on the first slot and modGiveBuff 3 on third slot, you have an even amount of mods on and thus the slots two and four are used. However, they are empty and as a result you get no additional health. This does seem to work, as you found out too, with other properties than HealthMax as well.

 
I did some testing too, unfortunately I didn't find a solution to your problem but found out some consistencies on how the buffs applied. It seems that if you equip an even amount of mods, the mods in even positions (starting from the top) are used and apply the buff. So if you have two or four mods on, the buffs from slots two and four are used. Same works with uneven amounts. If you have one or three mods, the buffs from slots one and three are used. So, for example, if you have modGiveBuff1 on the first slot and modGiveBuff 3 on third slot, you have an even amount of mods on and thus the slots two and four are used. However, they are empty and as a result you get no additional health. This does seem to work, as you found out too, with other properties than HealthMax as well.
The good new is, if you put all the item modifiers on the armor, AND THEN equip the armor, then it doesnt break and applies all modifiers properly.

I am working on a mod that introduces ~45 Item Modifiers, and mostly all of them use the Buff on Equip method to give the player stats/effects, but for now Im thinking of just making a disclaimer telling people to NOT apply Item Modifiers if the armor is equipped.

 
Back
Top