Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
90
Reaction score
27
First Language
Français
Primarily Uses
N/A
Hello,
I need help modifying an effect that already exists in the game.
This is the sp parameters "recovery effect" which increases the healing effect received.
Currently, it acts on the amount of HP, MP and TP that one receives when using an object or an ability.
Is it possible to make it so that it acts only on HP?
This will help me greatly in the creation of my project.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,394
First Language
English
Primarily Uses
RMMV
If you want the ability to have the normal Recovery sp-paramater and one just for healing, you can use notetags from VisuStella Battle Core.

If you never want to boost MP/TP recovery and just want to change it to work on HP, paste the below into a text editor, save as a *.js file, and include it as a plugin.
Code:
Game_Action.prototype.makeDamageValue = function(target, critical) {
    const item = this.item();
    const baseValue = this.evalDamageFormula(target);
    let value = baseValue * this.calcElementRate(target);
    if (this.isPhysical()) {
        value *= target.pdr;
    }
    if (this.isMagical()) {
        value *= target.mdr;
    }
    if (baseValue < 0 && this.isHpEffect()) {
        value *= target.rec;
    }
    if (critical) {
        value = this.applyCritical(value);
    }
    value = this.applyVariance(value, item.damage.variance);
    value = this.applyGuard(value, target);
    value = Math.round(value);
    return value;
};
 

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
90
Reaction score
27
First Language
Français
Primarily Uses
N/A
Thank you.
I try this as soon as I have time, and I put the annotation "Solved" on my title if it suits ^^

Edit :
It doesn't work unfortunately.
I put the formula at the bottom of my plugin list but it's as if nothing had changed
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,394
First Language
English
Primarily Uses
RMMV
After adding the plugin, did you save your project and start a new game? Loading a save game often doesn't reflect changes you made.

If you're starting a new game and still seeing the recovery parameter affecting MP/TP skills, I can only assume you have some other plugins that are modifying the same function.
 

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
90
Reaction score
27
First Language
Français
Primarily Uses
N/A
Thank you for your reply. Indeed, I had saved and started a new game to do the test.
However, I use a lot of plugins, it's true.
But it seems to me that none of them touch this function.
I show you the list.

plugin.png

The last ones were obtained on the forum and do not concern the regeneration effect (except "EmblemeTemplier" but it is the one you gave me earlier in this topic).
Maybe one of the big yanfly plugins is in conflict?
 

MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
Are you sure it changes TP? It did not change TP on my testing.
Not only that, it did not change with HP-MP-TP Regen. So it really only changes when a Skill or Item heals, right?

Anyway, a work around is to use Yanfly Action Sequences.
You add a State before Action Effect (before the MP healing), that changes your Rec to zero.
In my case, using the default formula from Yanfly Sp-Paramenters, I do the following:
<rec rate: 0%> makes your rec go to zero
<rec flat: +100%> makes it be 100%

So the skill adds a State with Action Sequences, which makes the character go back to the 100% default rec. The skill heals MP. Then right after that, you remove the state.

Code:
<target action>
add state 4: user
perform action
action effect: target
remove state 4: user
</target action>
 

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
90
Reaction score
27
First Language
Français
Primarily Uses
N/A
Thank you for your answer.
Indeed, maybe it doesn't concern TPs (actually I don't have an object that renders TPs, but I assumed that it was also concerned).
I don't quite understand the technique you want to use but I don't have to understand all the steps.
I copied the action sequences well (adapting to my figures).
But I must not have set the state correctly.
<rec rate: 0%> and <rec flat: +100%> should they be placed inside the report?
 

MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
I use Rec in my game just like you want to: to help with HP only, and not MP.
I think you don't have Special Parameter Formula from Yanfly, you need to add that plugin to make the <rec rate: 0%> and <rec flat: +100%> work.

The idea is the following:
Before Recovering MP, you add a State that turns the Rec to 100%, so that the MP recovers normally. After recovering MP, you remove the State.

So inside the Action Sequence, you add a state before the MP recovery, then remove it afterwards.

At the state, you add the tags <rec rate: 0%> and <rec flat: +100%> in the notetags
The default formula is (base + plus) * rate + flat
- Base is the normal one, you change inside the game.
- Plus, rate and flat are additions from Yanfly to allow you to further modify the parameters.
- So doing <rec rate: 0%> makes it be zero.
- Then the <rec flat: +100%> makes it be 100%
Once you remove the state, your rec goes back to the value it should be. The state is there just for the skill.

Solution is not the best
This plugin from Turan sounds like a much better solution. I did not try it yet. It if works, I might change to it, since it does not require all these steps.

I'm showing the solution because...
It can work for other things. For example, if you want an attack that attacks twice, but the second hit is a guarantee crit, you can use the Action Sequence to add a state before the second hit that makes the user have 100% Crit Chance (then you remove the state).

The pictures
The pictures I'm sending are: the State, an Ether Item, and a Skill that the user uses his TP to recover all his MP. For the item and skill, the Notetag is the important part.
 

Attachments

  • imagem_2023-01-29_135024372.png
    imagem_2023-01-29_135024372.png
    157.9 KB · Views: 2
  • imagem_2023-01-29_135114079.png
    imagem_2023-01-29_135114079.png
    160.7 KB · Views: 2
  • imagem_2023-01-29_135503045.png
    imagem_2023-01-29_135503045.png
    170.2 KB · Views: 2
Last edited:

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
90
Reaction score
27
First Language
Français
Primarily Uses
N/A
I didn't really succeed but I was inspired by your method to do something similar.
I used "if (!target.isStateAffected(x))" in my recovery effect state. And x is the state that fires just when the object is used.
This works fine (if you don't use any objects that return hp AND mp), but there is a problem.
The action sequence does not work if the item is used out of combat. My recovery effect state being a permanent state (with Auto Passive States), this is not suitable.
Thanks for the idea anyway.
If you can get Truan's method to work, let me know. I don't understand why it doesn't work for me when you just have to put the plugin in place :/
 

MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
Ohh thats true, this won't work when outside battle...

But I found another way to do it.
You use Skill Core from Yanfly, and then use <Before Eval> and <After Eval>. These will add and remove the state I said.


Code:
<Before Eval>
b.addState(4);
</Before Eval>

<After Eval>
b.removeState(4);
</After Eval>

It 100% works inside combat, no issues there.

However, outside combat, it is extremely weird and I don't know what is going on. I wonder if it is a bug.
- If you use the skill once, it works. It adds the state, heals MP then removes the state.
- If you use a second time, it does not add the state at all.
It stays in that loop. One time it works, the next it does not, then the next it does, then the next it does not...

If I find a solution I will post it here.

About Turan's idea

Well... I just placed his plugin at the botton and it worked. But it probably causes issues with Yanfly. I placed the plugin at the top and it did not work, so yanfly changes this function that Turan changed. This means using this plugin from Turan might cause issues with Yanfly, but I'm not sure if it does or not.
So I rather come up with another solution then to risk having an issue. Unless someone knows if it has conflicts or not.
 
Last edited:

MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
Alright, I have an update.

The problem with using <Before Eval> and <After Eval> with Skill Core from Yanfly
This is so confusing, that I can't find a way to explain my theories, so I will just give up on it. Just know that my THEORY is that this plugin is bugged for adding and removing states when outside battle.
This is a very good solution, but it is not working for me. To boring and complicated to explain. That's unfortunate...

I found a solution to our problem
I don't think you will like it, but I will try my best to explain.
These are the plugins you need:
- Yanfly Skill Core: adds a bunch of new funtions to skills
- Yanfly Special Parameters: adds new ways to change Special Parameters

--- My idea: change Recovery to 100% before the skill or item heals MP. Change Recovery back to what it was after your heal MP.

--- Step 1: Add two variables to the Recovery formula, one that multiples and the other that adds
(Image 1)
This is the formula I'm using:
Code:
(base + plus) * rate * $gameVariables.value(17) + flat + $gameVariables.value(18)
(In my case, I'm using variables 17 and 18).

--- Step 2:
(Image 2)
<Before Eval>: Change value of variable 17 to 0. Change value of variable 18 to 1
Code:
<Before Eval>
$gameVariables.setValue(17, 0);
$gameVariables.setValue(18, 1);
</Before Eval>
<After Eval>: Change value of variable 17 to 1. Change value of variable 18 to 0.
Code:
<After Eval>
$gameVariables.setValue(17, 1);
$gameVariables.setValue(18, 0);
</After Eval>

--- Step 3:
(Image 3)
When a player starts the game, you set the value of variable 17 to 1, and the value of variable 18 to 0.

--- Why the solution is not that good:
1) Need to use 2 variables just for this issue
2) Need to customize every single skill and item that recover MP
3) The skill and item cannot change HP too, otherwise it will affect HP
4) Need to set the variables when the game starts, which is a pain in the *** for us that are testing the game in multiple maps.
 

Attachments

  • imagem_2023-01-29_212304892.png
    imagem_2023-01-29_212304892.png
    194.8 KB · Views: 3
  • imagem_2023-01-29_212845983.png
    imagem_2023-01-29_212845983.png
    178.3 KB · Views: 3
  • imagem_2023-01-29_213010609.png
    imagem_2023-01-29_213010609.png
    12.3 KB · Views: 3

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
90
Reaction score
27
First Language
Français
Primarily Uses
N/A
I find this solution to be perfect.
I can no longer use items that restore both HP and MP, but I didn't intend to. It's not a big constraint.
The rest of the negative points you mentioned are nothing at all.
Thanks a lot for your help. It works perfectly well, I'll keep it ^^
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,394
First Language
English
Primarily Uses
RMMV
Both Damage Core and Selection Control modify the makeDamageValue() function.

You don't need to go through all of the other shenanigans you discussed, just open the DamageCore plugin parameters and look at line 20 - make that match the conditional I changed in the code I provided: if (baseDamage < 0 && this.isHpEffect())
 

MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
Woah, thank you, Turan!
I tried to look at Damage Core and could not find how to change it at all... That's because I was looking at the code and forgot the formula is in the paramaters of the plugin!

It is a 100 times better to do this way haha!
At least I had fun and learned other stuff :)

Anyway, just follow the images and it will work :)
 

Attachments

  • 1675095334171.png
    1675095334171.png
    237.9 KB · Views: 1
  • imagem_2023-01-30_131557178.png
    imagem_2023-01-30_131557178.png
    19.1 KB · Views: 1

Jay19

Veteran
Veteran
Joined
Dec 27, 2018
Messages
90
Reaction score
27
First Language
Français
Primarily Uses
N/A
Thank you very much for those explanations. I can mark the topic as solved.

Edit: For those who will weigh in there. Unfortunately, I have several bugs with Turan's solution (he who nevertheless always finds the perfect solutions). Especially on the calculation of the damage of my attacks. I use many plugins, I may have interference. So I come back to MemoriesLP's solution.
Truan, if you go through this, no need to find out why it doesn't work dear me. The other solution works fine.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Chilling at night in a tavern.
ChillingAtTavern.png

After 'multiple breakdowns', it's finally over. 10/10 will do this again.
Ever notice that villains can reform and become better people, but heroes can only ever die... or live long enough to see themselves become villains?

Isn't that interesting?
xabileug wrote on Kaelan's profile.
Will you be back?


got inspired by Tekken 5's character select screen and made some new music today for my character select screen.
I was following my wife around a Dollar Store, trying to amuse myself and stay out of trouble, when I saw a Sudoku puzzle book and it suddenly dawned on me that I thought I knew how to make a Sudoku puzzle in MZ. And when I went home to try...turns out...I was right. Working on it now and it really does seem fairly simple.:rheh:

Forum statistics

Threads
129,842
Messages
1,205,647
Members
170,994
Latest member
sexoanal
Top