How to implement every possible Yanfly Tips & Tricks effect in MZ with VisuStella plugins

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
541
Reaction score
133
First Language
English
Primarily Uses
RMMZ
Hello, I'm trying to create an accessory which works similarly the phoenix ring, but which works once per battle, as opposed to breaking it, since it is an equipment piece which grants other benefits. What would be the best way to do it, even using other VS plugins?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,678
First Language
English
Primarily Uses
RMMV
Hello, I'm trying to create an accessory which works similarly the phoenix ring, but which works once per battle, as opposed to breaking it
I'd just use a switch.

Code:
<JS On Add State>
if (target.isActor()) {
    const ring = $dataArmors[101];
    if (target.hasArmor(ring) && !$gameSwitches.value(X)) {
        $gameSwitches.setValue(X, true);
        $gameTemp.requestAnimation([target], 42);
        const hp = Math.floor(target.mhp * 0.25);
        target.gainHp(hp);
    }
}
</JS On Add State>

You'd have to replace the two instances of "X" with the ID of an available switch in your game, then have a turn 0 troop event in every troop that sets the switch to OFF. Or add a post-battle common event that does so, I think the VisuStella Battle Core lets you do that.

This only works correctly if the ring is a unique item. If more than one actor can have it equipped, and it should work once per battle for each of them, I'd change the code entirely and put it into a passive state granted by the ring.
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
541
Reaction score
133
First Language
English
Primarily Uses
RMMZ
This only works correctly if the ring is a unique item. If more than one actor can have it equipped, and it should work once per battle for each of them, I'd change the code entirely and put it into a passive state granted by the ring.
Could you please elaborate on that, this sounds a bit more flexible and less conflictual with "normal" phoenix rings!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,678
First Language
English
Primarily Uses
RMMV
less conflictual
It sounds less conflictual, does it? :wink::guffaw:

Just use mostly the code for Auto-Life with a boolean on the actor.
Code:
<JS Pre-Start Battle>
user.resurrected=false;
</JS Pre-Start Battle>

<JS Post-Apply As Target>
  if ((target.hp <= 0 || target.isDead()) && !target.resurrected) {
    $gameTemp.requestAnimation([target], 49);
    const rate = 0.1;
    const heal = Math.floor(target.mhp * rate);
    target.gainHp(heal);
    target.startDamagePopup();
    target.resurrected=true;
  }
</JS Post-Apply As Target>

Adjust the animation ID and healing math as desired.
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
541
Reaction score
133
First Language
English
Primarily Uses
RMMZ
It sounds less conflictual, does it? :wink::guffaw:

Just use mostly the code for Auto-Life with a boolean on the actor.
Code:
<JS Pre-Start Battle>
user.resurrected=false;
</JS Pre-Start Battle>

<JS Post-Apply As Target>
  if ((target.hp <= 0 || target.isDead()) && !target.resurrected) {
    $gameTemp.requestAnimation([target], 49);
    const rate = 0.1;
    const heal = Math.floor(target.mhp * rate);
    target.gainHp(heal);
    target.startDamagePopup();
    target.resurrected=true;
  }
</JS Post-Apply As Target>

Adjust the animation ID and healing math as desired.
It's a real word!
Thank you very much. Let me save it, thanks a lot.
 
Last edited:

whiteswords12

Villager
Member
Joined
Sep 18, 2022
Messages
13
Reaction score
2
First Language
English
Primarily Uses
RMMZ
JavaScript:
<JS Post-Start Action>
if (action.isPhysical() && action.isAttack() && action.isHpEffect()) {
$gameTemp.requestAnimation([user], 2);
}
</JS Post-Start Action>

<JS Pre-Damage As User>
if (this.isPhysical() && this.isAttack() && this.isHpEffect() && value > 0) {
value *= 2;
value = Math.ceil(value);
user.removeState(state.id);
}
</JS Pre-Damage As User>
Mind Charge:
JavaScript:
<JS Post-Start Action>
if (action.isMagical() && action.isHpEffect()) {
$gameTemp.requestAnimation([user], 2);
}
</JS Post-Start Action>

<JS Pre-Damage As User>
if (this.isMagical() && this.isHpEffect() && value > 0) {
value *= 2;
value = Math.ceil(value);
user.removeState(state.id);
}
</JS Pre-Damage As User>
Looking at this I think I implemented it right. But how can I tell if the buff worked? Is there an icon or something?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,678
First Language
English
Primarily Uses
RMMV
Looking at this I think I implemented it right. But how can I tell if the buff worked? Is there an icon or something?
When asking for help, it's a good idea to be precise in your terminology - "buff" means a specific thing in RPG Maker that isn't related to what you're asking about.

Are you using the above code but also following the full instructions from Yanfly's original Tip & Trick video?

If so, the code is going into a state that you apply via a skill. If you give that state an icon, then that icon will show on the actor while they have it.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,598
Reaction score
13,393
First Language
English
Primarily Uses
RMMZ
The Runic (State) is only for a magic taunt, magic damage and MP. I am trying to create a version where it is a physical taunt, physical damage and TP. Have I got the code right? (Probably not, but I live in hope that one day...)

Code:
<Physical Taunt>
<JS Pre-Damage As Target>
if (this.isPhysical() && this.isHpEffect() && value > 0) {
    value = 0;
    if (DataManager.isSkill(this.item())) {
    const tp = user.skillTpCost(this.item());
    // Recover the TP.
    target.gainTp(tp);
  }
    target.startAnimation(58);
}
</JS Pre-Damage as Target>

Thank you
 

Austrian

Veteran
Veteran
Joined
Jan 17, 2016
Messages
50
Reaction score
22
First Language
English
Primarily Uses
RMMZ
Does the Tricks & Tips Meajai's Soulstealer work without a Battle Statistics Plugin from VISUSTELLA? Assuming there isn't one, if there is then I missed it somewhere.

I tried using it with the sample core plugins, and it doesn't seem to work at all. I know the original version for MV required the Battle Statistics plugin from Yanfly.

Mainly for the user._killCount.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,678
First Language
English
Primarily Uses
RMMV
Does the Tricks & Tips Meajai's Soulstealer work without a Battle Statistics Plugin from VISUSTELLA?
Please go back and read the first post in this thread, where you found Mejai's Soulstealer. Your question is addressed at the top :wink:
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
541
Reaction score
133
First Language
English
Primarily Uses
RMMZ
So, I've had a small try and it appears that one Tip which can now be created is Holy Prism - the new selection control works of battle core just fine and the script can work right as it is? What is a tad problematic is the damage formula (for me).

The ones that require definitely more work are Jump (not attempted) and Void shift - as the scripting language seems a bit different in MZ?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
8,875
Reaction score
6,678
First Language
English
Primarily Uses
RMMV
So, I've had a small try and it appears that one Tip which can now be created is Holy Prism...What is a tad problematic is the damage formula (for me).
In what way? You can take the damage formula from Yanfly's Tip, delete the comment lines, and delete the line breaks so it's all on one line and goes into the damage formula. For that matter, you can even delete the braces, they're superfluous.

The ones that require definitely more work are Jump (not attempted) and Void shift - as the scripting language seems a bit different in MZ?
MV and MZ both use JavaScript. I see Trihan described Jump as a hack but I don't know which part of it actually is wonky at all.

For Void Shift, I see listed in the Battle Core instructions a notetag <Cannot Target User> that you can add. What else doesn't Trihan's version do?
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
541
Reaction score
133
First Language
English
Primarily Uses
RMMZ
In what way? You can take the damage formula from Yanfly's Tip, delete the comment lines, and delete the line breaks so it's all on one line and goes into the damage formula. For that matter, you can even delete the braces, they're superfluous.
oh, ok then, then even the damage formula is fine, so it can officially be added to the list.
MV and MZ both use JavaScript. I see Trihan described Jump as a hack but I don't know which part of it actually is wonky at all.
For Void Shift, I see listed in the Battle Core instructions a notetag <Cannot Target User> that you can add. What else doesn't Trihan's version do?
I thought those two weren't even attempted?
 

EllTipprro

Villager
Member
Joined
Apr 14, 2021
Messages
21
Reaction score
5
First Language
Hungarian
Primarily Uses
RMMZ
I'd like to change kyrie eleison in a way that the amount kyrieHp it has scales up with the number of enemies that has a specific state. Something like: user.def * 0.04 * enemies with state.
Is that possible? And if so how?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
6,151
Reaction score
6,300
First Language
English
Primarily Uses
RMMZ
I'd like to change kyrie eleison in a way that the amount kyrieHp it has scales up with the number of enemies that has a specific state. Something like: user.def * 0.04 * enemies with state.
Is that possible? And if so how?
user.def * 0.04 * $gameTroop.members().filter(member => member.isStateAffected(stateId)).length
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
541
Reaction score
133
First Language
English
Primarily Uses
RMMZ
So, this is a variation of the Tsunami script that is meant to interrupt when the enemy gets hit by a disabling state like stun or berserk

JavaScript:
<JS On Add State>
  user.clearActions();
  let text = '<CENTER>' + user.name() + ' will unleash \\c[4]Tsunami\\c[0] in 3 turns.';
  SceneManager._scene._logWindow._lines.push(text);
  text = '<CENTER>Inflict a state that imposes a restriction on ' + user.name() + ' to cancel it!';
  SceneManager._scene._logWindow._lines.push(text);
  SceneManager._scene._logWindow.refresh();
</JS On Add State>

<JS On Erase State>
  if (user === origin) {
    const skill = 267;
    const target = -2;
    user.forceAction(skill, target);
  }
</JS On Erase State>

<JS Post-Damage As Target>
  let hasRestrictiveState = this.states().some(state => state.restriction !== 'None');
  if (hasRestrictiveState) {
    this.removeState(state.id);
    const text = '<CENTER>' + this.name() + "'s \\c[4]Tsunami\\c[0] is interrupted!";
    SceneManager._scene._logWindow._lines.push(text);
  }
</JS Post-Damage As Target>

But I'm not sure, I think it is redundant? and oops, did I even use the right notetag?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
6,151
Reaction score
6,300
First Language
English
Primarily Uses
RMMZ
So, this is a variation of the Tsunami script that is meant to interrupt when the enemy gets hit by a disabling state like stun or berserk

JavaScript:
<JS On Add State>
  user.clearActions();
  let text = '<CENTER>' + user.name() + ' will unleash \\c[4]Tsunami\\c[0] in 3 turns.';
  SceneManager._scene._logWindow._lines.push(text);
  text = '<CENTER>Inflict a state that imposes a restriction on ' + user.name() + ' to cancel it!';
  SceneManager._scene._logWindow._lines.push(text);
  SceneManager._scene._logWindow.refresh();
</JS On Add State>

<JS On Erase State>
  if (user === origin) {
    const skill = 267;
    const target = -2;
    user.forceAction(skill, target);
  }
</JS On Erase State>

<JS Post-Damage As Target>
  let hasRestrictiveState = this.states().some(state => state.restriction !== 'None');
  if (hasRestrictiveState) {
    this.removeState(state.id);
    const text = '<CENTER>' + this.name() + "'s \\c[4]Tsunami\\c[0] is interrupted!";
    SceneManager._scene._logWindow._lines.push(text);
  }
</JS Post-Damage As Target>

But I'm not sure, I think it is redundant? and oops, did I even use the right notetag?
I can't currently think of a better implementation for it.
 

Latest Threads

Latest Profile Posts

imgur sure is getting weird, one day I lose gradually all my images, the other I get them back randomly and then again they disappear again.
Despite OPT2 praise it still has some strange stories in it. Lady Mikka is trying to work herself to death because of guilt. Guilt over what? ¯\_(ツ)_/¯ So instead of finding a NPC to have a heart to heart with her they decide the cure is a new kimono. So when she drops dead she'll at least be well dressed. I haven't even got to the strange part yet.
Did so much work on the game today. I wish I could post it all in this status update but there is a character limit of course haha. I thought about making a topic for updates, though... maybe.
The most recent sign that I am old. I have done martial arts for over 4 decades. Never HAD to stretch out. Good, of course, but never required. Was doing some kicks in the kitchen because, why not, and I felt a pop in the back of my thigh. Now I am limping around. Gotta love getting old.
One of the biggest perks of being fluent in English is how many new and interesting recipes I am able to find and try out that I would have hardly come across if I just spoke my mothertounge :3

Forum statistics

Threads
131,686
Messages
1,222,250
Members
173,438
Latest member
mikasmell
Top