Jump to content

Attempting to add a Thermos to the game, help with code?


Recommended Posts

The code looks like this but does not work for obvious reasons.

 

		<item name="drinkThermosRiverWater">
			<property name="HoldType" value="3"/>
   			<property name="CustomIcon" value="drinkThermosRiverWater"/>
			<property name="DisplayType" value="waterDysentery"/>
			<property name="Meshfile" value="#Other/Items?Food/bottled_waterPrefab.prefab"/>
			<property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
			<property name="Material" value="Mglass"/>
			<property name="Stacknumber" value="125"/>
			<property name="Weight" value="10"/>
			<property name="EconomicValue" value="20"/>
			<property name="EconomicBundleSize" value="1"/>
			<property name="SellableToTrader" value="false"/>
			<property name="CraftingIngredientTime" value="10"/>
			<property class="Action0">
				<property name="Class" value="Eat"/>
				<property name="Delay" value="0"/>
				<property name="Sound_start" value="player_drinking"/>
			</property>
			<property name="Group" value="Food/Cooking,CFDrink/Cooking"/>

			<effect_group tiered="false" name="Drink Tier 0">
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar=".usesThermos" operation="add" value="-1"/>
					<requirement name="CVarCompare" cvar=".usesThermos" operation="GTE" value="1"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar=".usesThermos" operation="set" value="0"/>
					<requirement name="CVarCompare" cvar=".usesThermos" operation="LTE" value="0"/>
						<property name="Create_item" value="drinkThermosEmpty"/>
				<requirement name="NotHasBuff" buff="buffIsOnFire"/>

				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$waterAmountAdd" operation="add" value="10"/>
				<display_value name="dStaminaRegen" value=".15"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffProcessConsumables"/>

				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar=".DiseaseRoll" operation="set" value="12"/><display_value name="dDysenteryRisk" value=".12"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar=".DiseaseRoll" operation="add" value="@$MetabolismResist"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffDysenteryCatchDrink">
					<requirement name="RandomRoll" seed_type="Random" min_max="1,100" operation="LTE" value="@.DiseaseRoll"/>
				</triggered_effect>
			</effect_group>

			<effect_group tiered="false">
				<requirement name="HasBuff" buff="buffIsOnFire"/>
					<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffExtinguishFire"/>
			</effect_group>

			<effect_group name="drink">
			</effect_group>
		</item>

 

Does anyone know if there is a way to add variables that can track how many times the Thermos is drank from?

 

The only alternative is simply unrealistic: Adding in 5 items for every drink in the game, for each stage of the Thermos' uses. Such as "drinkThermosRiverWater5/5"->"drinkThermosRiverWater4/5"->"drinkThermosRiverWater3/5"-> etc... one item for every time the object is drank from, simply destroying the item when drank and creating the next item down with 1/5th less to drink each time until it is back to empty.

 

I'd much prefer to have internal variables handle that instead. Unless someone knows of a way to make the Thermos work like a gun and refill using drinks as ammo. Or better yet, if the game can even handle it, have the thermos give thirst equal to the amount your character is missing, and reducing the amount used from the amount left. Then you could just use the recipes that I have already created to refill an empty thermos with 5 of any of the drink types in the game.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...