Conditional Branch based upon script call condition

More or less, this is what I'm looking for.

I'm using Yanfly's Victory Aftermath, and I intend to have a common event that heals all party members post battle.

It also has a little sub event that increases a variable.

Spoiler: Variable in detail
The variable is called Victory Multiplier.

This particular variable is designed only to be increased upon victory, however, the way Yanfly's script works, the common event will run even if...the party escapes from battle.

Okay, not a problem. Conditional Branch time.

There's where my problem lies; I cannot remember exactly what it is in the syntax that determines if the party has won, or has run away.

Anyone who could help me with this little thing, I'd appreciate it a lot. Credit added too! 😅

Spoiler: Edit: I don't know if this is correct but...
Code:
battle_end(0)
Could it be this?
Are you using random encounters or on screen battles?

If on screen it would be something like:
upload_2017-3-16_2-53-46.png


I see no reason to call a script if so as the maker has it built into it through Battle Processing.
@Shinma The common event itself runs after a battle (Yanfly's Victory Aftermath allows this).

However, there is no battle processing in said common event.

Spoiler: Screenshot of event
index.php

I don't know if I am going about this the correct way. Maybe @Trihan has some insight?
I am unable to see your attachment. Could you try to add it again?
Edited.
Are your enemies visible on screen or are they random encounters?
Random Encounters.

As much as I like the Chrono Cross approach, I don't find it fitting.
Ah, hmm. Then my route would not work. I will see if I can find the script call and edit this post if so.
I looked in BattleManager and found

if escape or abort then battle_end(result) = 1
if defeat then battle_end(result) = 2
if victory then battle_end(result) = 0
*is summoned*

It needs to be BattleManager.battle_end(0). A common event runs in the context of an instance of Game_Interpreter, which has no internal concept of a "battle_end" method, so it won't know what you're trying to run when it gets to that line.
@Trihan So, my Conditional Branch needs to have the Script Call be this:
BattleManager.battle_end(0)

Am I correct?
Wait, no, sorry. Calling that will cause a battle to end, you're trying to check whether the party won?

Use $game_troop.all_dead? for your condition.
Excellent.

Now I don't have to table Yanfly's Victory Aftermath.

Yeah, if it weren't for that little part where the common event runs regardless of win or escape (but apparently not loss), this would be less of a problem. Ah well...

Solution achieved. Yay!
I am glad you got it working. Sorry I wasn't more help. 🙂
Wait, no, sorry. Calling that will cause a battle to end, you're trying to check whether the party won?

Use
PHP:
$game_troop.all_dead?
for your condition.

Yeah, um...

Spoiler: Yanfly-Victory Aftermath
PHP:
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Important Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These are some important settings so please set them up properly. This
    # section includes a switch that allows you to skip the victory aftermath
    # phase (for those back to back battles and making them seamless) and it
    # also allows you to declare a common event to run after each battle. If
    # you do not wish to use either of these features, set them to 0. The
    # common event will run regardless of win or escape.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    SKIP_AFTERMATH_SWITCH  = 121  # If switch on, skip aftermath. 0 to disable.
    SKIP_MUSIC_SWITCH      = 122  # If switch on, skip music. 0 to disable.
    AFTERMATH_COMMON_EVENT = 35  # Runs common event after battle. 0 to disable.

I don't know if it means anything, but the common event runs after the battle ends, escape/abort or win.

Would
PHP:
$game_troop.all_dead?
apply after the battle has ended?

@Shinma It's cool; you tried.

You'll still get credit.
As long as you're still in the battle scene when the event runs, then yes.
@Trihan I just tested it; the battle is definitely over (the map screen is shown).

The only issue is the common event repeats, even with Event End labels.
Hmm. What you could do is make a troop event that turns a switch on when the game party is dead, and then have the common event check for that switch being on as its activation condition (and turn the switch off after it runs)
there might be a different way, but I suggest testing it in a copy of the project to see if it works without compatibility problems.

Tsukihime has a plugin that allows you to run a common event directly before a random battle. I don't have the link for it, please search on her blog.

What most people don't know (because you have to read the descriptions of that plugin completely and carefully) is that you can cancel the original troop call of the random table, read the troop ID that was originally called - and then call the same troop in an event battle processing from that common event.
That would allow you to get the "if loose" and "if escaped" branches like a regular evented battle.
@Trihan Isn't there a script call to stop a running event?

I tried the switch and it threw an error, same with Erase Event.

@Andar Looks like I was ninja'd (whatever that means).

I'm not sure I want to run the common event before battle, because it's meant to be a reward for winning, and only such.

Since Yanfly didn't cover the part of being able to run the common event whether escape or win...I'm stuck with said problem.

But the solution is there; issue now is to stop that loop.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-based-upon-script-call-condition.76026/