Addon Stamina

Stamina

Introduction

Adds a new 'Stamina' stat in addition to health and mana to all players. Stamina can be depleted and recovered through various means. Stamina is similar to an energy system found in mobile games.
Stamina in general should deplete slowly and it makes life harder for players once it is depleted.
But players never get incapacitated or die due to stamina loss.

- Running depletes stamina
- Skills can also consume stamina
- But, players can still cast skills even when they have insufficient stamina (configurable on skills)

Stamina can be recovered:
- By letting it recharge slowly
- By using a 'Potion Item'
- By spending time offline in a 'Sanctuary'

Stamina can be modified:

- By 'Attributes'
- By passive skills
- By buffs
- By equipment

Tutoriel for installation

Installation

1. UI

A : in default healthMana GO in canvas 1.1 Go to your Canvas, locate "healthMana" 1.2 Add "UIStamina" script as new component to it 1.3 Add the new "StaminaBar" prefab to the "HealthManaPanel" 1.4 Link all inspector slots in "UIStamina" component to the new "StaminaBar"

B : if you using Optimised UI is automatique

2. CORE CHANGES

          ------------------------------------------------------------------------------------------
---- if you are using mySQL, skip the database changes below, we did already for you! ----
------------------------------------------------------------------------------------------

2.1 DATABASE.cs

2.2.1 : Search :

                  public int mana { get; set; }
        public int strength { get; set; }

replace by :

                  public int mana { get; set; }
#if _iMMOSTAMINA
        public int stamina { get; set; }
#endif
        public int strength { get; set; }

2.1.2 : search this :

                      player    .mana.current = row.mana;

                // set 'online' directly. otherwise it would only be set during

replace by :

                      player    .mana.current = row.mana;
#if _iMMOSTAMINA
                player.stamina.current = row.stamina;
#endif

                // set 'online' directly. otherwise it would only be set during

2.1.3 : search this :

                  mana     = player.mana.current,
            strength = player.strength.value,

replace by this :

                  mana     = player.mana.current,
#if _iMMOSTAMINA
            stamina = player.stamina.current,
#endif
            strength = player.strength.value,

2.2 ScriptableSkills.cs

Search this :

                     caster    .mana.current >= manaCosts.Get(skillLevel) &&
               CheckWeapon(caster);

Replace by this :

                     caster    .mana.current >= manaCosts.Get(skillLevel) &&
#if _iMMOSTAMINA
               caster.stamina.current >= staminaCosts.Get(skillLevel) &&
#endif
               CheckWeapon(caster);

2.3 Skills.cs Search this :

          public abstract class Skills

Replace by this :

          public abstract partial class Skills

Search this :

                      if(skill.manaCosts > 0)
                mana.current  -= skill.manaCosts;

            // start the cooldown (and save it in the struct)

Replace by this :

                      if(skill.manaCosts > 0)
                mana.current  -= skill.manaCosts;

#if _iMMOSTAMINA
            if (entity is Player && skill.staminaCosts > 0)
                stamina.current -= skill.staminaCosts;
#endif

            // start the cooldown (and save it in the struct)

3. ITEMS

3.1 Create a new "Potion Item" using the context menu (ADDON/Item/Item Potion)

3.2 See the new section where it allows you to recover Stamina on usage

4. PLAYER PREFABS

4.1 See new Component "Stamina" on player prefabs and uncheck startfull

4.2 Create a new Scriptable template Stamina configuration and configure

4.3 See new Component "PlayerStamina" and assign a "Tmpl_StaminaConfiguration"

Requirement

  1. Tools

Add Define

  1. _iMMOSTAMINA

Video Tutoriel

  1. No video tutoriel

Addon Date

  1. Created : 2024-06-02
  2. Updated : 2024-06-02

Tutoriel Date

  1. Update : 2024-06-07 00:27:37

File Date

  1. Update : 2025-05-30

Explore Our Addons:

Usage Requirements addon for uMMORPG
Usage Requirements

Adds limits on using/equipping/casting items/skills. Very helpful to limit item usage to certain classes or under special conditions. It also allows to limit usage of items/skills to special areas ...

Mobile Register addon for uMMORPG
Mobile Register

this addon allows you to use the google signin in your mobile game, but also a guest user system based on the phone's unique id

Skill Categories addon for uMMORPG
Skill Categories

A replacement for the default skill window that allows you to separate your skills into categories. Especially useful when you have a lot of skills in your game.