Jump to content

Displaying values of an item (DisplayType)


Recommended Posts

Hi, I've got a question regarding DisplayType, and if there is a way for a custom item to display it's values, like Armor, Resist, CritResist, w/e "stat" is on the item.

 

image.png.185ff18cab523fd74ac93705645ccd00.png

 

If I had a custom item that had only Armor Rating, Explosion Resist, and Armor Crit Resist. How can I display those 3 "stats"?

Currently I am doing this:

<property name="DisplayType" value="modArmor"/>
<effect_group tiered="false">
  <passive_effect name="PhysicalDamageResist" operation="base_add" value=".1,1"/>
  <passive_effect name="ElementalDamageResist" operation="base_add" value="0,.5" tags="heat,electrical"/>
  <passive_effect name="BuffResistance" operation="base_add" value="0.01,0.03" tags="buffFatiguedTrigger,buffArmSprainedCHTrigger,buffLegSprainedCHTrigger,buffLaceration,buffInfectionCatch,buffInjuryStunned01CHTrigger,buffInjuryBleedingTwo,buffInjuryBleedingBarbedWire,critResistDisplay"/>
</effect_group>

 

Which results with this:

image.png.6a7be034dbab411d2dc0c8f84a259715.png
 

Only thing not being displayed is Armor Crit Resist (BuffResistance).

Thanks for the read!

Link to comment
Share on other sites

First, make a new item display info tag in ui_display.xml:

<item_display_info display_type="modArmorCritResist" display_group="modAttire">
    <display_entry name="PhysicalDamageResist" display_type="Decimal1" title_key="statPhysicalDamageResist" display_leading_plus="true" />
    <display_entry name="ElementalDamageResist" display_type="Decimal1" title_key="statExplosionResistance" display_leading_plus="true" tags="heat,electrical" />
    <display_entry name="BuffResistance" title_key="statBuffResistance" display_type="Percent" tags="critResistDisplay" show_inverted="false" />
</item_display_info>

 

(You can name it whatever you want, I chose "modArmorCritResist" because that made sense to me.)

 

Next, update your custom item to use that display type:

<property name="DisplayType" value="modArmorCritResist" />

 

That should do it.

 

(That is the XML, I didn't include the XPath commands to insert it.)

Link to comment
Share on other sites

So I ran into an issue. I am working on a 2nd item modifier that grants percent damage bonus, the item displays the text correctly, but doesn't seem to grab the value:

image.png.75f2d327e1d76443351bf331262251ab.png

 

Here is my code:

  [ui_display.xml]  

<append xpath="ui_display_info/item_display">
  <item_display_info display_type="modGemstoneBrutality" display_group="modAttire">
    <display_entry name="EntityDamage" display_type="Percent" title_key="statEntityDamage" display_leading_plus="true" />
    <display_entry name="EntityDamage" display_type="Decimal1" title_key="statEntityDamage" display_leading_plus="true" />
  </item_display_info>
</append>

 

[item_modifiers.xml]

<append xpath="/item_modifiers">
  <item_modifier name="modWeaponGemstoneBrutalityT4" installable_tags="weapon,tool" modifier_tags="gemstone_brutality" blocked_tags="noMods" type="attachment">
    <property name="Extends" value="modGeneralMaster"/>
    <property name="CustomIcon" value="modWeaponGemstoneBrutality"/>
    <property name="DisplayType" value="modGemstoneBrutality"/>
    <property name="DescriptionKey" value="modWeaponGemstoneBrutalityBasicDesc"/>
    <effect_group tiered="false">
      <passive_effect name="EntityDamage" operation="perc_add" value=".25,.3"/>
    </effect_group>
  </item_modifier>
</append>

 

Note #1: I dont intend to have the 2nd display_entry line, just there for display testing incase display_type="Decimal1" would have worked.


Note #2: I used "gunBowT0PrimitiveBow" in the items.xml, and "rangedBow" in the ui_displays.xml,

as a random reference on how they display their Entity Damage.

 

Link to comment
Share on other sites

5 hours ago, Numberz said:

 


I don't think it will pull in the EntityDamage value from an item such as this.

 

Look at how this is done on "drinkJarGrandpasMoonshine" to see how you can manually pass the value.

 

Ah, thats too bad, I saw it (statEntityDamage) listed in localization so figured maybe it should display.

But yeah Grandpa's Moonshine, and Recog use statEntityDamageMelee, and statEntityDamageRanged as the title_key and both use <display_entry> rather than <passive_effect>.

 

I now have the item_modifier showing the damage bonus on 2 lines:

image.png.e21045cd1561ad80a2a5edf23bef1185.png

 

Here is the method I am using:

item_modifiers.xml

Spoiler
<configs>
<append xpath="/item_modifiers">
   <item_modifier name="modWeaponGemstoneBrutalityT1" installable_tags="weapon,tool" modifier_tags="gemstone_brutality" blocked_tags="noMods" type="attachment">
      <property name="Extends" value="modGeneralMaster"/>
      <property name="CustomIcon" value="modWeaponGemstoneBrutality"/>
      <property name="DisplayType" value="modGemstoneBrutality"/>
      <property name="DescriptionKey" value="modWeaponGemstoneBrutalityBasicDescT1"/>
      <effect_group>
         <passive_effect name="EntityDamage" operation="perc_add" value="27"/>
         <display_value name="dEntityDamage" value="27"/>
      </effect_group>
   </item_modifier>
</append>
</configs>

 

 

ui_display.xml

Spoiler
<configs>
<append xpath="ui_display_info/item_display">
    <item_display_info display_type="modGemstoneBrutality" display_group="modAttire">
      <display_entry name="dEntityDamage" title_key="statEntityDamageMelee" display_type="Percent" display_leading_plus="true" />
      <display_entry name="dEntityDamage" title_key="statEntityDamageRanged" display_type="Percent" display_leading_plus="true" />
    </item_display_info>
</append>
</configs>

 

 

 

I have a question though, if I want a cvar to roll between 10 to 25, then apply that cvar as the value, how would I generate that cvar? I have an idea how to generate cvars using <trigger_effect> but is that what I want to use here too? or is there a different method I'd use here?

Here is an example of what I want to do:

<!-- cvar name = roll_range -->
<!-- rolls a value between 10 to 25 -->

<!-- use the cvar as the value entry -->
<passive_effect name="EntityDamage" operation="perc_add" value="@roll_range"/>
<display_value name="dEntityDamage" value="@roll_range"/>

 

This way I can have item_modifiers roll a value within a range, and the EntityDamage and Displaying of EntityDamage are the same value.

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