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

Code Help

AaronG85

Refugee
Trying to add a food with a chance of a buff occurring. I have the following code that works for the buff but only gives food and health when the buff hits not every time the food is eaten.

Code:
			<effect_group tiered="false" name="Food Tier 0">
				<requirement name="CVarCompare" cvar="$buffSugarHighDuration" operation="GT" value="1803"/>
				<display_value name="dRunSpeed" value=".1"/>
				<display_value name="$waterAmountAdd" value="-5"/>
				<display_value name="dDuration" value="20"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="3"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="0"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$waterAmountAdd" operation="add" value="0"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" target="self" buff="buffProcessConsumables"/>
					<requirement name="RandomRoll" seed_type="Random" target="self" min_max="0,100" operation="LTE" value="20"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$buffSugarHigh" operation="add" value="603"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$buffSugarHigh" operation="set" value="1803">
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffSugarHigh"/>
				</triggered_effect>
			</effect_group>
 
That buff is what handles the food stuff. So when it doesn't fire it won't add the values properly.

Are you just testing with that buff or does it have to be that one? If you just change buffProcessConsumables to whatever buff you want to be random, and add the normal line food items have to fire buffProcessConsumables it should be fine.

 
<effect_group tiered="false">
<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="8"/>
<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$waterAmountAdd" operation="add" value="10"/>
<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="2"/>
<requirement name="RandomRoll" seed_type="Random" target="self" min_max="0,100" operation="LTE" value="20"/>
<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" target="self" buff="buffMouthBleed"/>


So would this work?

 
Back
Top