Triggering an Effect on an Actor Before Command Input

Soryuju

Combat Balance Enthusiast
Veteran
Joined
Apr 19, 2018
Messages
166
Reaction score
175
First Language
English
Primarily Uses
RMMV
My battle system uses an STB-style turn order, where actors execute commands immediately after the player selects them. What I want to know is this: is there a way to trigger an effect on an actor when it becomes their individual turn to act, but before the player inputs any commands for them?

Yanfly’s Buffs and States Core isn’t getting the job done, unfortunately, because the <Custom Action Start Effect> tag only triggers after the player finishes selecting their action during that turn. I want an effect which triggers for the active character before the player makes any command inputs.

The best thing I can think of right now would be to try setting up an effect which triggers at the end of the previous party/troop member’s action, and which targets the next battler in the (AGI-based) queue. However, I’m not currently familiar with how to create this sort of system.

Does anyone know how to implement something like this? Thanks!
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,683
Reaction score
451
First Language
English
Primarily Uses
N/A
Troop events

do turn number 0 + 1

Edit: It won't trigger on the first turn, but it will trigger every turn after that at the beginning
 
Last edited:

Soryuju

Combat Balance Enthusiast
Veteran
Joined
Apr 19, 2018
Messages
166
Reaction score
175
First Language
English
Primarily Uses
RMMV
@Oddball Could you please elaborate a bit? I’m not sure what exactly to include in the event to get it to do what I want.

Edit: If it helps, the specific effect I’m trying to trigger is to set the actor’s MP to 1. I’m not using MP for its traditional purpose, and I want each actor’s MP repeatedly set to 1 immediately before the player begins each of their individual command inputs.

What won’t work is setting the MP value for all actors simultaneously in between rounds of battle. This would fundamentally change the system I’m trying to create.
 
Last edited:

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,683
Reaction score
451
First Language
English
Primarily Uses
N/A
I'll work on it and get back to you. Unless someone else comes up with something first
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,683
Reaction score
451
First Language
English
Primarily Uses
N/A
Wait. By chance is it something were your using force action in a common event, and are doing multiples of those, based on MP? Iv'e found that each force action counts as a turn. At least with MP regen or TP regen. I'm going to do a test and see if thats true by applying a state with a turn end expiring and multipule force actions to see if it expires. This information will be critical in coming up with a work around. Be right back

Edit: So, each force action does count as a turn. I had a skill that applied a state to the user that expired in 3 turns and did 4 forced actions. The state disapeared when the skill was done

Edit: Or you could put the event in the core script. Here is the relevant one for ace

#--------------------------------------------------------------------------
# * Start Command Input
#--------------------------------------------------------------------------
def self.input_start
if @phase != :input
@phase = :input
$game_party.make_actions
$game_troop.make_actions
clear_actor
end
return !@surprise && $game_party.inputable?
end
 
Last edited:

Soryuju

Combat Balance Enthusiast
Veteran
Joined
Apr 19, 2018
Messages
166
Reaction score
175
First Language
English
Primarily Uses
RMMV
I’m using MV, so I don’t think the Ace script will work, sorry!

I’ll try to explain what I’m trying to do in a bit more detail.

I’m using DreamX’s ITB Battle system, which is pretty similar to Yanfly’s STB, but it’s more geared toward characters taking multiple actions per turn. The plugin can be found here: https://forums.rpgmakerweb.com/index.php?threads/instant-turn-battle.58464/

In my battle system, each character’s MP influences the enemy’s AI, and all characters start with 1 MP. Characters gain +1 MP for each action they take within a single turn. When each character’s individual turn comes again, I want their MP to immediately reset to 1. I want it to reset before the player selects the character’s first action to avoid confusion about how much MP that character actually has/will accumulate during that turn.

I already have a Turn 0 event which sets the party’s MP to 1. Turn 0 is the only turn when I want to reset MP for all characters simultaneously, rather than resetting it at the start of each character’s individual turn.

The reason why I can’t have MP reset for everyone in between rounds is because it would mean that slow characters would have very little influence over the enemy AI, and that’s a pretty serious flaw in the system I’ve set up.

Enemies don’t use MP at all - the stat exists, but it doesn’t influence their behavior or anything the player can do to them.

So far I’ve tried to achieve this result via troop events and Yanfly’s Buffs and States Core. Unfortunately, I still haven’t figured out how to get an event or plugin to run in this particular window of time before the player selects a single character’s commands. That’s why I was wondering if it’s possible to trigger the effect after each battler’s individual turn, with the reset effect targeting the battler who will act next in the AGI-based queue. I only care about resetting each actor’s MP, but it doesn’t break anything if it runs for enemies as well.

If there’s another way, that’s great too, but I haven’t found much relevant info by searching these forums.
 

Oddball

Veteran
Veteran
Joined
Sep 4, 2014
Messages
1,683
Reaction score
451
First Language
English
Primarily Uses
N/A
I brought up Start command input, sense there will be a start command input in MV too

Edit: What if the charecters first action reset it to 1? Like you connected all the actors skills to a common event were if the actors MP is above 1, and a switch is off, it sets it to 1 and turns it on. Then all of the enemies skills connect to a common event that turns the switch off?

It would have to be a different common event for each actor, but 1 for each enemy

Edit: It would have to be a different switch for each actor and enemy actions reset them all
 
Last edited:

Soryuju

Combat Balance Enthusiast
Veteran
Joined
Apr 19, 2018
Messages
166
Reaction score
175
First Language
English
Primarily Uses
RMMV
I’m trying to avoid having the reset trigger after the actor’s first skill, because it hides information from the player about how much MP that character will actually have once the skill finishes. Since MP influences the enemy’s AI, that potentially makes it confusing for players to anticipate how the enemy will react to their decisions.

I was digging around and found a script which compares a specific parameter of each actor, and I was wondering if I could maybe use it as the basis for my own event by making it compare AGI. This is the script:

Code:
var currentStrongestActor = $gameParty.members(0);
var currentStrongestAtk = currentStrongestActor.atk;
$gameParty.members().forEach(function(a) {
  if (a.atk > currentStrongestAtk) {
    currentStrongestAtk = a.atk;
    currentStrongestActor = a;
  };
});
I found it here: https://forums.rpgmakerweb.com/index.php?threads/how-to-return-which-party-member-has-highest-parameter-variable-whatever.109025/

My idea would be to modify this script to use AGI instead of ATK, and to add another conditional check for a special “flag” state. Every skill would add this flag state to the user at the end of their turn, designating that they’ve already acted in the current cycle.

I would run the common event to compare AGI immediately after each time this flag state was applied to any battler. I would want to make the check exclude any battler marked with the flag state, including the battler who just finished their turn and triggered the event. Only battlers who haven’t yet acted in the current cycle would be compared.

Whichever battler has the highest AGI of those compared would have their MP reset to 1.

If all battlers were marked with the flag state (everyone has acted in the current cycle), the event would instead remove the flag state from all battlers, and then reset the MP of the battler with the highest AGI overall.

Does this seem like a viable approach? I tried implementing an incomplete version of the event (only accounts for party members and not enemies), but I’m not great at JS, and I can’t get my version to run. Here’s what I’ve got so far:

Code:
var currentFastestActor = $gameParty.members(0);
var currentFastestAgi = currentFastestActor.agi;
$gameParty.aliveMembers().forEach(function(a) {
  if (a.agi > currentFastestAgi && !a.isStateAffected(13)) {
    currentFastestAgi = a.agi;
    currentFastestActor = a;
    currentFastestActor.setMp(1);
  };
});
State 13 is the flag state.

I don’t know if there’s an issue with my structure/syntax, if I left out something important, or if what I’m trying to do here just fundamentally doesn’t work. I’m triggering the common event through the action sequence of a specific test skill, but I can’t get anything within the function to run. Any help would be greatly appreciated.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

In today's seminar:
Presenter: In the past, there was a saying, "One who has tuberculosis is doomed for life." But now-"
Everyone: *starts coughing in unision*
Gosh... Today seems too much like a good day to do nothing....

I need to keep myself focused...! :kaoback:
javascript'ing essentials.

So, what can I do solve this problem, guys? The plugin is MOG_Weather and I have several Yanfly plugins too.

Forum statistics

Threads
93,696
Messages
914,695
Members
123,292
Latest member
VinzBandicoot
Top