Sednaiur

Veteran
Veteran
Joined
Jul 7, 2018
Messages
33
Reaction score
9
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
750
Reaction score
443
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
33
Reaction score
9
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,283
Reaction score
1,692
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
33
Reaction score
9
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

-Updated- Lowered fog / found more problems :kaoswt2:
6 more weeks of this nutty semester. Then maybe I'll have time to game make. After I curl up and sleep for a day or two that is.
Wondering how big I can make Dorothy's skill menu before the game just becomes irredeemably bad.
Studio Blue is playing the RPG Maker game Phil Alone live now! Phil may be alone, but you don't have to be, come join us in chat!

Forum statistics

Threads
109,209
Messages
1,043,078
Members
141,725
Latest member
718346584zy
Top