How to Make an End Turn Battle Command (and one extra question)

Getting to the point, I am trying to make a battle system like the RPG Panic at the Dojo and there are two elements I'm struggling to emulate. Apologies if I use the wrong terms or seem out of my depth, I'm new to Maker.

The first big one is an end turn feature. I would like to add one to my battle commands but no plugin I've found seems to let me do so. The Himeworks Actor Battle Command only lets me edit preexisting commands or add a skill as a command. I saw someone use Yanfly's Battle Command List plugin to add a "command execute" (https://forums.rpgmakerweb.com/index.php?threads/a-way-to-promptly-end-the-players-turn.75396/) but that plugin is for Ace and I'm using RMMV.
I really need this command because I'm using Instant Cast on every skill to let players take as many actions as they need a turn, so they need to have the ability to end a turn on their own terms.

The second one is letting Armor and Weapons perform a "dice roll" for how much Mana an Actor gets at the start of the turn. I assume I can do some javascripting in the notes of either to make them choose a random number within a range and add that to the MP gauge. But I'd like someone to walk me through the best plugins to do so I don't brute force it.
(Oh and if you know how to make the MP icon look like a bunch of ticks, kind of like how ammo looks in some games, rather than a bar that'd be great so I don't come back in two days asking that. I'll include an image of what I mean.)

1738693100306.png

Thanks and I hope I did this thread thing right.
simply make the end turn command the one skill that is not instant cast
Took a bit of fiddling and using the "Use Skill" extension of the plugin but I got it working like I wanted and now have a better understanding of how to use Himeworks plugin. Thanks!

Any idea how to do the second paragraph of stuff?
Looking into it myself, the main issue is finding a way to set the MP to 0 at the start of the turn and then doing a "roll" afterward before the player can act. Some threads discuss setting the MP to 0 by doing so at the start of the encounter but to keep full control I'd like to have it isolated to the armor/weapon and happen at every turn.
I don't know how to put into javascript in the armor notes that I want it to set the Actor's MP to zero and then roll at the start of the turn...
Looking into it myself, the main issue is finding a way to set the MP to 0 at the start of the turn and then doing a "roll" afterward before the player can act. Some threads discuss setting the MP to 0 by doing so at the start of the encounter but to keep full control I'd like to have it isolated to the armor/weapon and happen at every turn.
I don't know how to put into javascript in the armor notes that I want it to set the Actor's MP to zero and then roll at the start of the turn...

I have a somewhat similar mechanic where Actors have unlimited actions limited by their MP. What I do is give my actors a passive state that regens mana at the start of each turn. In your case, you could do it similarly and have a passive state that checks for specific armor and weapons, and then sets that actor's MP to the appropriate amount at the start of each turn.

Yanfly's BuffStateCore and AutoPassiveStates should be able to do that.

Someone who's much better at scripting can probably write up a script that does exactly that, but if nobody has done so by the time I have more time on my hands, I'll try to write one myself.
I have a somewhat similar mechanic where Actors have unlimited actions limited by their MP. What I do is give my actors a passive state that regens mana at the start of each turn. In your case, you could do it similarly and have a passive state that checks for specific armor and weapons, and then sets that actor's MP to the appropriate amount at the start of each turn.

Yanfly's BuffStateCore and AutoPassiveStates should be able to do that.

Someone who's much better at scripting can probably write up a script that does exactly that, but if nobody has done so by the time I have more time on my hands, I'll try to write one myself.
That could work if nothing else does, the only problem is that I'd want to keep the script localized entirely inside the armor/weapon to allow for mix and matching. Is there a way to make a state and then say this armor gives that state?
That could work if nothing else does, the only problem is that I'd want to keep the script localized entirely inside the armor/weapon to allow for mix and matching. Is there a way to make a state and then say this armor gives that state?

I'm not sure as I don't use many equipment in my own project but another way to do that would be to make a passive state for each equipment you want to have and set their requirement condition to check if that equipment is equipped on that particular actor.

If there's a way to attach states to equipment, I don't know of it.
I'm not sure as I don't use many equipment in my own project but another way to do that would be to make a passive state for each equipment you want to have and set their requirement condition to check if that equipment is equipped on that particular actor.

If there's a way to attach states to equipment, I don't know of it.
Doing baby steps here. How do I make it so the passive state makes the user gain MP? I can see in the battle test that the state is active due to an icon I gave it but it's not doing what I want it to.
1738730194161.png
Doing baby steps here. How do I make it so the passive state makes the user gain MP? I can see in the battle test that the state is active due to an icon I gave it but it's not doing what I want it to.

You need notetags. Check out the documentation for Yanfly BuffStateCore. For a turn start effect, this what you need to have around your code:


<Custom Turn Start Effect>

code

code

</Custom Turn Start Effect>
You need notetags. Check out the documentation for Yanfly BuffStateCore. For a turn start effect, this what you need to have around your code:


<Custom Turn Start Effect>

code

code

</Custom Turn Start Effect>
Added those and I'm trying that but I don't think I'm doing the scripting right.
1738731734412.png

1738731823864.png

And from the images I can tell that the state is active, it's just not doing what I want it to do.
@funkyvibes


.gainMP() won't work, the correct version of that is .gainMp()


Also, you shouldn't need to do the whole $gameActors thing. That notetag should allow you to use target instead and it will target the actor that is affected by the state.

So try: target.gainMp(20);

Edit: So, I double checked and to make the state look for equipment, you'd use this script:

target.hasWeapon($dataWeapons[ID])
target.hasArmor($dataArmors[ID])

depending on if you're searching for armor or weapon, and then you change the ID to the database ID of the specific equipment you're checking for. You want to create a conditional on the Passive state based on that, and that would look something like this:

JavaScript:
<Custom Passive Condition>
  if (target.hasWeapon($dataWeapons[ID])) {
    condition = true;
  } else {
    condition = false;
  }
  </Custom Passive Condition>

<Custom Turn Start Effect>

target.gainMp(20);

 </Custom Turn Start Effect>
Edit: So, I double checked and to make the state look for equipment, you'd use this script:...
theres no need to. the plugin allows you to attach passive states to armors and weapons with a notetag. giving an actor a passive and making its requirement being to have the gear on is a roundabout way of attaching the passive state to the gear
theres no need to. the plugin allows you to attach passive states to armors and weapons with a notetag. giving an actor a passive and making its requirement being to have the gear on is a roundabout way of attaching the passive state to the gear

I just read through the documentation and yeah. That is definitely a much better way to go about it. I don't have any equipment in my project so far, so I wasn't sure if this was a thing.


@funkyvibes

Disregard my script about checking equipment and read through the documentation for AutoPassiveStates. It shows you how to attach passive states to equipment.
I just read through the documentation and yeah. That is definitely a much better way to go about it. I don't have any equipment in my project so far, so I wasn't sure if this was a thing.


@funkyvibes

Disregard my script about checking equipment and read through the documentation for AutoPassiveStates. It shows you how to attach passive states to equipment.
The putting <Passive State: #> in the notes of the armor/weapon right? That's what I've been using but thanks for confirming it's the best way.
Also, thanks a bunch, I got everything up and running! The only annoying thing to me is wondering if I can change what RMMV considers the start of a turn and if I can add a delay between when the code activates.
Because I want the script to activate AFTER the enemy's attack and I'd like to see the MP hit zero BEFORE the random numbers for the MP come in.
Video:
The only annoying thing to me is wondering if I can change what RMMV considers the start of a turn and if I can add a delay between when the code activates.
Because I want the script to activate AFTER the enemy's attack and I'd like to see the MP hit zero BEFORE the random numbers for the MP come in.
we're missing details here about your setup. im assuming that "End Turn" is a skill with high action speed so that it always goes first? if thats the case, then yes, immediately before that skill gets executed is the start of the turn.
The whole point of the instant actions is that theyre executed during the input phase, which is before the turn starts. if you want the MP regen to happen after the enemies act, then it cant be at the start of the turn. youd have to use something later like a <Custom Turn End Effect> or a <Custom Regenerate Effect>

Edit: also double check your state notetag. the actor lost MP on that second turn. is that intentional?
we're missing details here about your setup. im assuming that "End Turn" is a skill with high action speed so that it always goes first? if thats the case, then yes, immediately before that skill gets executed is the start of the turn.
The whole point of the instant actions is that theyre executed during the input phase, which is before the turn starts. if you want the MP regen to happen after the enemies act, then it cant be at the start of the turn. youd have to use something later like a <Custom Turn End Effect> or a <Custom Regenerate Effect>

Edit: also double check your state notetag. the actor lost MP on that second turn. is that intentional?
I haven't messed with the speed of the "End Turn" skill, it's an empty skill that's the only non-instant so that RMMV knows to end the turn.
The MP loss is intentional, at the start of battle and at the start of the turn I want to set the players MP to zero and then give them a random amount of MP. Then they use all the skills they can, "end turn", let the enemies attack, and then do it all again.
What you said about Instants is interesting and I'm wondering if you can elaborate so that I understand RMMV's battle system better.
Going by what you're saying, RMMV goes Battle Start, Turn Start, Action Start, Action End, Turn End, Enemy Turn, and then Turn Start again and eventually Battle End, right?
The way I have it set up I have a passive state that at the start of the battle sets the MP to 0 and subsequently gives a random amount of MP. I have instants on all attacks so that the player can use every move they can during their turn. I have the "End Turn" skill so that when the player is satisfied they can end their turn. The timeline I'm imagining goes:
Battle Start (do MP setup here since RMMV won't do it on the first turn), Turn Start (do MP setup), All instants go here (I believe this is the input phase you mentioned?, hit the "End Turn" skill, Action Start, Action End, Turn End, Enemy Turn, Turn Start (do MP setup)

Which is wrong because I'm missing a bunch of phases here or misunderstanding them. I tried out the end turn and the regenerate effect and it does work the way I want the battle system to work but I want to make sure I understand the order of battles in RMMV so that when I build on this battle system I don't mess anything up.
Going by what you're saying, RMMV goes Battle Start, Turn Start, Action Start, Action End, Turn End, Enemy Turn, and then Turn Start again and eventually Battle End, right?
Unless you have a plugin that changes it, actors and enemies do their actions within the turn based on their AGI and action speed. actors do not always go first and enemies do not always go last unless the relevant calculations and comparisons makes it so. Before turns begin is an input phase for the player to select the actions their actors perform

What you said about Instants is interesting and I'm wondering if you can elaborate so that I understand RMMV's battle system better.
this is the reason why the normal recommendation is to make a small project to learn what the engine does before using plugins to alter it. Once youre familiar with the engine, understanding plugin changes becomes easier as plugin creators tend to use the same technical terms as the engine. From the Instant Cast plugin's introduction:
When an action has an instant cast property, that action is used immediately
on the spot without needing to wait for the turn to start.
Instant actions for actors are executed during the Input phase immediately as the skill is chosen. they are done before the turn actually begins. An instant action taken by the player on the first turn for example, is done on turn 0 (just like turn 0 troop events). once the input phase is over does turn 1 begin.

Battle Start (do MP setup here since RMMV won't do it on the first turn), Turn Start (do MP setup), All instants go here (I believe this is the input phase you mentioned?, hit the "End Turn" skill, Action Start, Action End, Turn End, Enemy Turn, Turn Start (do MP setup)
Battle Start -> Input -> Turn Start -> Action Start -> Action End -> Turn End -> Input -> Turn Start ->->-> Battle End

Battle Start (do MP setup here since RMMV won't do it on the first turn),
If you want to do things as battles start, Yanfly's Buffs and States core plugin already has a notetag for that. Then after then but still before Input are turn 0 troop events
this is the reason why the normal recommendation is to make a small project to learn what the engine does before using plugins to alter it. Once youre familiar with the engine, understanding plugin changes becomes easier as plugin creators tend to use the same technical terms as the engine.
Oh, this is my smaller project, I tried following some tutorials on making a full game to get familiar but kept getting bored so I decided to do the other route, taking a small part of my dream project (the battle system in this case) and trying to do it and learning from mistakes. Which has been fruitful with all the insights I'm getting from you guys, so thanks again.
Battle Start -> Input -> Turn Start -> Action Start -> Action End -> Turn End -> Input -> Turn Start ->->-> Battle End
Ok I'm understanding now, then where does regenerate come into this? I really hope it's also before turn starts.

Oh and one extra question, is there a way to give the MP bar a filling-up animation whenever I do the gainMp thing?
Ok I'm understanding now, then where does regenerate come into this? I really hope it's also before turn starts.
its just before turn end.

Oh and one extra question, is there a way to give the MP bar a filling-up animation whenever I do the gainMp thing?
add the line
Code:
user.startAnimation(x)
to your state and replace the x with the id of the animation you want from within the animation tab of the database without the leading zeroes
add the line
Code:
user.startAnimation(x)
to your state and replace the x with the id of the animation you want from within the animation tab of the database without the leading zeroes
Where do I put that and how exactly do I write that?
1738792064639.png

1738792093959.png

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-an-end-turn-battle-command-and-one-extra-question.175152/