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,190
Reaction score
1,168
First Language
English
Primarily Uses
RMMV
What is MaxResistance?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,888
Reaction score
8,591
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,190
Reaction score
1,168
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,190
Reaction score
1,168
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

I typically ask this on my normal social media channels, but figured there may be good replies here. Anyone got any good horror movie recommendations? I've seen a lot, but I always love getting suggestions! Bonus points if you know which service it is streaming on (in the US) - bring on the spOoooOky!
 After a few distractions (and my annual rough second week of October), I’m getting back on track with my OMGC project.
 Am I overcomplicating it? Yes. Am I going to tone it down? Almost certainly not.
 At least the dialogue stuff is almost done. I need to do the map itself, and then all that’s left is combat.
 Getting there!
Creating 3D CGs for Cutscenes. :kaosalute:

I keep wanting to post every song I make for the game and have to hold back on that because at this rate, I'll have spoiled all the really good stuff lol..
DerniBorges wrote on TSR's profile.
Is there any way this plugin works with the big character, and the QSprite plugin? Using RTP chars, everything works fine, but the big ones, with QSprite, it's like that in the image, it doesn't reflect right. And there is, in the settings, an option to fix it. Thanks.
bug2.png

Forum statistics

Threads
115,902
Messages
1,093,835
Members
151,150
Latest member
cungcapbomnuoc
Top