Inventool Documentation
  • Inventool Documentation
  • đŸ•šī¸Quick Start
    • Installation
    • Start Creating
  • 💡General
    • Running the Demo
    • Menu Options
    • UI Updates
    • UI Customizations
      • uGUI
      • UI Toolkit
    • Custom Item Drops
  • 🎓Tutorials
    • Demo Walkthrough
  • âœī¸Editors
    • Inventool
      • Inventory
      • Equipment
      • Items
      • Currencies
      • Crafting
      • Dismantling
      • Enchanting
      • Stats
        • Stat IDs
        • Attributes
      • Settings
    • Item Type Manager
    • Localization Editor
    • Stats Editor
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
    • Storage
    • Loot
      • Loot Box
      • Item Pouch
      • Currency Pouch
    • Components
      • Initializer
      • UI
        • uGUI
          • Inventool Window
          • Split UI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
            • Selector UGUI
          • Action Menu UGUI
          • Hover Details UGUI
          • Confirm Prompt UGUI
          • Quantity Prompt UGUI
          • Character Viewer Element UGUI
        • UI Toolkit
          • Inventool Window
          • Split UI
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
          • Action Menu
          • Hover Details
          • Confirm Prompt
          • Quantity Prompt
        • Character Viewer
      • Overworld Merchant
      • Storage Keeper
      • Item Drop
      • Item Spawner
      • Input
        • Cross Input Support
        • Cross Input Support UGUI
          • Target Selectable
      • Character Stats
  • 📄Scripting API
    • Initialization
    • Inventory
    • Equipment
      • Equipment Slot
    • Items
      • Item
      • Item Type
      • Item Stack
      • Item Drop
      • Item Spawner
      • Loot Box
      • Item Pouch
    • Currencies
      • Currency Identity
      • Currency
        • Value
      • Currency Pouch
    • Crafting
      • Craft
      • Crafter
    • Enchanting
      • Enchantment
    • Stats
      • Stat Identity
      • Attribute
      • Stat
        • Stat Value
        • Stat Scaling Source
        • Effectiveness
      • Scaling Value
        • Numeric Value
          • Value
        • Scaling Source
      • Stat Profile
      • Character Stats
    • Storing
      • Storage
      • Storage Keeper
    • Settings
    • Merchants
      • Shopkeeper
      • Craftsman
      • Enchanter
      • Overworld Merchant
    • UI
      • uGUI
        • Inventool Window UGUI
        • Split UI
          • Draggable Window UGUI
            • Inventory Window UGUI
            • Equipment Window UGUI
            • Key Items Window UGUI
            • Crafting Window UGUI
            • Enchanting Window UGUI
            • Storage Window UGUI
            • Shop Window UGUI
          • Selector UGUI
        • Action Menu UGUI
        • Hover Details UGUI
        • Confirm Prompt UGUI
        • Quantity Prompt UGUI
        • Draggable Element UGUI
          • Equipment Slot Element UGUI
          • Item Slot Element UGUI
          • Item Stack Element UGUI
        • Action Menu Option UGUI
        • Currency Element UGUI
        • Inventory Filter UGUI
        • Inventory Slot UGUI
        • Key Item Element UGUI
        • Shop Item Element UGUI
        • Storage Currency Element UGUI
        • Stat Element UGUI
      • UI Toolkit
        • Inventool Window
        • Split UI
          • Draggable Window
            • Inventory Window
            • Equipment Window
            • Key Items Window
            • Crafting Window
            • Enchanting Window
            • Storage Window
            • Shop Window
        • Action Menu
        • Hover Details
        • Confirm Prompt
        • Quantity Prompt
        • Item Elements
          • Item Stack Element
          • Equipment Slot Element
          • Item Slot Element
          • Shop Item Element
      • Action Menu Option
      • Character Viewer
    • Events
    • Sounds
    • Saving & Loading
      • Inventory & Equipment
      • Storage
      • Character Stats
    • Input
      • Cross Input Support
      • Cross Input Support UGUI
    • Localization
      • Localization Settings
      • Localizer
  • đŸ› ī¸Support
    • Getting Help
  • 📚Changelogs
    • Latest Releases
    • Future Plans
  • ⭐Rate Me?
Powered by GitBook
On this page
  • Fields & Properties
  • Equipment Binding
  • Bind With Main
  • Managing Stats
  • Adding/Removing Stats
  • Getting Stats
  • Merging Stats
  • Combining/Uncombining Stats
  • Managing Levels
  • Set the Level
  • Level Up
  • Level Down
  • Manage Experience
  • Add Exp
  • Remove Exp
  • Manage Durability
  • Increase Durability
  • Remove Exp
  1. Scripting API
  2. Stats

Character Stats

Scripting with the CharacterStats class.

The CharacterStats class is a component that can be used to provide stats to a GameObject.

Fields & Properties

Name
Description
Type
Access

profile

The stat profile.

StatProfile

public

boundEquipment

The bound equipment instance. Use BindWithMain to set this value.

Equipment

public

Level

The current level. Use LevelUp, LevelDown, or SetLevel to change this value.

int

public

MaxLevel

The max level.

int

public

Weight

The amount the target weighs.

float

public

Experience

The experience points. Use AddExp or RemoveExp to manage this value.

ScalingValue

public

Durability

The durability points. Use AddDurability or ReduceDurability to manage this value.

ScalingValue

public

Stats

The list of stats.

List<Stat>

public

IsMaxed

If the level is maxed.

bool

public

Equipment Binding

Note: multiple character support will be added in the future.

Equipment binding is a way to link the stats of a character with the stats of equipped items. Combining logic is used for this.

Bind With Main

Use BindWithMain to bind the main equipment.

myCharacterStats.BindWithMain();

Use Unbind to unbind from the bound equipment.

myCharacterStats.Unbind();

Managing Stats

Adding/Removing Stats

To add or remove a stat, simply use the Add or Remove methods of the Stats field.

myCharacterStats.Stats.Add(myStat);
myCharacterStats.Stats.Remove(myStat);

Getting Stats

You can get a specific stat in the profile with the stat's ID, name or abbreviation.

var hpStat = myCharacterStats.GetStat("HP");

Merging Stats

You can merge a list of stats with the MergeStats method. Stat merging is the process of permanently adding a stat's value to another of the same identity. If the stat cannot be merged with any existing stat in the profile, it will be added as a new stat instead.

myCharacterStats.MergeStats(stat1, stat2); //stat3, etc...

Combining/Uncombining Stats

Stat combining is the process of temporarily adding a stat's value to another of the same identity.

Combining

You can combine a list of stats with the CombineStats method. Only similar stats can be combined with each other. Stats that aren't identical to any stat in the profile will be ignored.

myCharacterStats.CombineStats(stat1, stat2); //stat3, etc..

Uncombining

Use the UncombineStats method to have the opposite effect.

myCharacterStats.UncombineStats(stat1, stat2); //stat3, etc..

Managing Levels

When setting the level of a StatProfile, the methods below should be used as they will update all stats in the profile.

Set the Level

To set the max value, use the SetMaxLevel method.

myCharacterStats.SetMaxLevel(100);

The SetLevel will set the current level to a specific value.

myCharacterStats.SetLevel(1);

Level Up

The LevelUp method increases the level by 1.

myCharacterStats.LevelUp();

Level Down

The LevelDown method decreases the level by 1.

myCharacterStats.LevelDown();

Manage Experience

Add Exp

The AddExp method adds experience points. This will result in a level up if the high value reached.

myCharacterStats.AddExp(100);

Remove Exp

The RemoveExp method removes experience points. This will result in a level down if the value goes below zero.

myCharacterStats.RemoveExp(100);

Manage Durability

Increase Durability

The IncreaseDurability method increases the durability. The durability cannot go over the high value.

myCharacterStats.IncreaseDurability(100);

Remove Exp

The ReduceDurability method reduces the durability. The durability cannot go below the low value.

myCharacterStats.ReduceDurability(100);
PreviousStat ProfileNextStoring

Last updated 8 days ago

📄