Jump to content

Attributer


Yew

Recommended Posts

attributer-quick.png.feebbcfa4c35ad73fe19501d6dd1f078.png

A mod which allows the changing of item stats/properties (attributes) dynamically!
For developers and server admins.

Mod Page


 

Why?:

Items in Vintage Story can have attributes, which are properties of an item.
For example, when you heat metal in a forge, it gets a "temperature" attribute on the specific item.
Internally, the game then checks the attribute on the item (in this case, a bar of metal) to do things, such as letting you hammer it on an anvil.

However, not all items in the game use per-item attributes, but rather just read them directly from the parent object.
For example, weapons have an attackpower attribute, but it is only accessed from the parent object.
Therefore, even if you gave the attribute to an individual weapon, the game would completely ignore it.

Attributer changes this by patching in checks for attributes on individual items to take priority over the parent items.
If it does find the attribute assigned, then it will use that, otherwise it will just act like normal.


New Attributes:

  • maxdurability.

Supported Attributes:

  • defaultProtLoss
  • protectionModifiers
    • protectionTier
    • highDamageTierResistant
    • flatDamageReduction
    • relativeProtection
  • statModifiers
    • healingeffectiveness
    • hungerrate
    • rangedWeaponsAcc
    • rangedWeaponsSpeed
    • walkSpeed
  • damage
  • attackpower
  • attackrange
  • miningspeed
  • miningtier
  • health
  • clothescategory
  • breakChanceOnImpact
  • requiresAnvilTier
  • workableTemperature

- Please note, some attributes are enabled by the api by default and do not need this mod.
- Search the official API and official survival mod Github Repositorys to check.

Attribute Exceptions:

  • perTierFlatDamageReductionLoss
  • perTierRelativeProtectionLoss

These aren't mirrored as other attributes are, as arrays aren't supported by the API.
Instead, they should be TreeAttributes, with the float values of "0" and "1" placed into them.
This is a workaround until the API updates.

How to use (For developers):

  1. Set an attribute on an item.
    1. Example (Set an items attack power):
       
      1. itemstack.Attributes.SetFloat("attackpower", 12f);
         
    2. Example (Set an items flat damage reduction):
       
      1. itemstack.Attributes.GetTreeAttribute("protectionModifiers").SetFloat("flatDamageReduction", 8f);
         
  2. That's it. It should work if the attribute is supported.

How to use (Standalone):

  1. Use an command that supports or sets attributes.
    1. Example (Set the weapon in your hand's attack power.):
       
      1. /debug heldstattr attackpower float 1000000
         
  2. That should do it.

Please note you must mirror attributes exactly, including trees, to how the parent item is.


Link to comment
Share on other sites

  • 6 months later...
4 minutes ago, NukoSan said:

Hi Yew, are you actively still modding? Do you need any help with the mod? I am a noob of Visual Studio, but can learn 🙂

I do plan on getting around to Vintage Story modding eventually. I'm rather busy with other things at the moment though. I do have it up on Github in the case someone wants to contribute, so if you'd like to help feel free. Might be a good learning experience for Visual Studio and Vintage Story Modding.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.