Jump to content

Is there any way to give player XP when they use a consumable item?


mjrice

Recommended Posts

I thought this would be easy but I can not figure it out. I have tried maybe 10 different ways to simply give the player XP when a consumable item is used. I can give xp when a block is destroyed, and I can give xp when a recipe is crafted no problem. But not when an item is used?

 

Here is an example item for discussion:

 

<item name="foodBlueberryPie">
<property name="HoldType" value="31"/>
<property name="DisplayType" value="food"/>
<property name="Meshfile" value="Items/Misc/parcelPrefab"/>
<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/>
<property name="Material" value="Morganic"/>
<property name="Stacknumber" value="50"/> <!-- STK food -->
<property name="EconomicValue" value="124"/>
<property class="Action0">
	<property name="Class" value="Eat"/>
	<property name="Delay" value="1.0"/>
	<property name="Use_time" value="..."/>
	<property name="Sound_start" value="player_eating"/>
	<!-- jar from cooking food <property name="Create_item" value="drinkJarEmpty"/> -->
</property>
<property name="Group" value="Food/Cooking"/>

<effect_group tiered="false">
	<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd" operation="add" value="45"/>
	<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="foodHealthAmount" operation="add" value="22"/>
	<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" target="self" buff="buffProcessConsumables"/>
</effect_group>
</item>

 

Let's say I want to give the player 40XP when they eat a blueberry pie. I have tried putting things like this in the Action0 property group

 

<property name="PlayerExpGain" operation="add" value="40"/>

 

I have also tried "PlayerExp". And this:

 

	<property name="ActionExp"                value="40" />
<property name="ActionExpBonusMultiplier" value="1"/>

 

I have also tried putting something in the effect_group like these:

 

<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="PlayerExp" operation="add" value="40"/> 

or

<triggered_effect name="PlayerExpGain" operation="add" value="40" /> 

 

But none of those work, either. I even tried doing it through a buff, where using the item applies the buff which then looks something like this:

 

<buff name="eatAPie">
	<duration value="0"/>
<effect_group>
	<passive_effect name="PlayerExpGain" operation="add" value="40" />
</effect_group>
</buff>

 

But alas, no matter what I have tried I can not seem to get it to work. I can't tell you how many blueberry pies I have eaten so far. please help if you can

Link to comment
Share on other sites

<buff name="buffDrunkGrandpasLearningElixir" name_key="buffDrunkGrandpasLearningElixirName" description_key="buffDrunkGrandpasLearningElixirDesc" tooltip_key="buffDrunkGrandpasLearningElixirTooltip" icon="ui_game_symbol_beer">
	<stack_type value="duration"/>
	<duration value="240"/>
	<effect_group>
		<passive_effect name="PlayerExpGain" operation="perc_add" value=".2" />
	</effect_group>
</buff>

 

i found this in buffs.xml

Link to comment
Share on other sites

I am very happy to report that I found how to do it after several more tries. The key is to add something like this to the effect_group for the item:

 

<triggered_effect trigger="onSelfPrimaryActionEnd" action="GiveSkillExp" target="self" skill="attIntellect" experience="44"/>

 

I don't know if "skill=attIntellect" is relevant, but it worked.

 

Also earlier when I said I knew how to give exp when an item is crafted... I was wrong, that doesn't actually work. What I was trying was to put a craft_exp_gain attr in the recipe, but it doesn't seem to do anything. So that is probably what I will try to figure out next.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...