Modding:Item Json Properties: Difference between revisions

From Vintage Story Wiki
Line 666: Line 666:
   <td>If set to true, will allow the player to select the wearable item during the character creation sequence.</td>
   <td>If set to true, will allow the player to select the wearable item during the character creation sequence.</td>
   <td>Lowerbody, Upperbody</td>
   <td>Lowerbody, Upperbody</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_damredtiered" data-tt-parent="p_attributes_equip">perTierFlatDamageReductionLoss</div></td>
  <td>array of numbers</td>
  <td>-</td>
  <td>Determines how much flat damage reduction is lost by a damage tier higher than the armor tier. Each relative difference can be customized individually.</td>
  <td>armor</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_drelativetiered" data-tt-parent="p_attributes_equip">perTierRelativeProtectionLoss</div></td>
  <td>array of numbers</td>
  <td>-</td>
  <td>Determines how much relative protection is lost by a damage tier higher than the armor tier. The first value is used for high damage resistant armor, the second is for all other armors.</td>
  <td>armor</td>
</tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_pertier_info" data-tt-parent="p_alist_drelativetiered" data-invisible="true"></div></td>
    <td colspan="4">
As an example, we'll look at how the default values are assigned in Vintage Story:
<syntaxhighlight lang="json">
defaultProtLoss: {
  perTierRelativeProtectionLoss: [0.03, 0.15],
  perTierFlatDamageReductionLoss: [0.1, 0.2],
},
</syntaxhighlight>
Here we see that both relative protection and flat damage reduction will be lost by two different amounts. If the armor has the highDamageTierResistant property set to true it will use the first value, otherwise it will use the second value. 
NOTE: If necessary, these values can also be defined per item as a protectionModifiers property.
  </td>
</tr>
</tr>
<tr>
<tr>
Line 716: Line 685:
   <td>boolean</td>
   <td>boolean</td>
   <td>false</td>
   <td>false</td>
   <td>If set to true, uses the "damage resistant" category for protection losses per tier.</td>
   <td>If set to true this armor will reduce the protection loss of higher damage tiers by half when looping through the protection loss sequence of the damage calculation.</td>
   <td>armor</td>
   <td>armor</td>
</tr>
</tr>
Line 733: Line 702:
   <td>armor</td>
   <td>armor</td>
</tr>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_damredtiered" data-tt-parent="p_alist_protmodlist">perTierFlatDamageReductionLoss</div></td>
  <td>array of numbers</td>
  <td>-</td>
  <td>Determines how much flat damage reduction is lost by a damage tier higher than the armor tier. Each relative difference can be customized individually.</td>
  <td>armor</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_drelativetiered" data-tt-parent="p_alist_protmodlist">perTierRelativeProtectionLoss</div></td>
  <td>array of numbers</td>
  <td>-</td>
  <td>Determines how much relative protection is lost by a damage tier higher than the armor tier. The first value is used for high damage resistant armor, the second is for all other armors.</td>
  <td>armor</td>
</tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_pertier_info" data-tt-parent="p_alist_protmodlist" data-invisible="true"></div></td>
    <td colspan="4">
The system for how these values are used is a bit complex, but here's essentially how it works:
The tier of incoming damage is not just a contest of values, but is actually looped through multiple times depending on the tier value to reduce the effectiveness of an armor. For example, tier 4 damage will loop four times and reduces the armor effectiveness each loop, while tier 1 damage will loop only once.
The looped value starts as 1 and As the value increases up to the damage tier it is compared to the tier of the armor. If this increasing value is greater than the armor tier the second second value is used in the perTier function, otherwise the first value is used. Additionally, if the armor has the highDamageTierResistant property set to true then every loop which is higher than the armor will have it's armor reduction halved.
Lets look at an example of this using an armor with the following stats:
<syntaxhighlight lang="json">
protectionModifiers {
  protectionTier: 2,
  flatDamageReduction: 1.0,
  relativeProtection: 0.80,
  perTierFlatDamageReductionLoss: [0.03, 0.15],
  perTierRelativeProtectionLoss: [0.1, 0.2],
  highDamageTierResistant = true
},
</syntaxhighlight>
Now lets loop through the protection values and see what the overall loss is. The damage tier is 4, so we start with 1 and end with 4:
'''Round 1''': Damage tier = 1, armor tier = 2
- Damage tier is below the armor tier in the loop, so we use the first values (0.03 and 0.1)
'''Round 2''': Damage Tier = 2, armor tier = 2
- Damage tier is still not higher in the loop, so once again we use the first values (0.03 and 0.1)
'''Round 3''': Damage Tier = 3, armor tier = 2
- At last the damage tier is higher than the armor tier in the loop so we use the second values (0.15 and 0.2), but we also have the <code>highDamageTierResistant</code> property, so both these values are halved, resulting in (0.075 and 0.1)
'''Round 4''': Damage tier = 4, armor tier = 2
- Same as before, resulting in (0.075 and 0.1).
Finally, we add up the results of each to determine the total loss of protection: (0.21 and 0.4), which causes a 21% loss to our damage reduction and 0.4 loss to our flat damage reduction. This leaves our original protection values at 59% and 0.6, a significant loss in armor performance!
If the damage was of a lower tier, such as 1, only the first round would be used, which would result in a much lower protection loss of 3% and 0.1 damage in total.
  </td>
</tr>
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_astats" data-tt-parent="p_attributes_equip">statModifiers</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_astats" data-tt-parent="p_attributes_equip">statModifiers</div></td>
Line 786: Line 813:
<td scope="row"><div class="tt" data-tt-id="p_attributes_handbook" data-tt-parent="root">(Handbook Attributes)</div></td>
<td scope="row"><div class="tt" data-tt-id="p_attributes_handbook" data-tt-parent="root">(Handbook Attributes)</div></td>
<td colspan="4">
<td colspan="4">
Attributes primarily that give an item additional handbook details.
Attributes that give an item additional handbook details.
</tr>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_hlist_exclude" data-tt-parent="p_attributes_handbook">exclude</div></td>
  <td>-</td>
  <td>-</td>
  <td>If true, removes the item from the handbook. Can be used with the "ByType" functionality to remove large amounts of variants.</td>
  <td>burnedbrick</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_hlist_excludelist" data-tt-parent="p_attributes_handbook">excludeFromList</div></td>
  <td>-</td>
  <td>-</td>
  <td>(Needs more info).</td>
  <td>-</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_hlist_sections" data-tt-parent="p_attributes_handbook">extraSections</div></td>
  <td>-</td>
  <td>-</td>
  <td>Adds a section to the handbook for this item (requires a lang file input).</td>
  <td></td>
</tr>


<tr>
<tr>
219

edits