New account registration is temporarily disabled.

[SCRIPTING-VX ACE] MP GENERATION ON TURN START

Posts

Pages: 1
After searching the 'net for some scripts that would help bring my game to where I want it, I came across something that seems like I have to do myself.

Some background. I'm using a CTB. (Specifically, Yami's Predicted Charge Turn Battle on top of Yanfly's Ace Battle Engine) All of the characters in my game have a static ammount of 100 MP. What I want is for a character's MP to regenerate by 10 every time their turn comes up.

I tried using MP regeneration, but it's definitely not what I want. It happens at the end of a turn and shows a message. I want the regeneration to happen at the start of the turn, before the action is chosen, and to show no message, just an increase of the gauge. While this increase will be at its default value of 10 for most of the game, I want to be able to increase it through equipment and states.

How would a script that implements this be? This is my first attempt at scripting, so I'm confused.

I also want to have MP start at 0 in every battle. I think this is achievable by eventing, but if it's substantially more practical to do it by script, feel free to give me some pointers on this one. Perhaps I should attempt this one first, as it is certainly the most simple.
Craze
why would i heal when i could equip a morningstar
15170
You could use YF's Base Troop Events, probably -- but if that doesn't work out, link me to the Yami script and I'll whip something up for you.
Base Troop Events worked wonderfully for setting MP to 0. A single line event did it.

Now for the MP regeneration... The eventing system isn't built to be used with a CTB. The MP increase only happens at the start of the battle, it seems. And when I say at the start, I mean right at the start, not at the start of the turn of the character I am testing this with, who moves after two other characters. I guess the CTB script messes with the battle flow and makes the engine think the first turn never ends. Given how turns work in a CTB, it seems logical that's the case.

I'm a bit lost...

Here's the CTB script...

EDIT: Now that I think about it.. Don't jump into this just now. I'm going to try to see if I have the same problems with the older version of the CTB script. Using old over new is usually a bad idea, but I'm willing to try it to see if a miracle happens. It's late so I'll test it out tomorrow. I'll leave the link here anyway, in case it doesn't work out.
Silly me. It seems the old version is not even up for download anymore, as would be expected.

I did what I should've done from the start and went directly to Yami to ask about this problem I have, since he's naturally the person who understands the code the best.

If you wanto to have a go at it anyway, go right ahead. No harm can come from having more heads trying to crack this.
Craze
why would i heal when i could equip a morningstar
15170
Okay, what EXACTLY do you want at this point? Reply here or PM me and I'll whip it up for you in a jiffy.
I want to be able to make things happen when a character's turn starts, before I give a command. Specifically, I want a character's MP to rise by 10 points at the start of every turn by default, and I want to be able to influence that ammount with equipment.
Craze
why would i heal when i could equip a morningstar
15170
A'ight. You can now use the normal regen parameters within the database and they'll proc whenever the battler's turn begins.

Go to the CTB script and change the top of start_pctb_action to look like this:

#--------------------------------------------------------------------------
  # new method: start_pctb_action
  #--------------------------------------------------------------------------
  def start_pctb_action
    battler = BattleManager.action_list_ctb[0]
    battler.make_actions if battler.actions.size == 0
    battler.regenerate_all # All you have to do is add this line


Go to Game_Battler and delete or comment out the regenerate_all line in on_turn_end. It should be around line 850.

So, basically, you could just set MP Regen to 10% for everybody, and equipment could easily add or subtract from that.
That worked wonderfully! And it's so simple. I expected the workaround to be more complicated than just changing the place of one line in the code.

Then I went to the Ace Battle Engine's code and replaced the MP regen popup with an empty string, removing the regen messages as I wished. Even the sound is gone, something which I didn't expect to happen. I am pleased.

Thanks a lot for the help!
Pages: 1