Kemezryp

it's me
Veteran
Joined
Oct 25, 2015
Messages
47
Reaction score
9
First Language
Polish
Primarily Uses
RMMV
Here I am again, I've been fighting this for some time already but it's too confusing for me.
So, Buffs States Core by Yanfly allows you to create states with custom effects. I'm using this to make a balanced poison and bleeding debuffs. They both cause the target to lose hp but their formulas are different and poison doesn't kill.
Victor Engine Damage Popup plugin causes damage popups to be more custom, you can animate them, change their colors etc. I've tried using SRD's DamagePopupCustomiser, but the "custom" effects were broken.
My goal is to make the Poison damage green, and the Bleeding damage red.

To the problem. I've implemented 2 states for my game, those are the codes I made:
Poison:
Code:
<Custom Remove Effect>
target._customValue = undefined;
</Custom Remove Effect>
<Custom Turn End Effect>
target._customValue = 69;
if (target._customValue !== undefined) {
var value = target._customValue;
target.gainHp(-value);
target.startDamagePopup();
target.startAnimation(59, false, 0); }
</Custom Turn End Effect>
Bleeding:
Code:
<Custom Remove Effect>
target._customValue = undefined;
</Custom Remove Effect>
<Custom Turn End Effect>
target._customValue = 420;
if (target._customValue !== undefined) {
var value = target._customValue;
target.gainHp(-value);
target.startDamagePopup();
target.startAnimation(67, false, 0);
if (target.isDead()) {
target.performCollapse(); }}
</Custom Turn End Effect>
Note:
To make those effects colored, I used:
Code:
var motion = 'Pop High, Fall High, Pop Low, Fall Low, Wait, Wait';
var font = 'this.standardFontFace()';
this.(value, motion, font, 32, '#3DB74D');
for poison (and the same for bleeding but '#C91F1F'). That's in place of:
Code:
target.startDamagePopup();
The issue appears no matter the way to show the popup, so I put a less complicated version for testing.

This code works fine. Sadly, once I turn on VE_DamagePopup, bam, only the Bleeding popup appears (probably because its ID is higher). Now, I've done some research and I'm pretty sure that's because of the function that Victor has overwritten. It's Sprite_Battler.prototype.setupDamagePopup. That function is also in YEP_BattleEngineCore. I think that because the bug occurs for both startDamagePopup() and callCustomPopup.

Here's a project with recreated issue: [TEMPLATE PROJECT]
I removed all the music and most of graphics so it's lightweight, test it at your will~

So yeah, I don't know what else to add. Please ask questions if unsure. Thanks.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,961
Reaction score
2,236
First Language
English
Primarily Uses
RMMV
Unfortunately, if you have two plugins and they're both overwriting the same function, they're not going to be fully compatible with each other.
 

Kemezryp

it's me
Veteran
Joined
Oct 25, 2015
Messages
47
Reaction score
9
First Language
Polish
Primarily Uses
RMMV
updateee, I managed to make a fix for that. It was not exactly what I was aiming for, but I think it looks pretty nice. I was testing things out with this plugin and it turns out that by default this plugin makes state damage sum up and show the full value instead of showing multiple of them. Because of that, instead of changing the plugin code, I changed the code of my states.
The popup works by going trough all the battle members and checking every state they have one by one. I sacrificed one variable for gathering the total damage value that is supposed to popup in the end. This is a temporary fix for only 2 states. That would be a little more complicated for 3 or more but for now it works fine:
Poison:
Code:
<Custom Remove Effect>
target._customValue = undefined;
</Custom Remove Effect>
<Custom Turn End Effect>
target._customValue = 123; //poison damage formula
if (target._customValue !== undefined) {
var value = target._customValue;
target.gainHp(-value);
if (target.isStateAffected(13)) {
$gameVariables.setValue(18, value);}
var motion = 'Pop High, Fall High, Pop Low, Fall Low, Wait';
var font = 'this.standardFontFace()';
target.callCustomPopup(value, motion, font, 36, '#3DB74D') //green
target.startAnimation(140, false, 0);
</Custom Turn End Effect>
Bleeding:
Code:
<Custom Remove Effect>
target._customValue = undefined;
</Custom Remove Effect>
<Custom Turn End Effect>
target._customValue = 321; //bleeding damage formula
if (target._customValue !== undefined) {
var value = target._customValue;
target.gainHp(-value);
var motion = 'Pop High, Fall High, Pop Low, Fall Low, Wait';
var font = 'this.standardFontFace()';
if (target.isStateAffected(4)) {
  value += $gameVariables.value(18);
  target.callCustomPopup(value, motion, font, 36, '#836B36'); //brownish, as a red+green
  $gameVariables.setValue(18, 0);
} else {
  target.callCustomPopup(value, motion, font, 36, '#C91F1F');} //red
target.startAnimation(141, false, 0);
if (target.isDead()) {
target.performCollapse(); }}
</Custom Turn End Effect>
If someone stumbles across this post because they've encountered a similar problem, here's an explanation how to make a fix for 3+ states:
Let's say you've got 4 states. The first state will only have the popup command for its own color.
The second state will have "if" statement that checks if there's the first state. If yes, show color 1+2, else, show color 2.
The third state will have a switch that checks all the combinations: case 3, case 1+3, case 2+3, case 1+2+3
Similarly, the forth state will have even more combinations: case 4, case 1+4, case 2+4, case 3+4, case 1+2+4, case 1+3+4, case 2+3+4, case 1+2+3+4
Of course, all the cases need to have the "variable += value". Another problem is resetting them. In my 2-state fix, I only put "variable = 0" for the bleeding effect, but it gets more complicated with 3+. I suggest checking if there are another states before resetting the variable. So, state 1 checks if there are 2, 3 or 4+, state 2 checks if there's 3 or 4+ and so on. If false, set variable to 0.
It works that way, becasue the state with the highest id shows its popup.
I don't know if it's going to be laggy or not if there's more than one battler with this many states, but I can't see a simpler option without editing the plugin.
So yea, if you have any problem with recreating this, feel free to message me. I will try my best to help you :)
 

Latest Threads

Latest Posts

Latest Profile Posts

Another character battle theme
Sorry everyone. Covid rules made me a laptop potatoe and I would need more exercise and past 2nd invasion I am still fighting for space also here. So I am not enough often here and... well I answer even less to my e-mails. DC is saying a huge HI to everyone with her heavy wet purrings.

You all take care in here ^^
traficaccidence.jpg
"It's time to add cars into the city!"
--- Famous last word of the developer's character before hit by a car :kaoswt2:
Yay, our new game, Causality is finally released on Steam!

Forum statistics

Threads
110,489
Messages
1,053,685
Members
143,582
Latest member
beru
Top