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

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,879
Reaction score
8,587
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,173
Reaction score
1,164
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,173
Reaction score
1,164
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 want to learn Javascript to create a custom menu, but I don't really know where to start.
One uncomfortable truth that has withstood the test of time, is how most people will stand by while they see a crime happening, unless it's illegal to stand by. We probably wouldn't have stories about "special heroes" or games about heroes if the "everyday common folk" were largely capable of being heroes. Heroes face dangers that most people are not willing to.
I'm having toooo much fun designing the new MP (Mental Psyche) system. I've only worked it out for enemies so far, but it's fun to stun them, then go after their MP and delete them instead to farm for better item drops.
anyone know of a place I can promote my game? sorta like game awards but for indie devs, like a place where I can drop a trailer and like stir up some hype
Doing RPG Maker News for 17th October 2021

Forum statistics

Threads
115,882
Messages
1,093,696
Members
151,126
Latest member
LAB00M
Top