Jump to content

Using a perk (game variable) as a value


Recommended Posts

I'm trying to simplify some code for a custom Buff, where its Duration is increased based on a Perk's level, trying to use the Perk as a Value input, the following throws an error

<effect_group>
   <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="set" value="5"/>
   <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="add" value="#perkPummelPete"/>
</effect_group>

 

Note 1: Looking into the Documentation section of Buff.xml, I see this:

Quote

value (Float,@cvar,#gameVariable) : Leading with @/# will parse the value of an existing cvar or game variable instead of a number.

 

 

Note 2: I've tried adding   target="self"   to the triggered_effect line of code that uses   value="#perkPummelPete"   and still fails.

 

 

Note 3: The Error being thrown:

image.png.704a02602d25a71628d234fecdc61a72.png

 

 

 

 

The currently working code, to be simplified:

Spoiler
<effect_group>
  <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="set" value="5"/>
  <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="add" value="1"/>
      <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="1"/>
  </triggered_effect>
  <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="add" value="2"/>
      <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="2"/>
  </triggered_effect>
  <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="add" value="3"/>
      <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="3"/>
  </triggered_effect>
  <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="add" value="4"/>
      <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="4"/>
  </triggered_effect>
  <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="add" value="5"/>
      <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="5"/>
  </triggered_effect>
</effect_group>

 

 

Edited by Bladestorm Games (see edit history)
Link to comment
Share on other sites

The cvar would still have to be set somewhere, if not in the buff as you already have, it could be done on the perk using kind of the same format you have. Or you could add it to the status check buffs, or buffPerkAbilityUpdate where TFP stores several already.

 

But a perk isn't a variable, so it won't work as you are trying. Honestly, if it works fine as you have it, I'd just leave it as is.

Link to comment
Share on other sites

Thanks for the help, I went with the buffPerkAbilityUpdate "method", where I store some custom variables based on the level of perkPumelPete.

 

I'll provide my code for my custom buff, but some notes:

1) Buff name is Enraged.

2) If you have atleast 1 point into Pummel Pete, your Power Attacks will grant the buff (renew/stack if you already have the buff).

3) Buff grants 10% Attack Speed, and 10% Movement Speed per Stack of Enraged.

4) The Buff displays a UI for the Duration, and another UI for the Effect/Value granted by the buff

<!-- ########### -->
<!-- Enraged Buff-->
<append xpath="/buffs/buff[@name='buffPerkAbilityUpdate']">
  <!-- Enraged Duration and Effect Limit -->
  <!-- Base Value -->
  <effect_group>
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedDuration" operation="set" value="5"/>
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedEffectLimiter" operation="set" value="0"/>
  </effect_group>


  <!-- Add to Value based on Perk Level -->
  <!-- Perk T1 -->
  <effect_group name="perkT1">
    <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="1"/> 
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedDuration" operation="add" value="1"/>
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedEffectLimiter" operation="add" value=".1"/>
  </effect_group>
  <!-- Perk T2 -->
  <effect_group name="perkT2">
    <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="2"/> 
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedDuration" operation="add" value="2"/>
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedEffectLimiter" operation="add" value=".2"/>
  </effect_group>
  <!-- Perk T3 -->
  <effect_group name="perkT3">
    <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="3"/> 
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedDuration" operation="add" value="3"/>
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedEffectLimiter" operation="add" value=".3"/>
  </effect_group>
  <!-- Perk T4 -->
  <effect_group name="perkT4">
    <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="4"/> 
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedDuration" operation="add" value="4"/>
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedEffectLimiter" operation="add" value=".4"/>
  </effect_group>
  <!-- Perk T5 -->
  <effect_group name="perkT5">
    <requirement name="ProgressionLevel" progression_name="perkPummelPete" operation="Equals" value="5"/> 
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedDuration" operation="add" value="5"/>
    <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar="$EnragedEffectLimiter" operation="add" value=".5"/>
  </effect_group>
</append>

<append xpath="/buffs">
  <!-- Enraged: Split into 2 buffs to display a UI for the Duration, and a UI for the stacking Effect % -->

  <!-- ################## -->
  <!-- Enraged's Duration -->
  <buff name="buffEnragedTimer" name_key="buffEnragedName" description_key="buffEnragedDesc" showonhud="true" icon="ui_game_symbol_spear" icon_color="0,255,0">
    <stack_type value="replace"/>
    <duration value="0"/>
    <display_value value=".buffEnragedDuration"/>
    <display_value_format value="time"/>
    <effect_group>
      <!-- Duration Handling -->
      <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".buffEnragedDuration" operation="set" value="@$EnragedDuration"/>
      <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar=".buffEnragedDuration" operation="set" value="@$EnragedDuration"/>


      <!-- Cleanup Handling -->
      <triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar=".buffEnragedDuration" operation="add" value="-1"/>
      <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffEnragedTimer">
        <requirement name="CVarCompare" cvar=".buffEnragedDuration" operation="LTE" value="0"/>
      </triggered_effect>
      <triggered_effect trigger="onSelfBuffUpdate" action="RemoveBuff" buff="buffEnragedEffect">
        <requirement name="CVarCompare" cvar=".buffEnragedDuration" operation="LTE" value="0"/>
      </triggered_effect>
      <triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar=".buffEnragedDuration" operation="set" value="0"/>
    </effect_group>
  </buff>

  <!-- ################# -->
  <!-- Enraged's Effects -->
  <buff name="buffEnragedEffect" name_key="buffEnragedName" description_key="buffEnragedDesc" showonhud="true" icon="ui_game_symbol_spear" icon_color="0,255,0">
    <stack_type value="replace"/>
    <duration value="0"/>
    <display_value value=".EnragedDisplayEffect"/>
    <display_value_key value="+{0}%"/>
    <effect_group>
      <!-- Buff apply and stack handling -->
      <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".EnragedEffect" operation="set" value=".1"/>
      <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar=".EnragedEffect" operation="add" value=".1">
        <requirement name="CVarCompare" cvar=".EnragedEffect" operation="LT" value="@$EnragedEffectLimiter"/>
      </triggered_effect>

      <!-- Tooltip Update Handling -->
      <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".EnragedDisplayEffect" operation="set" value="@.EnragedEffect"/>
      <triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar=".EnragedDisplayEffect" operation="multiply" value="100"/>
      <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar=".EnragedDisplayEffect" operation="set" value="@.EnragedEffect"/>
      <triggered_effect trigger="onSelfBuffStack" action="ModifyCVar" cvar=".EnragedDisplayEffect" operation="multiply" value="100"/>

      <!-- Apply Stats -->
      <passive_effect name="AttacksPerMinute" operation="perc_add" value="@.EnragedEffect"/>
      <passive_effect name="RunSpeed" operation="perc_add" value="@.EnragedEffect"/>
      <passive_effect name="WalkSpeed" operation="perc_add" value="@.EnragedEffect"/>

      <!-- Buff Removal Handling -->
      <triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar=".EnragedEffect" operation="set" value="0"/>
      <triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar=".EnragedDisplayEffect" operation="set" value="0"/>
    </effect_group>
  </buff>
</append>

 

 

And here are some visuals:
pummelPete_progression.gif.ab80831a0b6dc20363d4d1470f383d35.gif


enraged_tooltip.png.0e6482ed0feaf28e810049f2094d9692.png

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