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

Help needed with buffs.xml - what am I doing wrong?

poly

New member
Hi all,

I hope somebody here can advise.

I'm trying to create buff that plays a sound when a variable achieved.

Here is my code:

<passive_effect name="CraftingOutputCount" operation="perc_set" value="@$machineoutput" tags="testslot"/>

<triggered_effect trigger="onSelfBuffUpdate" action="PlaySound" sound="open_apache_artifact_chest" play_in_head="true">
<requirement name="CVarCompare" cvar="@$machineoutput" operation="Equals" value="10" tags="slot100"/>
</triggered_effect>




The code works fine without the triggered effect. the '@$machineoutput' is sent out and works okay in game.

@$machineoutput is a random number from 10 to 100.

What I'm trying to do is if the number hits 10 (the lowest possible number), a sound is played.

I have tried everything but nothing works. I have tried putting it in it's own effect group, putting the triggered before the passive, creating a secondary buff etc.

The closest I have got is it plays the sound nonstop in game, regardless of the passive effect being active or not.

Can anyone seeing anything obviously wrong with the code?

Thanks

 
Does anyone have any suggestions before I shelf this idea, been trying to 2 weeks+ every day with no avail. 😁

 
Not sure  if the tags property is messing with the requirement check. I couldn't find an instance of a tag being used in that way in vanilla files. Without seeing the rest of the code, that's the only thing that sticks out to me.

 
Not sure  if the tags property is messing with the requirement check. I couldn't find an instance of a tag being used in that way in vanilla files. Without seeing the rest of the code, that's the only thing that sticks out to me.
Thanks so much for the reply!

Here is a simplified code, for context, I'm trying to make a casino mod with slot machines, the sound effect is supposed to mimic a kind of jackpot win feeling!

<buff name="DoubleORNothing" hidden="true">
<update_rate value="1"/>
<stack_type value="ignore"/>
<effect_group>
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="$doubleornothing" operation="setvalue" value="randomint(0,1)"/>
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="$doubleornothing" operation="multiply" value="2"/>

<passive_effect name="CraftingOutputCount" operation="perc_set" value="@$doubleornothing" tags="doubleornothing"/>

</effect_group>

<effect_group>
<triggered_effect trigger="onSelfBuffUpdate" action="AddBuff" buff="SlotWin">
<requirement name="CraftingOutputCount" operation="GT" value="0.1"/>
</triggered_effect>
</effect_group>

</buff>

<buff name="SlotWin" hidden="true">
<duration value="2"/>
<stack_type value="ignore"/>
<effect_group>
<triggered_effect trigger="onSelfBuffStart" action="PlaySound" sound="open_apache_artifact_chest" play_in_head="true"/>
<triggered_effect trigger="onSelfBuffFinish" action="StopSound" sound="open_apache_artifact_chest" play_in_head="true"/>
</effect_group>
</buff>



Essentially what happens here is a random number is generated between 0 and 1. If the number is 1 a buff is triggered, the buff will be a sound effect!

However, what happens with this code is that when I log into the world the sound affect triggers constantly, without being in the crafting menu or having crafted the item to produce the CraftingOutputCount

 
Chances are the craftingoutputcount is not working yet. Most of the ones that have //hook up next to them in buffs.xml are not working. If you're wanting a specific item to be crafted in order to trigger this, every time you craft an item, you log a cvar on your character. Go into DM, hit f3 and hit the PLY tickbox at the top left. It will show some cvars on the right. The _craftCount_XXX is logged and tracked when you craft anything, so you could use that as a requirement. It's read only so you can't set it to a value, but you can track it like leveling is tracked. Look up 'buffLevelUpTracking' in buffs.xml to see how thats done. Pretty simple to do for other cvars.

 
Back
Top