Predicted Charge Turn Battle

Last update: 19/02/2012 (DD/MM/YYYY)

Download here: PCTB and Order Gauge


  • N/A at this time.

Check Instructions in Script. If you have YEA – Battle Engine Ace in your game, see the Instruction below.

To enable Charge Turn Battle for your YEA – Battle Engine Ace, either change the DEFAULT_BATTLE_SYSTEM constant in Ace Battle Engine to :pctb or make an script call during a game using:


To revert back to DTB mid-game, use the following script call:


Tags: ctb pctb charge time battle charge turn battle rpg maker vx ace rgss3

81 comments on “Predicted Charge Turn Battle

  1. for me after comand Attack game freeze for 1s, but after magic or without script “order gauge” the game runs smoothly
    i use CTB with Victor animated battler and some script

    • It’s true that the Order Gauge sometime make the fps drop low, but I think the Attack issue is in Victor Animated Battler. Can you test without CTB and Order Gauge ?

      • ok i did some test and (3 enemies and 4 hero):
        1. test without CTB and order gauge, but with Victor script and some Yanfly script game runs smoothly
        2. test without order gauge, but with Victor script, CTB and some Yanfly script game runs smoothly
        3. test without Victor script, but with CTB and order gauge some Yanfly script there is small fps drop low
        4. test with CTB, order gauge, Victor script and some Yanfly script there is quite large fps drop low (but for 3 enemies and 1 hero the game runs smoothly and there is no fps drop low maybe by the whole fight once was Fps drop )
        for now i will use your CTB without order gauge unless You have a solution?

      • After tested with a little change at an internet pub, I got somethings like these:

        1, Victor Animated Battle + CTB + Order Gauge Type 2 + 8 Predicted Turns: 56FPS is the lowest.
        2, Victor Animated Battle + CTB + Order Gauge Type 2 + 24 Predicted Turns: 46FPS is the lowest.
        3, Victor Animated Battle + CTB + Order Gauge Type 0 or 1: 58FPS is the lowest.
        4, Victor Animated Battle + CTB + Order Gauge Type 2 + 8 Predicted Turns + YEA – Battle Engine Ace: 38FPS is the lowest, but It occured only when Turn End (Clocktick).

        The dropping FPS when use YEA – Battle Engine Ace is caused of refresh status window, so this will be solved when Yanfly releases AutoHUD again.
        I will post this updated version when I get home.

  2. Hey Yami, I’m using CTB with Yanfly Battle Engine. It works fine, but the enemy takes too much time to make an action. I can’t figure out how to change that..

  3. for the order gauge you should make it where you can set it to display vertical or horizontal and to use custom images instead of icons

  4. Hi Yami, thanks for script, I like it so much. I found an error or a fault of mine during the battle.

    Step by step explanation, 2 Hero and 1 enemy.

    Step 1: Hero 1, select action and the Hero attack.
    Step 2: Hero 2, I press LEFT key, and I can select action of Hero 1, then I select action for Hero 2. Hero 1 do his attack, Hero 2 attack, all in the Hero 2 turn.

    Sorry by my english, I speak Spanish. Google Translate Help me here.

  5. Hi there, I’m having some trouble getting the script to run. I’m trying to use it with YEA – Battle Engine Ace, and followed the instructions for installing it, changed the Default Battle System to pctb. However, when I go to test it out, via battle test, I get an error for script line 702, which is: NoMethodError occurred. undefined method ‘[]’ for nil:NilClass. Any idea what I might be doing wrong?

  6. Nevermind, I figured out what I had done wrong. However, I did manage to get it to hang while in battle, after I told two test characters to guard. Not quite sure what happened, to be honest.

  7. There’s a major compatibility issue with Yanfly’s engine going on.

    The script loads up just fine, but after selecting to attack, the character will attack and then…nothing. The enemies won’t take their turn. The game just sits there doing nothing and you have to exit out.

  8. Hey Yami. For some reason I’m getting this error every time an opponent kills itself with confusion: (Not tested with poison yet)

    I also get an error on the same line when I use a skill that inflicts a state on the caster that has restrictions. (For example I have a skill that will make the caster immune to damage but he will be restricted from attacking. This triggers an error on the same line.)

  9. Pingback: First of many Icon Sets « Candy Coded Response

  10. I had an error. It seems the order gauge script that you coded is not compatible with the Animatted Battle Script of Victor Saint… At first it seems ok but when i selected the attack button. All the members automatically attacks and if the battle if finished. An error will occur saying that

    Script ” line 677: NoMethodError occured. undefined method Attack? for nil:NilClass

  11. I keep getting this error with victor engine- animated battle

    undefined method ’empty?’ for nil:class

    after a few attacks in any battle

  12. Thanks for the awesome script!
    I have however found an error when I try to make an enemy run away.

    (There’s only one enemy for this batle)

    This is the error:

    Script line 815 NoMethodError occurred.
    undefined method ‘item’ for nil:NilClass

  13. First of all, thanks for this amazing script! I couldn’t immagine my game without it 🙂
    However, I’ve encountered a small problem/bug: when using the default ‘Counterattack’ state, I get the following error:

    Script ‘Predected Charge Turn Battle’ line 815: NoMethodError occurred.
    undefined method ‘item’ for nil:Class

    I truy hope you know how to fix this, because, like I said before, i couldn’t immagine this game without this script.
    Thanks for your hard work!

  14. Hiho Yami!
    I´m having a little problem here. When i press the “cancel” button in battle, the cursor changes to another actor, but it´s not the turn of this actor:

    Atual actor:
    When i press “cancel” button:

    I want to know if there´s a way to make the cursor go to “Party Command Window” instead of going to the back actor. Like in the picture:

    Sorry for the bad english, and thanks for the atention! You´ve got a great script here =)

    • more here: Aunt Rita's Pecan Pie Recipe | Amy Loves It! By admin | category: pecan pie | tags: aunt, not-sure, paternal, patneral-grandmother,

  15. Hey everyone! To those who were looking to NOT have the cursor move to the previous/next actor I found a possible way to fix this!

    What you need to do is look for the line “def ctb_prior_actor”
    (Ctrl-F it)
    Once you find that line, move down 3 lines to where it says “prior_index = last_index – 1”
    Change the 1 to a 0.

    Next, go down about 20 lines more to “next_index = last_index + 1”
    and change that 1 to a 0 as well.

    And that should be it!
    Note: You won’t be able to go to the party command menu (where you chose “FIGHT” or “ESCAPE”.
    YF’s Command List script can probably make for a decent work-around for this.

    (Remember to have a copy of the unedited script somewhere, just in case! As I’m technically NOT a scripter, I may not be able to help much if this causes bugs elsewhere! It works fine for me so far, though. ^_^)

      • Since you’re updating the script, you could create an option for the bar to be vertical.
        Also, I believe it would be easier to use characters instead of icons as they can be added individually.

  16. Maybe I’m just stupid, but… the “ctb cost” and “ctb change” doesn’t seem to do anything. What exactly is it meant to do? Looking at the instructions, it seems that the “ctb cost” tag reduces the speed of the user after using a skill or item, and the “ctb change” tag reduces the speed of the target. But neither one seems to be effective. Is the secret in those ‘threshold’ numbers? In short, I love the system itself but I don’t really understand how to turn the script into something more than a display for whose turn is coming up next. 😦

  17. Hey Yami, I can’t seem to get this working with Victor’s Animated battle. (The order gauge is the problem, I think, because the error didn’t pop up until after I put it in.) Here is the error:

    Script ‘YSA Battle Add-On: Order Battlers’ line 677: NoMethodError occurred.

    undefined method `input’ for nil:NilClass

    The error happens I think when an enemy tries to attack? Or when I have to input for the next character. Not sure which is happening.

  18. Hi Yami.

    First of all, thanks for the great scripts. I’m having a problem with your PCTB / Order Guage. Separately, they work great. Together, I get the following error upon starting a battle:

    Script ‘Game_Actor’ line 674: TypeError occurred.

    no implicit conversion from nil to integer

    The offending line:

    def input

    I know minimal scripting to try to force @actions[@action_input_index] = 0 in other places, but that doesn’t seem to work (and I have no problems with this line if either of PCTB / Order Gauge are absent). Would you be able to help me out? Much appreciated.


  19. Hey, I downloaded this script a few days ago for my game, as I reached the conclusion that a CBS was the best type of battle system for what I had in mind.

    It’s working well so far, but there’s one thing that’s being a problem to me. I guess that since this script changes the battle system so much, it completely breaks the way the game figures out when turns start. I want to make things happen in the beginning of a certaing character’s turn, or perhaps an enemy’s turn.

    Specifically, what I want os for each character’s MP to increase by 10 each time their turn comes up. If I try to do this by eventing, All the characters get their first 10 MP at the start of the battle, as they should if I was using the default battle system, and no more. The game can’t detect when turns start and end, it seems.

    I figured since you were the one who made the script, you would be the best person to ask about this. How do you think I should work this out?

    • Disregard my previous post. I found a very simple solution to my problem that works perfectly.

      However, I have run into problems when trying to use Yanfly’s Instant Cast script ( with this. Most of the time, the game acts as if I didn’t even have instant skills and ends the turn when I use them. The other times, it crashes and gives me this error:
      Script ‘Scene_Battle’ line 330: NoMethodError occurred.
      undefined method ‘index’ for nil:NilClass

      Do you have any idea why this might be happening?

      • You don’t need an instant cast script for this battle system. Use the tag, in the ability and it will activate and make the actor that used the ability have a turn immediately after using this skill

  20. Nice! Not the optimal solution, as my game features MP regeneration, but I’m sure I can work around it, probably bu making the stance skill remove the ammount of MP that would have regenerated. The only problem I can see happening is when the current MP is less than the ammount of regeneration.

  21. From the details given, I’m not quite sure what you’re trying to pull off, but I’ve tried an MP regeneration system in a previous project. I prefer to use CTB, but I have trouble figuring out the science behind turn calculation. I just edit the numbers in the script until I find it feeling ‘right’, but as a result, things like the default regeneration and state duration tends to be a little off depending on the enemy’s current order in the turn queue. Anyways, I thought I would direct you to Yanfly’s Lunatic State scripts.

    In Lunatic States Punishment, there is a tag that says: stat slip heal x%. You can combine this effect in other ways that Yanfly doesn’t quite touch on. You can easily make this effect occur before/after a turn or before/after the specific actor’s action (In my opinion, optimal for a CTB system). The only drawback is that you have to give up one of your six stats to create a static stat to ensure MP regeneration is always the same. On the other end, you can make the stat dynamic so the player must chose between raw damage or MP generation.

    This may or may not be helpful, but regardless, it’s good to share ideas.

  22. I have a problem when I put on a state that makes an ally attack an enemy (similar to Berserk status). “Script PCTB line 815: NoMethodError occured. undefined method ‘item’ for nil:NilClass”.

    How can I fix this?

  23. Does it work with victor engine? I cant make it work when you command someone to attack everyone will attack the target then an error pops up

    • sorry PCTB is working fine with VE. The problem is the Order Gauge Script, after the first actor command (ie Attack) other characters will repeat the command then gives an error.

  24. Is there a way to change the mechanic settings such that a specific number of actions can be assigned to a turn?

    I don’t really understand the threshold and tick settings. I get that I can reduce the number of actions in a “turn” by increasing the threshold or lowering the turn_ctr, and I can see that a turn seems to be decided by the @clocktick function, but a previous Yami CTB script had an option to simply set a “turn” to a number of actions. I can’t seem to do better than getting a “turn” to be within a range of actions, like 0-1, 0-2, 2-5, or something like that.

    There was also an option in the old CTB to change a variable that would decide how many actions were in a turn, as well, that would be quite useful.

    Is there any way to reintroduce a set number of actions to define a turn? This would make troop eventing easier, as would state durations.

    • CyberDagger said in a different comment that he found a simple solution to do that, but with no explanation and I can’t figure it out. I’d like turns to be decided by actions instead of time too.

  25. Hey Yami I’m have a problem. When I try to test my game with PCTB, Order Gauge, and YEA Battle Engine I get an error. Here’s the error message:

    (I am using the PCTB)

    Script ‘CHANGE TURN BATTLE’ line 801: NoMethodError occurred.

    undefined method `make_ctb_battler_order’ for BattleManager:Module


    I’ll be really happy if you could fix this.

  26. Hi Yami, your dropbox download is disabled due to traffic, is there any chance you could upload your scripts to github? Thanks!

  27. Can you place this script in Github? Kooki’s link, when I paste it in under the Main it only takes up one line…

  28. In the youtube video at the top the game is predicting like, the next 12 turns, but when I downloaded this script it would only show turns eqaul to the number of battlers i.e 2 actors + 2 enemies = predict 4 turns… I know nothing about coding but might someone know how I can achieve that myself?
    Also does anyone else have problems like ‘missing icons’ on their gauge?

  29. I try making my game have it when you can select two commands. So I added Action Time+ for each party members, enemies, and bosses. But I get an error on it saying:
    “Script ‘YSA Battle System: Predicted Charge Turn’ line 859:
    NoMethodError occured.

    undefined method ‘make_actions’ for nil:NilClass’

    Is this one really messed up.

  30. Ignore the last one, I forgot to set it. ^^; But except the part when I try to set two commands on my party members, enemies, and bosses. When I try to select my commands, it only just started the actions. Is there a problem with that.

  31. Hi I would love to use this script but I cannot get i due to the link being closed. it says that the person has too much traffic. Chould you upload it to github

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s