MHP growth per level based on DEF using YEP_BaseParamControl plugin

Altan

Villager
Member
Joined
Aug 2, 2017
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm just going to preface this with a warning that I'm pretty newb at JS (and any scripting, really).

So, I've set up (outside the plugin, in the class sheets) that each class' MHP at level one is equal to 2x their DEF parameter. My plan is for each actor's (each of whom has one class, and vice-versa) MHP growth per level to be equal to .5x their DEF at level one, regardless of their DEF growth (each actor/class will get +1 to all their parameters aside from MHP and MMP each level). This is easy to do with the vanilla program. However, I set the player character's parameters (aside from MHP and MMP) to 12 - the average - and plan to give them many events that allow them to increase a parameter (again, aside from MHP and MMP... I'll announce if/when 'parameters' does include them, rather than continue to say this) of their choice by one. I'm going to treat this with DEF as if the boost is being applied all the way retroactively to their base level 1 DEF, so each point in DEF equates to +2 MHP (also easy to do in the same event that gives the +1 DEF). However, this also means that I want to change their growth per level retroactively and proactively as well, i.e. if the player takes DEF for the second time at level 3, they'll have a total 'bonus' of +4 from flat MHP boosts, as well as +2 from the two level ups they'd have taken. This also means when the level up next, they'll gain +7 instead of +6.

I don't even want to think about how convoluted scripting this into events would be. But I'm using YanFly's BaseParamControl plugin, which allows the insertion of a custom formula. All I need is someone with more knowledge of how to combine things like user.isActor and user.def and such to make it so that MHP increases at 1/2 the user's level 1 DEF value every level (so if the PC doesn't take DEF ever, even at level 6, when they'll have 17 DEF, leveling up to 7 only gives them +6 MHP). If you can go further and make it so that it follows everything I've detailed out before so that I don't even need to add the +2 to every DEF boost (or manually set it for every actor/class), that'd be great too. I'd like for it to just effect actors, since I'd prefer manual control of enemy MHP. And, if at the end, you can help me understand what piece of script causes what effect, I'd be about as happy as could be (the 'for Dummies' on JavaScript is much more about making web pages do what you want, not manipulating complex game mechanics, so it hasn't been helpful thus far).

Thank you in advance!
 

MORINGA

Veteran
Veteran
Joined
Apr 23, 2017
Messages
30
Reaction score
11
First Language
English
Primarily Uses
RMMV
Let me see if I got it right:
+2 MHP per boosted DEF (on level up), up to a maximum of +6 MHP
+0.5 user's lv 1 DEF per level, regardless of boosted DEF on lv up

So, that'd give us some (not JS) code, like this:
min(actor.boosteddefonlevelup¹ * 2; 6) + 0.5 * actor.lvl1def¹

¹these, of course, do not exist...by default.
(is actor.lvl1def a fixed value "per class"? If so, you have no problem here.)
 

Altan

Villager
Member
Joined
Aug 2, 2017
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMMV
I actually have a friend who helped me with this, so all good now. Ended up with "user.isActor() ? Math.floor(2*(1 + user.def - user.level) + (0.5 * (user.level -1) * (1 + user.def - user.level))) : ((base + plus) * paramRate * buffRate + flat)." This is put in the YanFly plugin.

There are two ways for the DEF to be boosted; all params not MHP or MMP get boosted by 1 per level up; these increases do not add +2 to MHP, but +6 with the level-up (1/2 the initial DEF value). But there are also going to be various ways for the player character to boost one of the stats in an event, which I decided to treat as a boost to the initial DEF value, regardless of level; since initial MHP is 2 times the DEF value (for the PC, that's 12, so 24 MHP), these events add +2, to reflect a change from 12 to 13 (24 to 26), or 13 to 14 (26 to 28) etc. Since these boosts affect the *initial* DEF value, it also boosts the MHP gained per level up on every second boost (since 1/2 of 13 rounded down - note I had to use Math.floor - is still 6, but 1/2 of 14 is 7, so after two of these special boosts to DEF, every level-up will give +7 MHP, rather than +6).

I've so far tested how this formula works just on level ups successfully, though I still need to check that the DEF boosts through the special events work properly. Hopefully, if it doesn't, I can find a way to tell the program that the special boosts should be considered as increases to the initial (level 1) value.
 

MORINGA

Veteran
Veteran
Joined
Apr 23, 2017
Messages
30
Reaction score
11
First Language
English
Primarily Uses
RMMV
Good!
I just wonder...user.def isn't base, is it? I remember looking for [custom] base values, I ended up with something like "user.cParamPlus[x]" (for QuasiParamsPlus), which would have some default equivalent like "user.param[x]" for base params.
Check Yanfly script's code, I'm sure there's something like it there...
 

Naveed

Veteran
Veteran
Joined
Nov 2, 2013
Messages
314
Reaction score
146
First Language
English
Primarily Uses
RMMV
I need clarification on one part, do you want the new MHP growth to affect previous levels as well or only the new levels?

For example, with the current formula you gave, it would work like this:

Level 1, PC has 12 def and 24 MHP.
Level 3, PC has 14 def and 36 MHP since +6 per level.
PC takes +1 to initial def both times.
So now, MHP growth will be +7 per level.
Initial MHP will 28 instead of 24.

However, the +7 MHP will be applied to all level ups, even the first two level ups where MHP increased by +6.
So, when the player levels up again to level 4, the result would be: 28 + (4-1)*7 = 49 HP.

What (I think, judging from your post) you are trying to achieve is: 28 + (3-1)*6 + (4-3)*7 = 47 HP.

If I'm right in assuming what you're trying to do here, the current formula you're using won't work.

Also, user.def gives the total def of the actor. So, it includes the base def, plus any gained from equipment, and then adjusted with parameter multipliers and buffs. If you want base def, you should use user.paramBase(3) instead.
 

Altan

Villager
Member
Joined
Aug 2, 2017
Messages
20
Reaction score
1
First Language
English
Primarily Uses
RMMV
No, yeah, I do want the +7 to be retroactive. The whole idea is to allow the player's character to be built to the player's wishes, and if they want to make a tanky character with lots of health (and good defenses too, obviously) I want them to be able to make their character match up and even surpass their tankiest ally. At this point I'm still really early in my game, only having a few encounters finished and I'm struggling with figuring out what kind of battle system I want (leaning towards Yanfly's ATB, but not sure). That and the added difficulty of using DEF to alter MHP (and MAT and MDF to alter MMP) is making me be... creative with my skill and equipment buffs and is delaying me from actually progressing in my game to the point of having a better idea of what exactly I want done.

At this point, I know that the number of times I'll give the player special +1 events will easily allow them to make the PC broken. Because I'm still only dealing with an hour's (max, if the player explores every nook and cranny and reads everything) worth of content, I don't care (I only have 10 levels planned out so far, and thus, each actor only has +9 to their totals (excluding MHP/MMP) by 'max level'). This obviously won't be the case when I have a finished project, but I'm nowhere near that point, and I'm still just working on figuring out how I want my game to handle. And right now I do want retroactive MHP gains on level-up.

That all being said, I applied the formula I used for my MHP to MMP, changed slightly (MAT gives inital [level 1] MMP, while MDF gives the level-up increases). Suffice to say, while I've been careful and thinking of using physical/magical damage rate and element rate as the defensive bonus to armor and other equipment, I ran into the problem that, while I can use ATK on my physical weapons, MAT screws up my MMP. I am using Yanfly's element core, which allows for attacker damage-increasing notetags, so I may just use those, but would the 'user.paramBase(3)' type thing, referring to MAT in the MMP formula, work to keep the equipping of a magic wand from increase MMP while giving MAT?

[Just in case I screw up eventually and use the wrong term, I changed the names of some parameters to fit with my use of them. MHP is still MHP. MMP is now MAP (Max Action Points), and used for most/all skills, not just magic. ATK is still ATK. DEF is CONstitution, to reflect the role it plays in MHP determination. MAT is MPO (Magical POwer); it's used as the primary increase of attack magic, and as stated above, determines inital MAP value. MDF is MKN (Magical KNowledge), and is used as the primary increase to healing magic values, and, again as stated above, determines the amount of MAP gained each level up. AGI is still AGI. LUK is now MSK (Magical SKill), but I'm still fiddling with incorperating it (since Support Magic doesn't really need major increases, and I don't have the coding knowledge to alter how LUK affects state application... yet (assuming I can't just use Yanfly's plugins). Again, this is a just in case notification, I'll try to use the default terms.]

Edit: Wouldn't DEF be user.paramBase(4)? 1)MHP 2)MMP 3)ATK 4)DEF?
Edit2: Nevermind - Google search reminded me that JavaScript starts counting with 0. So, technically 3 is 4. Queue headache.
 
Last edited:

Nevarus

Struggle-Bug
Member
Joined
Jun 5, 2018
Messages
18
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hey did you ever try using a.def in your formula?

like for example:
MHP = ((2 * a.def )+ 6) * level

that is if the flat amt gained per level was 6.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top