End Phase Triggers
This script extends the troop event system with “end phase triggers”. This is simply a final check on all of the event pages when a victory/lose condition has been met. Any pages that can be run during this end phase will be executed and may change the outcome of the battle.
This script is completely plug-and-play and requires no additional setup.
Download
Script: download here
Usage
Plug and play. Just set up your events as usual.
Tutorials
If you would like ideas on how to use the script, here are some tutorials written by other developers that I would recommend reading:
- End Phase Triggers for Quests and Player Revival by Sinweaver
I have now the script but I don’t know how to use it…I will make an event, that says: if all enemies are dead than the game will end. Hope someone can help me…
My game seems to ignore the $game_troop.all_dead conditional branch…
Is there any way to fix this? I want the event to run after all enemies have been defeated…
If your page condition is “don’t run” then it won’t run. You may need custom page conditions in order to implement that if the page has a condition that prevents it from running.
I stuck in the “custom page conditions” script, but the $game_troop.all_dead? still isn’t triggering anything.
I’m just supposed to make it say:
Comment: /
Conditional Branch: $game_troop.all_dead? /
End Branch /
Thing I want to happen
Right?
(That’s supposed to say “page condition” after the Comment, it got deleted somehow)
It should work if you just write
in a comment. I’m assuming that is what you wrote.
You should check if end phase triggers works when a specific enemy dies, to verify that the script is working in the first place.
is there a version of this that works with MV?
Yes, here is an MV version.
I can't download the script. Is there another link?
I have updated the link to use a mirror. Please try again.
Found a weird bug…
I have a battle event page that triggers at the end of every turn (it uses a lot of Force Actions to make turrets fire automatically, buffs go off automatically, etc).
If the last enemy dies during this end-of-turn page event (usually during one of these force action attacks), then the framerate will drop considerably, and the battle will never end.
I tried running the same test with your script removed, and the bug didn't happen.
I'd rather not remove the script since I rely on it for one really clever "last chance revival" kind of skill. :s
Do you know how I might fix this problem?
If there is no easy fix for it, can you tell me how to disable this script on victory only, since the only time I'm using it is for when the party is wiped?
I'd have to see your set up, since I used a force action on turn 1 to kill all enemies and my end of turn event runs as usual.
Huh. When I put it into a blank project, it works fine.
….Must be something in my (many) other scripts that's making it blow up. Oh well…Had to happen sometime with so many scripts in one project..
Can you tell me how to disable the script from kicking in when it's a victory condition?
Delete the lines
…Doens't work, apparently the sideview battle system I'm using doesn't like it. 🙁 If I end the battle normally now, it crashes due to a problem with that script, and if I finish during that end-loop, I go to the next turn and can select attacks even though there are no enemies…
Oh well. I guess I can't include this script in this project.
🙂 But thank you for your help, Hime. Sorry for bothering you.
I had the same issue. What I did to fix it was change the process_forced_action around line 120 to:
process_forced_action unless BattleManager.process_win_loss
This did the trick for me, and seems to work fine with everything else I had scripted.
Hope this helps!
Hmm, that’s interesting to know. I didn’t think force action processing would become an issue here.
I have a TON of scripts in my project and have modified quite a few of them to be compatible with one another, so it could be an issue with the various forced action aliases I have going on. 🙂
You’re a god, thank you so much!!! Spared me 5 more hours of suffering!
This seems to make the entire $game_troop.all_dead? call stop working completely.
I did exactly as this and it still didnt work
nevermind, I left the “at end of turn” trigger on.
Are you supposed to make the second enemy appear halfway?
It is not necessary, but I think it is the simplest way if you have enough space in your troop.