MagicMagor

Veteran
Veteran
Joined
Apr 7, 2012
Messages
201
Reaction score
38
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:

zzTop

Veteran
Veteran
Joined
Sep 10, 2013
Messages
155
Reaction score
10
First Language
English
Primarily Uses
Do the stats that are added with this plug-in show up in the status menu?
 

MagicMagor

Veteran
Veteran
Joined
Apr 7, 2012
Messages
201
Reaction score
38
First Language
German
Not on their own no. You would need an additional plugin to display them.
 

Zekromaster

Warper
Member
Joined
Apr 6, 2015
Messages
4
Reaction score
1
First Language
Italian
Primarily Uses
RMMV
Is there any way to use Yanfly's Base Parameter Control with this?
 

Forthright

Veteran
Veteran
Joined
Mar 9, 2016
Messages
60
Reaction score
10
First Language
English
Primarily Uses
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.
 

leedragoon

Villager
Member
Joined
Jul 27, 2013
Messages
28
Reaction score
1
First Language
English
Primarily Uses
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.

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.
 

Omegadragon8

Veteran
Veteran
Joined
Jul 21, 2015
Messages
99
Reaction score
40
First Language
English
Primarily Uses
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.



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.
 

sundricat

Veteran
Veteran
Joined
Oct 29, 2015
Messages
35
Reaction score
2
First Language
English
Primarily Uses
How would I use a stat in a skill's damage formula?
 

MagicMagor

Veteran
Veteran
Joined
Apr 7, 2012
Messages
201
Reaction score
38
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.
 

Robin Hoot

Veteran
Veteran
Joined
Feb 14, 2016
Messages
83
Reaction score
22
Primarily Uses
Is it possible to manually change the base value of a parameter?
 

MagicMagor

Veteran
Veteran
Joined
Apr 7, 2012
Messages
201
Reaction score
38
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.
 

Robin Hoot

Veteran
Veteran
Joined
Feb 14, 2016
Messages
83
Reaction score
22
Primarily Uses
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.
 

linkhyrule5

Villager
Member
Joined
Jan 15, 2018
Messages
7
Reaction score
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.
 

Vanya

Villager
Member
Joined
Feb 17, 2018
Messages
19
Reaction score
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.
 

Dylan1234

Warper
Member
Joined
Jun 18, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
<look below>
 
Last edited:

Dylan1234

Warper
Member
Joined
Jun 18, 2018
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
How does the base formula notetag work? I tried it with this:
<SGS Stat: ppow>
var str = $gameActors.actor(1).param[2]
var agl = $gameActors.actor(1).param[6]
var vit = Math.floor($gameActors.actor(1).param[3]/2)
var mag = Math.floor($gameActors.actor(1).param[4]/2)
str + agl + vit + mag
</SGS Stat>
 

Latest Threads

Latest Posts

Latest Profile Posts

It was fun while it lasted, but guess it's time to say goodbye to my antidepresants. My body is immune to their good effects and only bad effects would remain.
Character in the game lore: An individual with exceptional skills.
Players: Slip through the cliff and die.
You know.. I... I kinda lost my interest in living a long time ago. What sustains me is a lack of interest in dying.
Like a star that is balanced between the forces of gravity and outward pressure, I feel like the energy to produce that outward pressure is weakening. I feel like I should pull a Stardew Valley and revert to a more primitive lifestyle, away from others. :(

Forum statistics

Threads
131,586
Messages
1,221,276
Members
173,285
Latest member
tnt3927
Top