Skill that lowers the user's Stats

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
Before I go making a string of Variables that checks every enemy in the battle's name...

Is it possible through base MV or with help from a plugin to make a skill that damages an enemy, but lowers a selected stat of the user (In this case, agi) by a fixed amount in a way that does not use the damage formula to do so?
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,602
Reaction score
1,933
First Language
English
Primarily Uses
RMMV
When you say "selected stat" do you just mean a specific one, or that the player can choose?
 

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
A specific one, no input from the player on this one.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,602
Reaction score
1,933
First Language
English
Primarily Uses
RMMV
Skill Core can do this with a Post-Damage Eval notetag.
 

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
Okay, I tried a couple of things in here and it doesn't seem to be working, though I might just be getting the syntax wrong.

So far I've attempted:
user.agi -= 4;
a.agi -= 4;
this._entity.battler().agi -= 4;

And none of them have had any effect. Any ideas?
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
601
First Language
English
Primarily Uses
RMMV
Another option, if you're willing to create a state to handle the stat being lowered, would be to use the damage formula box:

a.addState(Id); formula

edit: lol, sorry i just noticed you said no damage formula


edit 2: -= won't work because essentially what you're writing is:

x = x-y

edit 3: script call for changing a parameter

$gameActors.actor(actorId).addParam(paramId, n);

Negative n if you wish the actor to lose stats. Params: 0-MaxHP, 1-MaxMP, 2-ATK, 3-DEF, 4-MAT, 5-MDEF, 6-AGI, 7-LUK

edit 4: I just thought, for yanfly note tag stuff you may try

user.addParam(paramId, n);
 
Last edited:

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
Thanks for the suggestion, but I did specifically request that it didn't use the damage formula, hah~
For some reason or another, the plugins I'm using don't take into account anything within the damage formula box if the attack misses.

EDIT: Even tried using the addState method in the post damage eval, and even that didn't activate if the attack misses.
 
Last edited:

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,474
Reaction score
1,366
First Language
English
Primarily Uses
RMMV
Without a plugin designed specifically to do so, all debuffs and stat-lowering states are by percentage, not fixed values. agi is a read only property, meaning you can't set it. It is automatically calculated by the user's base agi.

I guess you could use some hacky manipulation of _paramPlus and yanfly's buffs/states core to apply a negative value to it as a custom apply effect and then add back what was removed via custom remove effect, but that's...a bit yucky.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,602
Reaction score
1,933
First Language
English
Primarily Uses
RMMV
The reason that's not working is that "agi" isn't actually a property; it's a shortcut to a getter for the params property:

Code:
agi: { get: function() { return this.param(6); }, configurable: true }
param is another function:

Code:
Game_BattlerBase.prototype.param = function(paramId) {
    var value = this.paramBase(paramId) + this.paramPlus(paramId);
    value *= this.paramRate(paramId) * this.paramBuffRate(paramId);
    var maxValue = this.paramMax(paramId);
    var minValue = this.paramMin(paramId);
    return Math.round(value.clamp(minValue, maxValue));
};
Looking at paramBase, it just returns 0 in Game_BattlerBase. In Game_Actor though:

Code:
Game_Actor.prototype.paramBase = function(paramId) {
    return this.currentClass().params[paramId][this._level];
};
...it just returns the class params. So we can't really edit that directly. However, paramPlus is a different story:

Code:
Game_BattlerBase.prototype.paramPlus = function(paramId) {
    return this._paramPlus[paramId];
};
So if you want to subtract from agi, what you need to do is decrement _paramPlus[6].
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
601
First Language
English
Primarily Uses
RMMV
EDIT: Even tried using the addState method in the post damage eval, and even that didn't activate if the attack misses.
To take effect before the skill is decided as a hit or miss, you'd use <Before Eval>

edit: also, i edited my first post with a possible solution. Wasn't sure if you had tried that method or not
 

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
Aye. You've all helped me gain a greater understanding as to why I'm able to find agi and assign its value to a variable, but am unable to reverse engineer it to change the value itself through using the same identifier.

Tried Trihan's method and it worked; Sort of.
It would lower the stat by the requested amount, but only once, no matter how many times the skill was used in a turn, probabably reading from its Maximum/Original every time it did so, which I could fix with variables like this:

Code:
<After Eval>
var TIMES = $gameVariables.value(146);
user._paramPlus[6] =- (TIMES*4);
$gameVariables.setValue(146, TIMES + 1);
</After Eval>
Where the variable responsible for TIMES is reset to 1 at the beginning of every battler's turn.

...However, I then looked back at the post and saw Ninja's response, and it turns out this works just as well:

Code:
user.addParam(6, -4);
Seems it was simple as that, hah!
Thanks all


EDIT: I think I put the operator on the wrong side in Trihan's method...
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,602
Reaction score
1,933
First Language
English
Primarily Uses
RMMV
Yeah, you did =- instead of -=. But I missed out the fact that addParam is a thing in my explanation, sorry about that!
 

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
Just realised that I don't know how to restore agi to its original value afterwards. Whoops.

I've tried to remedy this by instead making the skill self-apply a state that performs the same function as a <Custom Apply Effect> so every time it is applied, the agi goes down, however upon removing the state, it doesn't go away.
I tried a <Custom Remove Effect> to +4 to the agi to bring it back up but that only seems to apply once (As it's still only one state) and thus leaves it permanently down.

My intended work-around is to make duplicates of the state and then just have a check that goes "If you've got statecopy1, inflict statecopy2 etc.

Any easier ways around this?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
526
Reaction score
230
First Language
English
Primarily Uses
RMMV
The reason that's not working is that "agi" isn't actually a property; it's a shortcut to a getter for the params property:
It is a property, but it's a read-only property.

So if you want to subtract from agi, what you need to do is decrement _paramPlus[6].
I would consider this to be the wrong answer. The paramPlus array is used for permanent stat changes, normally added via a Grow Parameter effect. For a temporary change, I think this might be more appropriate (untested, I might have parameters in the wrong order or typos something):

JavaScript:
user.addDebuff(6, 5); // reduce stat 6 (I think that's AGI) for 5 turns
Or add a state that performs the stat change.
 

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
On the subject of user.addDebuff(6, 5);
Where do I put the value that it is reduced by?
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
526
Reaction score
230
First Language
English
Primarily Uses
RMMV
You don't. It's a fixed 25% decrease, unless you use a plugin that changes how buffs work.
 

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
In which case, Ninja's answer remains the most useful one, and my previous question still stands if anyone can help with it.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
526
Reaction score
230
First Language
English
Primarily Uses
RMMV
If you mean using addParam, that's the same as paramPlus so almost certainly the wrong answer. What I would recommend is using a state.

If your problem is that you are using a state and you want it to be able to apply more than once, then possibly you could try using addNewState instead of just addState - that skips the check for if the state is already applies and just adds it. It also skips several other things though, so it may not work as you want it. For example, it ignores state resist and will happily add a state to a dead battler. It also skips the battle log and doesn't set the state's timeout, which you'd have to do manually with resetStateCounts.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
601
First Language
English
Primarily Uses
RMMV
One thing I thought of is if you were able to use Yanfly Buff & State core, then while you use
Code:
user.addParam(6, -4);
in the custom apply effect, you could try the inverse in the custom remove effect
Code:
user.addParam(6, +4);
. I haven't tested it, but theoretically it seems a viable solution.
 

Daemoshiin

Villager
Member
Joined
Aug 2, 2017
Messages
18
Reaction score
3
First Language
English
Primarily Uses
N/A
Attempted Solar's addNewState method. It does apply the state multiple times, but the state's stat altering effect doesn't occur. The icon appears over them several times, but their agi remains constant - Sad really, as removing them multiple times does increase their agi, hah~

...I was about to post this with some other musings, and then realised that now I can just make the skill itself do the addParam(6, -4), and have the custom state removal re-add that 4, as that's the part of this equation that functions; Mix and match the two styles, as it were.

For the record Ninja, that is exactly what I was already doing as outlined in my previous post, lol.

I guess that renders this thread solved?
 

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

Latest Threads

Latest Profile Posts

Made a video showcasing a plugin (by Lanza) that adds 5 more weather effects to our MV games. :LZYsmile: Namely:
Ash-dust,
bloodrain,
Cherry Blossom Petals,
Hail,
and bubbles.

I just like this website:
lol
I streamed Moonfall on 9/25/20
and have started a page to showcase my vids/stream :kaoluv:

Please subscribe and follow, it's free, it's quick and one sub means so much to me, it would really make my day~ :wub

Forum statistics

Threads
103,234
Messages
998,249
Members
134,724
Latest member
Gzus
Top