Help with Custom state effect (again)

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
204
Reaction score
317
First Language
German
Primarily Uses
RMMV
Associated plugins:
YEP_BuffsStatesCore
YEP_ExtraParamFormulas

In the past weeks I had asked for some help with custom state effects but now I have a problem with some
states interfering with each other.

I have a state called "Decay" which has the Notetag <HRG Rate: 150%>.
Basically simulating that any ailments you already have will be amplified (poison, bleeding etc.)

However, if for some reason you have a positive HRG Rate (I have some regeneration states) they also get amplified.
Needless to say, healing more HP than before because your body is decaying does not make sense.

So is it possible to apply the mentioned <HRG Rate: 150%> ONLY if the HRG Rate is negative?

And while I am at it, could the reverse also be done? I plan to make a rejuvination-type state which amplifies passive healing.

Edit: Here's a quick breakdown on what I essentially want to happen:

  • Case 1: A character is afflicted with poison and takes 10% damage from it. If said character then also gets afflicted with decay, the poison damage is increased to 15% damage.
  • Case 2: A character is afflicted with regeneration and heals 10% HP from it. If said character then also gets afflicted with decay, the regeneration is decreased to 5% HP gain.
  • Case 3: If a character with decay has both the poison state and the regeneration state, the individual values are added together (5% heal - 15% damage = -10% total HRG Rate)
 

Attachments

Last edited:

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,864
Reaction score
518
First Language
English
Primarily Uses
N/A
Can you provide screenshots on what you did with each state?
Although my gut is saying you probably put a modifyer on both states, and now they are playing off each other, and that the script wasn't written to work like you intended
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
204
Reaction score
317
First Language
German
Primarily Uses
RMMV
I added a picture to my original post.

So far the "decay" state is the only state with a <HRG Rate: X> modifier.

But this modifier affects both negative and positive HRG parameters.
Which is a problem if decay is present while a state with a positive HRG parameter is present.
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,864
Reaction score
518
First Language
English
Primarily Uses
N/A
What about the other state you mentioned?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,379
Reaction score
1,558
First Language
English
Primarily Uses
RMMV
Couldn't you use a Custom Regenerate Effect on your positive HRG statuses that checks whether the actor has Decay and reduces the regen value if so?
 
Last edited:

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
204
Reaction score
317
First Language
German
Primarily Uses
RMMV
@Trihan
Why yes that is basically what I am looking for.
Essentially I want all -HRG Rates to be amplified and all +HRG Rates to be reduced while the character is affected by decay.
But if I knew how to do it I wouldn't have opened this thread :D
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
204
Reaction score
317
First Language
German
Primarily Uses
RMMV
Okay so I did some experimenting by myself and came up with this:

JavaScript:
<Custom Regenerate Effect>

var gain = user.mhp * 0.1;
var value = gain * -1;

if (user.isStateAffected(116)) {
  user.gainHp(Math.floor(value * 0));

} else if (user.isStateAffected(132) && user.isStateAffected(166)) {
  user.gainHp(Math.floor(value * 1.25));

} else if (user.isStateAffected(132)) {
  user.gainHp(Math.floor(value * 2));

} else if (user.isStateAffected(166)) {
  user.gainHp(Math.floor(value * 0.5));

} else {
  user.gainHp(Math.floor(value * 1));
}

</Custom Regenerate Effect>
For clarity :
This Notetag was added to my poison state, which deals 10% damage each turn.

State 116 is a state called "Stasis" which nullifies any passive healing/damage
State 132 is the "decay" state which Increases passive damage by 100%.
State 166 is the "rejuvination" state which decreases passive damage by 50%.

As you can see in the code, the poison damage is calculated as follows (The first true statement is applied:

1. Is "Stasis" present? 0% Damage
2. Is "Decay" AND "Rejuvination" present? 125% Damage
3. Is "Decay" present? 200% Damage
4. Is "Rejuvination" present? 50% Damage
5. Are none of the states above present? 100% Damage


This works just like I want it to. I am pretty pleased with the results, apart from one thing:
The damage dealt does not show up when it is applied in battle. The damage is indeed applied but
no number shows up on the screen. I would love if anyone could hint at a solution for me because it would be a great inconvenience for me if players couldn't see how much damage they take from states.


Also, if anyone feels the need to clean up my messy code you're more than welcome to.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,379
Reaction score
1,558
First Language
English
Primarily Uses
RMMV
Are you using the default battle system?
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,117
Reaction score
519
First Language
English
Primarily Uses
RMMV
In the <After Eval> I use these to do any damage popups:

target.startDamagePopup();
target.clearResult();

edit: however, depending on where you're applying the damage, you may not want to use after eval and just put it wherever the hp effect is taking place.
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
204
Reaction score
317
First Language
German
Primarily Uses
RMMV
@Trihan
I believe so, yes. Atleast I don't have YEP_BattleEngineCore or anything of the sort.
I do know that it is possible to show HP/MP Values with custom states.

A week or so ago I requested help with another custom state I made (Here).
And @caethyril helped me out with this one, it looked like this:
JavaScript:
<Custom Regenerate Effect>
if (user.mpRate() < 0.1) {
  var gain = Math.floor(user.mmp * 0.3);
  user.gainMp(gain);
  user.removeState(165);
  user.startAnimation(210);
}
</Custom Regenerate Effect>
When this state regenerated MP, the number did show like it was supposed to.

@HumanNinjaToo these statements don't seem to do anything for me, I put them directly above and below the user.gainHp statements and both cases did not work.
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,712
Reaction score
1,162
First Language
EN
Primarily Uses
RMMV
Does the character have any non-zero HRG/MRG traits? I think the default battle system only procs up to one damage popup per frame per battler, based on the current action result. You might be able to merge action results (?) or generate a damage sprite on-the-fly, but a plugin would be a much neater solution. :kaoslp:

Yanfly's Battle Engine Core (BEC) is my go-to recommendation for this kinda thing: it implements a queue instead, so that multiple popups can "spawn" from a single frame's worth of calculation, with appropriate delays/offsets.
There are probably other viable solutions~ :kaophew:
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
204
Reaction score
317
First Language
German
Primarily Uses
RMMV
@caethyril No, all the associated states have no HRG traits anymore.
Also, I try to avoid Yanfly's Battle Engine Core because it conflicts with some of the other plugins I use.

So if I can't fix this in the long term, I'm probably going to scratch the whole "decay" and "rejuvination" mechanic.

But for now I'll continue experimenting. I mean the code you gave me some time ago works perfectly but this state does not seem to work. So there has to be something that can be done.

Edit: wait what the hell?
I changed the state from <Custom Regenerate Effect> to <Custom Turn End Effect> and now it displays the damage numbers. Why would that be the case? I'm so confused right now.
 
Last edited:

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,117
Reaction score
519
First Language
English
Primarily Uses
RMMV
these statements don't seem to do anything for me, I put them directly above and below the user.gainHp statements and both cases did not work.
Probably because you're not using Yanfly Battle Engine Core, I guess I missed that part earlier in the thread.
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
204
Reaction score
317
First Language
German
Primarily Uses
RMMV
Okay I think I'm done working on this damned state for today.
I didn't change the code too much, I merely cleaned it up a bit:

JavaScript:
<Custom Regenerate Effect>
var base = (user.mhp * 0.1) * -1;
if (user.isStateAffected(116) || user.isStateAffected(2)) {
  var mod = 0;
} else if (user.isStateAffected(132) && user.isStateAffected(166)) {
  var mod = 1.25;
} else if (user.isStateAffected(132)) {
  var mod = 2;
} else if (user.isStateAffected(166)) {
  var mod = 0.5;
} else {
  var mod = 1;
}
var dmg = Math.floor(base * mod);
user.gainHp(dmg);
</Custom Regenerate Effect>
But here is one crucial thing I found out during my ~3 hours of experimenting:
It seems that the system is not completely broken. For some odd reason, the damage DOES
display on the screen. But only after several consecutive turns of being afflicted with the poison.
Basically you don't see any numbers at all, and then after a couple of turns the damage numbers suddenly pop up.

While I was experiment I was also examining caethyril's script because that one seemed to work properly.
I was editing the script a bit to look for possible bugs or inconsistencies. At the end it ended up like this:


JavaScript:
<Custom Regenerate Effect>
if (user.isStateAffected(69)) {
  var gain = Math.floor(user.mhp * 0.4);
  user.gainHp(gain);
  user.removeState(69);
  user.startAnimation(210);
} else if (user.hpRate() > 0.7) {
  user.startAnimation(1);
  user.gainHp(Math.floor(user.mhp * 0.8 * -1));
} else {
  user.startAnimation(210);
  user.gainHp(user.mhp);
}
</Custom Regenerate Effect>
This one works properly, both in function and in visuals.
Needless to say, I am pretty confused and frustrated. So I am going to bed for now.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,379
Reaction score
1,558
First Language
English
Primarily Uses
RMMV
Did you try adding target.startDamagePopup() to the one that's behaving inconsistently?
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
First Language
English
Primarily Uses
RMMV
Here's another way to do it:
if (value > 0 && this.isHpEffect() && target.isStateAffected(#)) {
value *= 2;
}
Just change the # for the state ID accordingly as well as whatever coefficient you want to use. You can even work it into your existing code (just a different way to accomplish the same thing). Also, you can flip the ">" sign to "<" for healing. This code would go into your Decay state, and this way there's no need to overwrite the target's existing poisons or other states.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Welcome back to the dark era, where everything is in dark mode!
.
.
.
I'm not complaining! :o
Currently without internet due to storm damage and most of our state is devastated. No idea how long I'll be unable to log onto here, but I'll answer questions as soon as I can.
This is supposed to be pso2 photon blast inspired animation
I'm sure this question's been asked before, but I can't find an answer: is there any way to run the Steam version of RPGMaker *without* being logged into Steam? It's a frustrating extra step sometimes.
Been seeing bright flashes in the sky for a while, and thought it was my eyes playing tricks on me. Nope! Lightning. Now it's raining heavily. Seeing lightning, but not hearing thunder, is weird.

Forum statistics

Threads
100,714
Messages
978,710
Members
132,335
Latest member
Ne9
Top