Battle Event Not Triggering After Switch is Turned ON – Drop Logic Not Firing

Hey everyone—I'm running into an issue in RPG Maker MV with a battle event that refuses to trigger, even though the conditions are being met.

Here’s what I’m doing:

I have a custom ghost encounter that:
  • Becomes immortal at the start of battle (Turn 0)
  • On HP ≤ 25%, plays a panic message (works perfectly)
  • After that, it should attempt to drop one of three key items via a retry loop (up to 3 tries)
  • If successful, it drops one of the items the player doesn’t already have
  • Then it removes the Immortal state, screams, and escapes the battle.
The panic message is on its own event page, like this:

Condition: HP is 25% or less

Code:
◆If:GhostPanicked is OFF
  ◆Text:None, Window, Top
  :    :The ghost looks panicked!
  ◆Play SE:Scream (90, 100, 0)
  ◆Wait:10 frames
  ◆Control Switches:#0004 GhostPanicked = ON
  ◆Control Switches:#0006 TriggerDrop = ON
  ◆
:End

The code here works fine and the message appears once the HP of this enemy drops to the required level.

Now the problem is with the next event page (the two are in sequential order, with the panic message on event page 3 and the item drop loop on page 4 (the next page). The code for page 4 is as follows (yes I know it's lengthy):

Condition: TriggerDrop switch is on

Code:
◆Control Switches:#0006 TriggerDrop = OFF
◆Control Switches:#0005 ReadyToDrop = ON
◆Text:None, Window, Bottom
:    :[Debug] Drop logic triggered.
◆Control Variables:#0003 RetryCount = 0
◆Label:Retry
◆Control Variables:#0001 Skill Chance = Random 0..2
◆If:Party has Broken Key
  ◆Control Variables:#0003 RetryCount += 1
  ◆If:RetryCount ≥ 3
    ◆Jump to Label:FailDrop
    ◆
  :Else
    ◆Control Variables:#0001 Skill Chance = Random 0..2
    ◆Jump to Label:Retry
    ◆
  :End
  ◆
:Else
  ◆Change Items:Broken Key + 1
  ◆Text:None, Window, Top
  :    :A broken, rusty key hits the ground!
  ◆Jump to Label:FinalScream
  ◆
:End
◆If:Party has Silver Locket
  ◆Control Variables:#0003 RetryCount += 1
  ◆If:RetryCount ≥ 3
    ◆Jump to Label:FailDrop
    ◆
  :Else
    ◆Control Variables:#0001 Skill Chance = Random 0..2
    ◆Jump to Label:Retry
    ◆
  :End
  ◆
:Else
  ◆Change Items:Silver Locket + 1
  ◆Text:None, Window, Bottom
  :    :A pretty locket drops to the ground!
  ◆Jump to Label:FinalScream
  ◆
:End
◆If:Party has Scratched Note
  ◆Control Variables:#0003 RetryCount += 1
  ◆If:RetryCount ≥ 3
    ◆Jump to Label:FailDrop
    ◆
  :Else
    ◆Control Variables:#0001 Skill Chance = Random 0..2
    ◆Jump to Label:Retry
    ◆
  :End
  ◆
:Else
  ◆Change Items:Scratched Note + 1
  ◆Text:None, Window, Bottom
  :    :A tattered, torn piece of paper crumples to the ground.
  ◆Jump to Label:FinalScream
  ◆
:End
◆Jump to Label:FinalScream
◆Label:FailDrop
◆Text:None, Window, Bottom
:    :The ghost didn't drop anything...
◆Label:FinalScream
◆Wait:30 frames
◆Text:None, Window, Bottom
:    :Here, just take it! Get away from me!
◆Play SE:Scream (90, 100, 0)
◆Flash Screen:(255,255,255,255), 30 frames (Wait)
◆Change Enemy State:#1 Ghostly Apparition, - Immortal
◆Force Action:#1 Ghostly Apparition, Escape, Last Target
◆Abort Battle

The item drop page never ends up firing as the Debug message I'm using to ensure the page starts crawling through the item drop loop here doesn't ever show up. The panic message fires correctly, and the switch gets flipped, but nothing else happens afterward.

I've checked the following things:
  • Page order: Drop page is after the panic message page
  • Switch is being set correctly (confirmed via debug messages)
  • No early battle abort or death triggering before the drop logic
  • Span is Moment, not Battle
  • I even tried just setting ReadyToDrop directly from the panic event—still no luck
  • Tried moving drop logic into its own page, tried combining it—all with no effect.

Does anyone have any ideas as to why this is happening and how I can fix it? Has anyone seen this kind of "moment skip" issue before? I can provide screenshots of the event drop pages if anyone needs them or can send the part of the project that's causing the issue to anyone that asks. Since this is part of a custom boss encounter I'm creating, I would like some assistance in figuring out what is borking the event page with the item drop loop.
please show the screenshots of your event pages and show the full window just in case theres something basic being missed.
The panic message fires correctly, and the switch gets flipped, but nothing else happens afterward
Do you have any plugins installed? just to rule out the possibility of a plugin using that same switch and flipping it after use. After the panic page runs, if you open devtools with F8, go to the console tab and type in $gameSwitches.value(6), does it say true?
Screenshots are attached.



No plugins are installed - this is a vanilla install. I'm still too new to bother with using plugins currently. I have not tested using the dev console but will do so while you look at the screenshots.

And I have checked, and entering $gameSwitches.value(6) returns "true". So the switch is flipping but for some reason the item selection loop afterward that is supposed to randomize the item drop isn't.

Update:
After further testing with developer console ($gameSwitches.value()), we’ve confirmed that the switch used to trigger the item drop logic is turning ON as expected. So we’ve narrowed it down to two possibilities:

The event page that runs the item drop loop is not being evaluated (possibly due to RPG Maker’s single-event-per-moment behavior),
OR
The loop itself is hanging
—getting stuck due to a condition not being met or retry logic not resolving properly.

Either way it seems like page 4 of the event that has the loop is the culprit. It's very easy for me to mess up nested loops like we have here. So having extra eyes to look at the loop code is handy.
That entire event doesn't make any sense, especially the retry counts.
and nowhere in that event you decide on which of the three items to drop - if not for the retry counts constantly aborting you would get all three items on the first try, because you check all by possession without any other check between them.

I strongly suggest you try that event completely from scratch...
I don't want all three on the first try. I want a random one out of these three items to drop. That's because this is an optional encounter inside a puzzle room. The room has three items that are hidden around it and each of these three is handled by a conditional event at each of those locations in the room that gives you the item if you don't have it already; if you do, the conditional event then simply displays a message that there's nothing to find here (and this part works fine),

The ghost encounter is supposed to be designed that once you reduce the ghost to 25 percent of its health, it panics, drops one of the three random items, and then escapes (and then vanishes from the room after the fight). So if you ended up fighting the ghost (and you can only do it once), you'll have one of those three items after the encounter, and then you can get the other two in the room itself, since the conditional code already checks to see if you have the item when you snoop in that location.

The fight mechanics work fine until the panic message is deployed, and then after that it hangs, apparently in the loop itself. If there's a simpler way to get the encounter to randomly drop one of those three items after the ghost panics, drops item and then escapes, I'm all ears for that.

Jared
drops one of the three random items
but this part is completely missing in the event - you do have a random variable 0..2, but that variable is never used or checked to determine which of the three, instead all three items are checked (and given if not due to the retry mistake) without distinction.

just test it yourself by first removing all of that retry code - since the random variable is never checked anywhere, it is absolutely useless in all cases and only prevents everything from happening.
then you'll see that the first ghost will give all three items...

Original thread: https://forums.rpgmakerweb.com/threads/battle-event-not-triggering-after-switch-is-turned-on-drop-logic-not-firing.176874/