Sirius270

Veteran
Veteran
Joined
May 2, 2020
Messages
60
Reaction score
16
First Language
English
Primarily Uses
RMMV
Hello fellow game makers,
I would like to use magic defense (renamed Resistance) in my game to not only reduce magical damage, but also to reduce the effectiveness of all status effects.
base% - base%*.5(Resistance/MaxResistance)
Something like that equation, where base% is the base chance to land a status effect (poison, for instance). I, however, do not want this to block friendly buffs, which adds to the difficulty. Any ideas/scripts/plug-ins? Thank you in advance!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,211
Reaction score
1,176
First Language
English
Primarily Uses
RMMV
What is MaxResistance?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,901
Reaction score
8,596
First Language
German
Primarily Uses
RMMV
OK, there are two different parts of your plans.
The first is easy - mdef has absolutely no function in the game by default, it is only there for your to use in the damage formulae - and those are completely under your control.

The second part about the state resistance is much more difficult to do.
If it were to affect all state you could do that with the extra parameter formulae plugin from yanfly, but the problem is that you don't want that to happen for friendly states.

To solve this you need to answer one specific questions:
how do you identify the states this should apply to and those it should not apply to?

As soon as you can give a formula to identify that, you can do what you want.
Without that formula you can't do it.

That formula might be something like "all states with ID 1-50 are nice states, with ID 51+ are bad states", or you might define this by placing a notetag with the meta function or several other ways, but we can't answer that for you without knowing your states.
 

Sirius270

Veteran
Veteran
Joined
May 2, 2020
Messages
60
Reaction score
16
First Language
English
Primarily Uses
RMMV
OK, there are two different parts of your plans.
The first is easy - mdef has absolutely no function in the game by default, it is only there for your to use in the damage formulae - and those are completely under your control.

The second part about the state resistance is much more difficult to do.
If it were to affect all state you could do that with the extra parameter formulae plugin from yanfly, but the problem is that you don't want that to happen for friendly states.

To solve this you need to answer one specific questions:
how do you identify the states this should apply to and those it should not apply to?

As soon as you can give a formula to identify that, you can do what you want.
Without that formula you can't do it.

That formula might be something like "all states with ID 1-50 are nice states, with ID 51+ are bad states", or you might define this by placing a notetag with the meta function or several other ways, but we can't answer that for you without knowing your states.
I could easily organize them like that... I only have like 20-25 of the "bad" states. Thank you for this way of thinking about it.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,211
Reaction score
1,176
First Language
English
Primarily Uses
RMMV
base% - base%*.5(Resistance/MaxResistance)
So I wasn't exactly sure what the end of that meant, if it's .5*(Res/maxRes), but that's how I interpreted it. You should be able to see where it is clearly enough and modify the formula however you choose.

Code:
Game_BattlerBase.prototype.stateRate = function(stateId) {
    var rate=this.traitsPi(Game_BattlerBase.TRAIT_STATE_RATE, stateId);
    if ($dataStates[stateId].meta["hostile"])
        return rate-rate*.5*(this.param(5)/999);
    else
        return rate;
};
Copy that into a text file and save as a .js in your plugins folder, then load it into your game. It should cause your state rate to be decreased based on your MDef for any state that has the <hostile> note tag.

I have not tested it, so that's up to you - let me know if there are any errors.
 

Sirius270

Veteran
Veteran
Joined
May 2, 2020
Messages
60
Reaction score
16
First Language
English
Primarily Uses
RMMV
So I wasn't exactly sure what the end of that meant, if it's .5*(Res/maxRes), but that's how I interpreted it. You should be able to see where it is clearly enough and modify the formula however you choose.

Code:
Game_BattlerBase.prototype.stateRate = function(stateId) {
    var rate=this.traitsPi(Game_BattlerBase.TRAIT_STATE_RATE, stateId);
    if ($dataStates[stateId].meta["hostile"])
        return rate-rate*.5*(this.param(5)/999);
    else
        return rate;
};
Copy that into a text file and save as a .js in your plugins folder, then load it into your game. It should cause your state rate to be decreased based on your MDef for any state that has the <hostile> note tag.

I have not tested it, so that's up to you - let me know if there are any errors.
Wow!!! This looks excellent! I will test it over the next couple of days. THANK YOU SO MUCH. What are you terms for credit?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,211
Reaction score
1,176
First Language
English
Primarily Uses
RMMV
Thank you, but I don't care about credit for a forum post :biggrin:
 

Latest Threads

Latest Posts

Latest Profile Posts

Finally got my website fixed and the security sorted so it's been a productive day. Can I go to sleep now? I mean... I don't need to work right?
It's always a good idea to refresh yourself on what your plugins do. I'm working on a map with opening walls, and I was about to tear my hair out over how much image editing and hand-constructing of autotiles I'd have to do, when I looked again and saw @Shaz 's Tile Changer could copy areas from another map.
"sorry it took me so long to respond" - can we please agree not to say that anymore unless it actually took a long time?! (Like 36hrs at least) I mean, I'm running out of funny responses here xD
Ugh... 4:53AM over here and I can't sleep so why not just game make.
I just love the MV feature that allows you to create your own animations!

Forum statistics

Threads
115,919
Messages
1,094,016
Members
151,174
Latest member
sardin
Top