Common Event/Troop Event Troubleshooting

Hey guys, I was wondering if someone could help me out with this. I think it is likely a "duh" thing that I am overlooking, but here goes.

I have a state named Imprisoned, which lasts for 3 rounds.

I have a variable named Imprisoned and I have a common event set up, also named Imprisoned.

This common event uses conditional branches to see if the first actor is imprisoned, if so it adds +1 to the variable, then jumps to the next actor. If this actor is imprisoned it once more adds +1 and continues until all 4 actors have been checked.

In my troop tab, at 50% health the enemy calls for the common event. If 1 or less actor is imprisoned he will inflict this state on an actor, however, each time he just continually inflicts the state.

Screenshots and walkthrough in the spoiler:

Spoiler
Common Event

Checks 1st actor. If state 'imprisoned ' is inflicted it adds +1 to the variable and uses the label to jump to the next actor. If not inflicted it moves to the next actor. This continues until all 4 actors have been checked. 

Note: I know I need to initially set the variable to 0, but I temporarily took it out to see if it was causing the problem.

k4tb1k.jpg


Troop Event

At 50% it calls the common event, which in turn sets up the variable. It then checks the variable. Since I want 2 actors to receive this state before moving on, I have it set so that if the variable is less than or equal to 1 it inflicts the state and repeats.

rclv7d.jpg


In theory, everything looks right. Starting out on the first pass the common event would be called, the variable would be 0 (see note above), the state would be inflicted once and then the process would repeat. On the second pass the variable should increase by 1 and repeat one last time. I am using a debug script and can see that my variable is never increasing. What am I doing wrong?

Thanks for taking the time!
I am horrible with troop events.. so I could be totally wrong. But try changing the "Span" to turn and see if it works
No luck.

Prior to adding in the variables and common event I had it set to just use the skill twice, but it would sometimes try to inflict the skill on the same character twice, and I wanted 2 different ones, hence the event,
After your 'Show Text' commands, you can call the common event immediately.

Try replacing the contents of your common event with the following :

- Label: Imprisoned

- Conditional Branch: Variables [0009:Imprisoned] <= 2

   - Force Action: [1. Earthen Aspect], [Earthen Prison], Random

   - Conditional Branch: [shinma] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Conditional Branch: [Xycin] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Conditional Branch: [Kenji] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Conditional Branch: [Evans] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Jump to Label: Imprisoned

   -

   : Branch End

This can also be directly placed into your Troops Event right after your 'Show Text' commands.

If you need a screenshot of this eventing, kindly PM me as I only have dropbox. ^^

As a side note, the labels used in your common events are redundant.
Hey Susan, thanks! One thing I should have mentioned is that on the next tab of the troops is for when the enemy reaches 25% health, in which case he then imprisons 3 actors.

That is why I didn't check put the quote below into the common event 

Label: Imprisoned

- Conditional Branch: Variables [0009:Imprisoned] <= 2
I did, however, change the conditionals inside the common event to take out the handling when conditions do not apply.

I will put it into the troop event to see if it works there, but since I had planned to use the Imprisoned event in various places throughout the game it seemed best to place it into a common event that I could then call.

Edit:

My troop tab now looks as follows:

- Text Event

- Label: Imprisoned

- Conditional Branch: Variables [0009:Imprisoned] <= 1

   - Force Action: [1. Earthen Aspect], [Earthen Prison], Random

   - Conditional Branch: [shinma] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Conditional Branch: [Xycin] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Conditional Branch: [Kenji] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Conditional Branch: [Evans] is [imprisoned] Inflicted

      - Control Variables: [0009:Imprisoned] += 1

      -

      : Branch End

   - Jump to Label: Imprisoned

   -

   : Branch End

However, this does not work either. For some reason it is not storing the variable.

I am going to test it out in a vanilla version as it really seems like it should work.
If you intend to use the same event in other places throughout the game, then you are right, you should just use a common event.

You could create another common event as well for when the enemy's HP reaches 25% and below but change the 'Conditional Branch' to "Conditional Branch: Variables [0009: Imprisoned]
Okay, so I just tested it as a common event in a vanilla version and it worked perfectly. This is going to be some odd troubleshooting as I have no clue what sort of script would be interfering.

I just have the one single common event set up.

In the troops tab, page 2 has a check for 50% and places 2 actors in prison. Page 3 has a check for 25% and places 3 actors in prison.

Thanks for the help, Susan!
You are very much welcome, Shinma! ^^

However, I was not very happy with my previous eventing for two reasons :

- The enemy looks silly trying to cast the same state on an already inflicted character;

- When the enemy successfully inflicts the same state on an already inflicted character, it undesirably adds to the variable.

If you do not mind, here is an amended way of eventing that will enable the enemy to inflict the state only once on different characters :

Spoiler
-> Label: Imprisoned-> Conditional Branch: Variables [0009:Imprisoned] <= 1

->> Control Variables: [0010: Randomizer] = Random No. (1...4)

->> Conditional Branch: Script: $game_variables[10] == 1 && $game_switches[1] == false

->>> Force Action: [1. Earthen Aspect], [Earthen Prison], Index 1

->>> Control Variables: [0009: Imprisoned] += 1

->>> Control Switches: [0001: Player1] = ON

->>>

: Branch End

->> Conditional Branch: Script: $game_variables[10] == 2 && $game_switches[2] == false

->>> Force Action: [1. Earthen Aspect], [Earthen Prison], Index 2

->>> Control Variables: [0009: Imprisoned] += 1

->>> Control Switches: [0002: Player2] = ON

->>>

: Branch End

->> Conditional Branch: Script: $game_variables[10] == 3 && $game_switches[3] == false

->>> Force Action: [1. Earthen Aspect], [Earthen Prison], Index 3

->>> Control Variables: [0009: Imprisoned] += 1

->>> Control Switches: [0003: Player3] = ON

->>>

: Branch End

->> Conditional Branch: Script: $game_variables[10] == 4 && $game_switches[4] == false

->>> Force Action: [1. Earthen Aspect], [Earthen Prison], Index 4

->>> Control Variables: [0009:Imprisoned] += 1

->>> Control Switches: [0004: Player4] = ON

->>>

: Branch End

->> Jump to Label: Imprisoned

->>

: Branch End

->
Notes :

Spoiler
- I added 1 variable for randomization, and 4 switches to prevent the same character from being targeted.- Be sure to switch off all 4 switches after the battle.

- Be sure that the state has 100% chance of being inflicted.

- Do not use the default 'Actor X is State Y Inflicted' in the conditional branch for this style of eventing as the party members' formation can usually be changed in-game.

- Every time you change something in your troop events or battle related scripts, be sure to save your project before battle-testing directly from the 'Troops' tab.

- Again, if you need a screenshot of this eventing, please PM me.
This is great. I was actually in the middle of trying to figure out how to make it skip a character if they were already inflicted. This will help a ton. It will be several hours before I am able to get back to the maker, but I can't wait to try it out. Thanks a ton!!   🙂   😀

Edit:

Okay, this works perfectly.

The way the fight will progress is at 75% life he will imprison one actor, which lasts for 3 rounds.

A 50% life he will imprison two actors, which the above sets up perfectly.

Once he reaches 25% he will imprison three actors.

What I did on that 3rd tab was set the Imprisoned variable back to 0 and reset the Player # switches back to off, then set my Conditional Branch to Variable [009] Imprisoned <=2.

This way it doesn't see the variable of 2 and only imprison one more actor and at the same time doesn't overlook the actors that were previously imprisoned.

You've been a ton of help, Susan. I didn't think to do it this way.
You are very much welcome, Shinma!

Glad that it all worked out for you! ^^

Original thread: https://forums.rpgmakerweb.com/threads/common-event-troop-event-troubleshooting.34982/