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

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,916
Reaction score
8,603
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,231
Reaction score
1,196
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,231
Reaction score
1,196
First Language
English
Primarily Uses
RMMV
Thank you, but I don't care about credit for a forum post :biggrin:
 

Latest Threads

Latest Profile Posts

I just don't know why, but it's funny.
5.gif
Ugh. The one time I forget to save every hour or so is also the day my computer crashes. That's life!
Even though I spent 100's of dollars on my game already. I think I might just have to give it away for free. Since I haven't heard back from people if I could use some of their graphics. Even from a global mod here. Maybe I can make a donation thing.
you know, some days you get resentful that game dev is even considered a "fun job" and other days it's like, welp, time to roll up my sleeves and code these molotov cocktails
If you suck at playing trumpets, that is probably why.

Forum statistics

Threads
115,964
Messages
1,094,434
Members
151,234
Latest member
sousou123232
Top