Jump to content

How do you subtract food


Vanblam

Recommended Posts

I tried different ways, but nothing seems to work. Does anyone know how to remove food with an item? I have this atm: 

 

<item name="devBrownPill">
			<property name="Tags" value="dev"/>
			<property name="HoldType" value="31"/>
			<property name="CustomIcon" value="drugPainkillers"/> <property name="CustomIconTint" value="895717"/>
			<property name="DisplayType" value="drugBrownPill"/>
			<property name="DescriptionKey" value="devBrownPillDesc"/>
			<property name="Meshfile" value="#Other/Items?Health/painkillersPrefab.prefab"/>
			<property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
			<property name="Material" value="Morganic"/>
			<property name="Stacknumber" value="5000"/> <!-- STK food -->
			<property class="Action0">
				<property name="Class" value="Eat"/>
				<property name="Delay" value="2.1"/>
				<property name="Use_time" value="..."/>
				<property name="Sound_start" value="player_eating"/>
			</property>
			
			<effect_group tiered="false" name="Food Tier 0">
				<!-- <display_value name="$foodAmountAdd" value="-80"/> -->
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="subtract" value="80"/>
			</effect_group>
		</item>

I realize the cvar says $foodAmountAdd, I tried $foodAmountSubtract and that still did nothing (It did not throw an error or a warning when I tried that).

Link to comment
Share on other sites

I think it might actually be working, because when I eat regular food my food level does not go up, until I eat past the -80. So I guess I need it to actually take it away instantly instead of slowly or halting (If that's possible). I wanted to test some hunger things but I can't fin a very fast way to remove food to check hunger. The command "starve" does nothing.

Link to comment
Share on other sites

You'll need to use a modifystats trigger if you want it to be instant.


                <triggered_effect trigger="onSelfBuffUpdate" action="ModifyStats" stat="food" operation="add" value="100"/>

You can use any trigger, so that onselfprimaryaction will work. This is just a snip from a mod i'm doing now, so it's set up for what i need.

Link to comment
Share on other sites

1 hour ago, Telric said:

You'll need to use a modifystats trigger if you want it to be instant.


                <triggered_effect trigger="onSelfBuffUpdate" action="ModifyStats" stat="food" operation="add" value="100"/>

You can use any trigger, so that onselfprimaryaction will work. This is just a snip from a mod i'm doing now, so it's set up for what i need.

Thank you very much, worked like a charm :D

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...