SGS Stats - Additional stats for Actors and Enemies

Discussion in 'JS Plugin Releases (RMMV)' started by MagicMagor, Apr 10, 2016.

    Tags:
  1. MagicMagor

    MagicMagor Veteran Veteran

    Messages:
    201
    Likes Received:
    36
    First Language:
    German
    SGS Stats v1.2
    by MagicMagor


    Features
    This plugin allows you to define additional stats for your actors and enemies. These stats can be then used in damage formulas or elsewhere. Stats are influenced by states, equipment and classes. They automaticly increase when an actor levels up.

    How to Use
    A complete explanation of all parameters and notetags can be found in the plugins help. This is just a small explanation to get you started.


    You define the stats by entering a list of stat-names in the plugin parameter "Names". Seperate names with a comma. These names are case-sensitive.


    Afterwards you can use the following notetag on Actors, Classes, Enemies, Weapons, Armors and States


    Code:
    <SGS Stat: name=value>

    This defines the base-value of the stat 'name' to be value. The value must be a number and name must be one of stat-names defined in the parameters.


    To retrieve the stat-value of an actor or enemy the following javascript function can be used


    Code:
    battler.sgsStat(name)

    'battler' is a Game_Actor or Game_Enemy object, 'name' is the name of the stat. Please note that the name has to be enclosed in ''. For example:


    Code:
    battler.sgsStat('strength')

    This would return the strength-value of an actor or enemy.

    A simpler way is to use the stat as a property (requires v. 1.2):

    Code:
    battler.strength
    The value of a stat on an actor or enemie is further modified by active states, the actors class and equipment. The exact formula can be changed in the plugin parameters. It is also possible to use a different formula for enemies.


    To change the value of a stat you can use


    Code:
    battler.incSGSStat(name, value)

    This will increase the stat 'name' of the battler by 'value'. Use negative values to decrease the stat.


    A stat can automaticly increase when an actor levels up. The amount it increases can be defined by this notetag:


    Code:
    <SGS Stat Level: name=value>

    Like with the normal value, states, class and equipment affect the level-increase of the stat.


    Additional features

    • Advanced versions of the Base- and Level-Notetag to evaluate javascript

    • Define global maximum/minimum stats, or specific limits by notetags

    Other things to note


    The defined stats do nothing on their own. How they are used are up to you. They can be used inside damage formulas, can affect other stats/parameter using other plugins or simply used inside events.


    In particular the stats are not displayed anywhere on the normal GUI. You would have to use another plugin, to display them on the status menu.


    License:


    Free for all games in MV (free and commercial). Credit to MagicMagor must be given inside the game or a credits-file. Modification to the script is allowed, but the modified script can not be distributed. Distributing the script via the game, that uses it is the only exception for this.



    Download
    SGS Stats (v1.2)

    Changelog
    1.0 - Initial Release
    1.1 - Fixed invisible enemies
    1.2 - Adapted to new plugin manager and added simple properties for new stats
     
    Last edited: Jan 5, 2018
    #1
    Rabosion, fusegu and Rayhaku808 like this.
  2. KadoDragon

    KadoDragon Veteran Veteran

    Messages:
    155
    Likes Received:
    9
    First Language:
    English
    Do the stats that are added with this plug-in show up in the status menu?
     
    #2
  3. MagicMagor

    MagicMagor Veteran Veteran

    Messages:
    201
    Likes Received:
    36
    First Language:
    German
    Not on their own no. You would need an additional plugin to display them.
     
    #3
  4. Zekromaster

    Zekromaster Warper Member

    Messages:
    3
    Likes Received:
    1
    First Language:
    Italian
    Is there any way to use Yanfly's Base Parameter Control with this?
     
    #4
    leedragoon likes this.
  5. Forthright

    Forthright Veteran Veteran

    Messages:
    60
    Likes Received:
    10
    First Language:
    English
    So I am attempting to use this with Yanfly's Base Parameter control and I am unable to reference the stats that I have defined.  It appears that it does not call properly.  I have changed my names multiple times from str for strength to spelling it out.  It appears that it just does not call the referenced stat in the forumla.  I am unsure of what I am doing wrong.  I have tried a.str, this.str and as I said spelling out the stat.  Nothing works.  Any help would be greatly appreciate as I switched from Bobstah's Custom Stats to yours due to the wider range of support and the fact that yours will calculate out the changes in stat values when changing armor and weapons.
     
    #5
  6. leedragoon

    leedragoon Villager Member

    Messages:
    28
    Likes Received:
    1
    First Language:
    English
    Had this exact issue, using a lot of Yanfly scripts as well. I tried placing it before and after multiple scripts, didn't seem to have any effect either.
     
    #6
  7. Omegadragon8

    Omegadragon8 Veteran Veteran

    Messages:
    99
    Likes Received:
    40
    First Language:
    English


    Although I have not upgraded to the 1.0 version as I have been very busy, in the pre-release of this plugin I used  this.getSGSStat('Nameofstat') to reference a stat within Yanfly's base param control. I think it should still work if it doesn't just give me an update and I will look for another solution.
     
    #7
    leedragoon likes this.
  8. sundricat

    sundricat Veteran Veteran

    Messages:
    35
    Likes Received:
    2
    First Language:
    English
    How would I use a stat in a skill's damage formula?
     
    #8
  9. Emperor DragonBreath

    Emperor DragonBreath Veteran Veteran

    Messages:
    143
    Likes Received:
    2
    Location:
    The Second Circle of Hell
    First Language:
    English
    Do you know any plugin that can display your additional stats?
     
    #9
  10. MagicMagor

    MagicMagor Veteran Veteran

    Messages:
    201
    Likes Received:
    36
    First Language:
    German
    I hope bumping the thread is ok.
    I've just uploaded a new version of this plugin. It is now version 1.2
    The biggest change is an easier way to retrieve the value of a custom stat, which means its usage in damage formulas is easier and this should allow easier integration with Status-Menu plugins to display the new stats. (This plugin https://forums.rpgmakerweb.com/index.php?threads/the-statusmenucore-v-1-1-1.48635/ should in theory be able to display them. Use the stat-name as the 'symbol' in these plugin parameters. Unfortunately that plugin seems to have a problem on a new project, so i could not test it on my own)

    If you define the stats 'strength' and 'willpower' for example you can now access them in a damage formula like you can the default stats:
    Code:
    a.strength + a.willpower
    Please note this is an additional way to retrieve the value. If you are using the old a.sgsStat(name) method, that one is still working. Updating the plugin in an existing project might require you to set the plugin parameters again (especially the names) but everything else should work.

    The full changelog:
    v. 1.1
    • Fixed an error which resulted in invisible enemies
    v. 1.2
    • Adapted the plugin parameters to the new plugin manager in 1.5.1. This makes changing the plugin parameters easier
    • Add a property to actors and enemies for each new stat, to allow easier access.
     
    #10
  11. Robin Hoot

    Robin Hoot Veteran Veteran

    Messages:
    69
    Likes Received:
    14
    Is it possible to manually change the base value of a parameter?
     
    #11
  12. MagicMagor

    MagicMagor Veteran Veteran

    Messages:
    201
    Likes Received:
    36
    First Language:
    German
    Why would you need to do this? There is no easy way to increase the base-value, however you can directly access it using javascript.
    If a is your actor/enemy and 'strength' is the stat, this should work:
    Code:
    a._sgs_stats['strength'].baseValue += x;
    
    The plugin as is, is not really flexible in this way. The baseValue is supposed not to be changed, so i'm curious as to what usecase you need this for.

    Edit:
    Second way is to use the advanced notetag so the base-value will get calculated via script. In that script you can include anything you like, including a variable that you can increase.
     
    #12
  13. Robin Hoot

    Robin Hoot Veteran Veteran

    Messages:
    69
    Likes Received:
    14
    Awesome! That worked like a charm thank you!

    The reason why I asked is because I am using a point buy system rather than using levels. It is a lot easier to calculate how much xp it will cost to raise a trait if I can just use its base and not have to strip the character of equipment and states.
     
    #13
  14. linkhyrule5

    linkhyrule5 Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I have a rather strange bug to report. It's something of a compatibility bug, so I don't know how high it is on your priority list, but...

    For some reason, SGSStats aren't loaded with the very first Actor objects that come into existence when the game is booting up. For example, if I override Game_BattlerBase.prototype.maxTp to reference an SGSStat, I get an error saying that the SGSStats don't exist on boot, before I get to the title screen. Weirdly, the getter itself exists - the program knows that getting this.<stat> means this.SGSStat('<stat>'), but apparently hasn't instantiated the this._sgs_stats database yet, so it throws up "can't get property <stat> of undefined".

    I made something of a minimal reproduction and put it on my dropbox here. Ignore the million File Not Found errors, I tore out all the music and images to save on upload/download time.
     
    #14
  15. Vanya

    Vanya Villager Member

    Messages:
    19
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm also getting an error.
    I'm using many of Yanfly's plugins including the BattleCore and various param controls.

    Just to test things out I made a stat and set it to 25 in the actor like this: <SGS Stat: sHP=25>
    I added another 10 in the actor's class like this: <SGS Stat: sHP=10>
    Then I changed the Attack skill's formula like this: a.sHP

    I set the enemy's Defense to 0.
    What I expect is for my attack command to do exactly 35 damage to my target.
    However, it is doing 0 damage, and the console is telling me that sHP is undefined.

    I tried using a.sgsStat(sHP) and this.getSGSStat('sHP'), but yielded the same results.
     
    #15

Share This Page