Bobstah's Custom Stats 1.3.2

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
Updated 11/04/2015 12:41 PM ET

Introduction

Allows you to set custom number or percentage stats at the Actor, Class, and Enemy level. These stats can be increased and decreased by weapons, armor, states, and items by using the appropriate notetags. They can be accessed inside of damage formulas.

 

If you use the default status window, these custom stats will not show up. If you desire this behavior, I recommend using JawsUF's StatusMenuCore plugin.

 

The ability to increase and decrease custom stats automatically upon level up/down will be made available in a future update of my Level Up Bonuses plugin.

 

Features

  • Set a stat to an actor, class, or enemy, and use that stat in damage formulas just like the standard stats!
  • If a class has a stat and an actor is a member of that class, the actor uses the class' value unless they have one of their own!
  • If a stat hasn't been set on a specific actor/class/enemy, it will default to 0 or if using a percentage stat, 100%.
  • Increase and decrease custom stats by equipping weapons and armor, applying states, and consuming items!
  • Use the Eval feature to make these stats even more dynamic!

How to Use
Add the plugin in your game and view the help information. It describes the notetags and all the crazy modifiers you can use. See the examples and neat examples section for more information.

Notetags

Actor/Enemy/Class

<CustomStat: statName=statValue>

statName - The name you want to reference this stat with.

statValue - The default value of your stat. Must be a number.

Options - You can append a percent sign (%) to the end of statValue to have it calculated as a percentage (statValue * 0.01)

 

Weapon/Armor/State/Item

<CustomStat: statName+statValue>

<CustomStat: statName-statValue>

 

You can also eval the statValue by surrounding your code with $():

<CustomStat: statName=$(yourCode() ;)

<CustomStat: statName+$(yourCode() ;)

<CustomStat: statName-$(yourCode() ;)

 

You can combine percentage stats and eval, too:

<CustomStat: statName+$(a.level;)%>

 

For more information on eval, check the plugin's help documentation.

Examples

After setting a custom stat to an actor/enemy, you reference it in damage formulas or other code just like any other stat. Below is a sample damage formula for the a stat named 'sanity':

100 + a.sanity

 

Let's say you gave the enemy a stat named 'insanity':

(100 + a.sanity) - b.insanity

 

If that stat were a percentage instead of a normal number, you would use it like this:

(100 * a.sanity) - b.insanity

 

To have a shield give +10 sanity, use the following notetag on the sword:

<CustomStat: sanity+10>

 

To have a state remove 6 sanity, use the following notetag on the state:

<CustomStat: sanity-6>

 

To have an item give a permanent boost of 6 to sanity, use this notetag:

<CustomStat: sanity+6>


Plugin
Get it here - File name is CASE SENSITIVE: BOB_CustomStats.js

Dependencies
None

FAQ

1. How do I use this plugin?

Read the plugin help and ask any questions here.

Changelog

1.3.2 (11/04/2015) - Fixed a major bug that could cause issues when attempting to load a saved game.

1.3.1 (11/02/2015) - Fixed a major bug that was causing actor-based custom stats to not be evaluated properly upon actor initialization.

1.3 (11/02/2015) - Added percentage-based stats and the ability to eval a statValue. Read the plugin help for more information.

1.2.3 (11/02/2015) - Fixed a bug where the built-in help documentation wasn't showing up properly in the plugin manager.

1.2.2 (11/02/2015) - Fixed a crash bug that was caused by the main custom stat list being undefined. This does not fix the issue of it being undefined under certain circumstances. It will log a warning to the console if encountered.

1.2.1 (10/31/2015) - Fixed a bug where a custom stat could return garbage (NaN) if the actor had a class that did not have the stat defined.

1.2 (10/31/2015) - Added addition and subtraction notetags to weapons, armor, and states.

1.1.2 (10/30/2015) - Fixed a bug where enemy stats wouldn't factor into damage formulas properly.

1.1.1 (10/30/2015) - Fixed a bug where stats wouldn't save with a save game.

1.0 (10/30/2015) - Initial release.

Legal

Free to use in commercial and non-commercial projects with credit. A free copy of the finished game would be nice, but is not required.

Credit and Thanks
- Bobstah 
 
Last edited by a moderator:

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
This could work to set enemy levels until an enemy class script comes along!
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
Very nice....
Thanks!

This could work to set enemy levels until an enemy class script comes along!
Sure can! I'm working on some enhancements for this now to let you adjust the parameters with plugin commands, then I'll add some adjustment abilities into my level up bonuses script so that you can cause these custom variables to increase upon leveling up.
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
29
First Language
English Spanish
Primarily Uses
Is it possible to set these stats on a curve or make a formula for them (as in, make "anger" dependent on attack * level)
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
Is it possible to set these stats on a curve or make a formula for them (as in, make "anger" dependent on attack * level)
It's something I have planned. Right now it's after basic addition/subtraction as it is more complicated. Stay tuned!
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
Version 1.2 is now available!

I've added the ability for states, weapons, and armor to add or subtract values from the custom stats. Check the original post for notetag information! :)
 

fighder

Warper
Member
Joined
Oct 24, 2015
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Have a question about the example:
 

Examples

We'll assign a stat to an enemy, called anger:

<CustomStat: anger=100>

Next, we'll set the damage formula of that enemy's skill to this:

a.anger + (a.atk - b.def)

Finally, when the skill is used, it will add the enemy's anger to the attack damage!
what does "a" mean? and what does "b" mean? and do you not need <> when increasing or decreasing stat?
 
 

Sera

Veteran
Veteran
Joined
Oct 27, 2015
Messages
80
Reaction score
16
First Language
English
a refers to the user of a skill and b stands for the target. Using them as prefixes is how you reference certain character's stats in damage formulas. <> is for the notes sections.
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
Have a question about the example:

what does "a" mean? and what does "b" mean? and do you not need <> when increasing or decreasing stat?
Sera is correct with their response about a and b and how to use them in damage formulas. :)

As for your second question, I am a bit confused. If you use the notetags below, you can increase or decrease this stat through weapons, armor, and states:

<CustomStat: statName+statValue>

<CustomStat: statName-statValue>

If you want a Sword to add +5 to a custom stat called anger, you would use the following notetag on the sword:

<CustomStat: anger+5>

To subtract 5 anger instead:

<CustomStat: anger-5>

Did this answer your question?
 
Last edited by a moderator:

TheGamedawg

Veteran
Veteran
Joined
Aug 29, 2014
Messages
350
Reaction score
133
First Language
English
Primarily Uses
I was waiting for a plugin like this in order to implement a couple stats into one of my games.  One stat is a new take on how often you get critical hits and the other augments how much more damage they do compared to your normal attack.  I can't download this right now but I'll be sure to try it later.  Thanks a lot for making something like this!
 

Ozuma

Villager
Member
Joined
Jun 26, 2013
Messages
19
Reaction score
5
Primarily Uses
This solves several problems at once!

I looked for it all your life. Thank you so much!

 

Somehow changing the status throughout the game?

Example: The "sanity" of the actor 1 is being hampered throughout the game, reducing the efficiency of the formula "a.sanity - b.mdf"
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
I was waiting for a plugin like this [...] Thanks a lot for making something like this!
You're welcome. Glad it's helping you! :)

Somehow changing the status throughout the game?

Example: The "sanity" of the actor 1 is being hampered throughout the game, reducing the efficiency of the formula "a.sanity - b.mdf"
The next update of this plugin will feature plugin commands to support adding and subtracting from these stats, as well as an Eval option.

If you do not want to wait, you can use states for the time being, although I know this isn't a perfect method.
 

TheGamedawg

Veteran
Veteran
Joined
Aug 29, 2014
Messages
350
Reaction score
133
First Language
English
Primarily Uses
Upon trying to load a game I get a weird bug in which it won't let me start playing the game.  It won't let me load a saved game and when I start a new one it says "TypeError:  Cannot read property 'length' of undefined" and freezes.

I'm not quite sure what is causing this.
 
Last edited by a moderator:

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
Upon trying to load a game I get a weird bug in which it won't let me start playing the game.  It won't let me load a saved game and when I start a new one it says "TypeError:  Cannot read property 'length' of undefined" and freezes.

I'm not quite sure what is causing this.
Was this save game created before you installed the plugin? If so, that is why you are getting the error.

If not, could you provide a sample of your notetags while I investigate?
 

TheGamedawg

Veteran
Veteran
Joined
Aug 29, 2014
Messages
350
Reaction score
133
First Language
English
Primarily Uses
Was this save game created before you installed the plugin? If so, that is why you are getting the error.

If not, could you provide a sample of your notetags while I investigate?
I haven't added any notetags yet and it gave me that error.  I had 2 saved games (both created before plugins) that would not load at all.  The crash happens when I started a new game.
 

Bearsmith

Villager
Member
Joined
Nov 13, 2012
Messages
22
Reaction score
5
First Language
English
Using Yanfly's scripts and wondering if things like

<Custom Parameters>if(user.hp <= (user.paramBase(0)* .25)){atk = 20;mat = 40;}</Custom Parameters>on gear be possible with this script eventually. I want to use custom stats but I need to be able to use conditionals!I do see you're adding eval support though so I assume that means yes.
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
I haven't added any notetags yet and it gave me that error.  I had 2 saved games (both created before plugins) that would not load at all.  The crash happens when I started a new game.
What other plugins are you using? I'm able to start a new game in my project with all of the pre-order plugins (Yanfly and Yami), plus a few misc ones that have been released in the last few days.

I want to use custom stats but I need to be able to use conditionals! I do see you're adding eval support though so I assume that means yes.
That's correct! If you use the eval feature for statValue, it gets executed every time the value for that stat is requested. Things might get a bit crowded in your note field, but I'm assuming you're totally ok with that. :)
 

TheGamedawg

Veteran
Veteran
Joined
Aug 29, 2014
Messages
350
Reaction score
133
First Language
English
Primarily Uses
For Yanfly, I have the Core, Battle, Equip, and all 3 Action Sequences Engines.  I also have AltSaveScreen, DeadOrAliveItem, and EllyeSimpleATB.  Your plugin is right at the bottom.  I've tried a good combination of turning them off to see if your's will work, on top of turning each and every one of them off except for yours.  However it still gives me the crash.
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
165
First Language
English
Primarily Uses
N/A
For Yanfly, I have the Core, Battle, Equip, and all 3 Action Sequences Engines.  I also have AltSaveScreen, DeadOrAliveItem, and EllyeSimpleATB.  Your plugin is right at the bottom.  I've tried a good combination of turning them off to see if your's will work, on top of turning each and every one of them off except for yours.  However it still gives me the crash.
Please provide a screenshot of the error message and a copy/paste of you BOB_CustomStats.js file via Pastebin or similar site.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Hi, there.
I'm Creta Park, as Software engineer and Indie game developer.

Profile : creft.me/cretapark
GitHub : github.com/creta5164
Blog : creta5164.tumblr.com


My stuff

Who shares/sells their scripts/plugins on itch.io? Can I pick your brain?
If you ever need fantasy names and you're bored, make a fictional alphabet. Switch around the letters and see what you get :p
I JUST GOT PROMOTED TO 9TH GRADE BOIS!

Forum statistics

Threads
98,168
Messages
949,923
Members
129,455
Latest member
DeathByPiercing
Top