Sednaiur

Veteran
Veteran
Joined
Jul 7, 2018
Messages
35
Reaction score
10
First Language
German
Primarily Uses
RMMV
I like to have a state that, for increased MP-cost, raises the damage output for any direct dealt magical damage by 50%, but removing itself after a successful use of a fitting skill. The increased MP-cost part is trivial, so that is not the problem.

Now, I have put these two custom effects one after another into the notebox of the state (credit for these to YanFly):
Code:
<Custom Initiate Effect>

// Check if the action is a skill and uses MP

if (this.isSkill() && user.skillMpCost(this.item()) > 0) {

// Then remove the state.

user.removeState(stateId);

}

</Custom Initiate Effect>
Code:
<Custom Confirm Effect>

if (this.isMagical() && value !== 0) {

value = Math.ceil(value * 1.50);

}

</Custom Confirm Effect>

My problem is:
The Custom Initiate Effect always works, no matter if I put it first or second into the state's notebox. The Custom Confirm Effect, however, does not increase the magical damage by 50% as it is meant to. Please note that it works when it is put alone.

So my question is:
How do I make a state with the effects of above mentioned custom effects work?
 

kirbwarrior

Veteran
Veteran
Joined
Nov 13, 2014
Messages
810
Reaction score
532
First Language
English
Primarily Uses
N/A
I haven't used those plugins for a while, so I might be saying something stupid, but;
Why is Math.ceil being used? That doesn't seem like it would change anything. Floor seems more accurate, but also "value = 1.50 * value" would also do that.
I think it makes more sense to remove the state at end of action, not beginning. It might be cancelling the effect be removing it early.
 

Sednaiur

Veteran
Veteran
Joined
Jul 7, 2018
Messages
35
Reaction score
10
First Language
German
Primarily Uses
RMMV
Why is Math.ceil being used? That doesn't seem like it would change anything. Floor seems more accurate, but also "value = 1.50 * value" would also do that.
To my knowledge Math.ceil makes the number round up to the next highest full number, while Math.floor would round it down. The custom confirm effect itself works fine if used without the custom initiate effect.
I think it makes more sense to remove the state at end of action, not beginning. It might be cancelling the effect be removing it early.
I thought that aswell so when I first tested it, I had the custom confirm effect go off first and then have the custom initiate effect remove the state itself. Unfortunately the effect to raise the damage output by 50% only ever works without the state-removing effect, no matter in what order I put them.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,366
Reaction score
1,777
First Language
EN
Primarily Uses
RMMZ
The order of these notetags in the note box does not affect their order of execution. The initiate effect always happens before the confirm effect: if you remove the state during the former, it's not there for the latter. :kaoswt:

I think you may be able to pack it all into one notetag, something like this maybe?
Code:
<Custom Confirm Effect>
if (this.isSkill() && user.skillMpCost(this.item()) > 0 && this.isMagical() && value !== 0) {
  value = Math.ceil(value * 1.50);
  user.removeState(stateId);
}
</Custom Confirm Effect>

Edit: alternatively, if it's important to remove the state regardless of whether the skill hits or is magical/non-zero-result, maybe try this~
Code:
<Custom Initiate Effect>
// Only proc effect for skills that cost MP
if (this.isSkill() && user.skillMpCost(this.item()) > 0) {
  this._amplify = true;
}
</Custom Initiate Effect>

<Custom Confirm Effect>
// Multiply output if appropriate
// (This only runs if the skill hits)
if (this._amplify && this.isMagical()) {
  value = Math.ceil(value * 1.5);
}
</Custom Confirm Effect>

<Custom Conclude Effect>
// Check if state was used up
if (this._amplify) {
  this._amplify = undefined;
  user.removeState(stateId);
}
</Custom Conclude Effect>
 
Last edited:

Sednaiur

Veteran
Veteran
Joined
Jul 7, 2018
Messages
35
Reaction score
10
First Language
German
Primarily Uses
RMMV
caethyril said:
The order of these notetags in the note box does not affect their order of execution. The initiate effect always happens before the confirm effect: if you remove the state during the former, it's not there for the latter.
Thank you very much for this information.
I just stumbled upon this possibility while I was inspecting my other states and one of them had
Code:
if (this.isPhysical() && target.result().hpDamage > 0) {
in a notetag, so I thought that combining them like this could do the trick for me, even though, I would have picked the confirm effect first, so I would have been wrong anyways.
So yes, you are right with your solution and I like to thank you very much. ^^
Code:
<Custom Confirm Effect>
if (this.isSkill() && user.skillMpCost(this.item()) > 0 && this.isMagical() && value !== 0) {
  value = Math.ceil(value * 1.50);
  user.removeState(stateId);
}
</Custom Confirm Effect>
This one works just fine.

But the code you posted afterwards will also be helpful for reference in maybe upcomming later situations, so thank you again.
 

Latest Threads

Latest Profile Posts

Kind of relieved that I had medibang installed when I need to edit Sprite I was about to download gimp but I remember I had medibang installed lol
Voting for the first round of the Map Madness Tournament is now live! Vote for your favorite in each matchup!

Finally started working on Grim Trigger episode 2 today :LZScat: it's half comic/half visual novel!

GfY3Rwj.png
Is it interesting to get more backstory on villains? A key moment in their past, their childhood, or maybe something that shows they've always been that way? To see or not to see?
"Everything tastes like chicken until it's chicken, then it doesn't taste like chicken."
Context: chicken samosas do not taste like chicken. I thought it was veggie samosas.
Just another ordinary evening.

Forum statistics

Threads
110,365
Messages
1,052,625
Members
143,398
Latest member
Rintosi
Top