End Phase Triggers

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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


Get it at Hime Works


Usage


Plug and play. Just set up your events as usual.


Add-ons


You can use extended event page conditions with this script. More information at


http://www.rpgmakervxace.net/topic/4174-event-extend-page-conditions/


Basically, by combining these two scripts, you can have arbitrary page conditions. Now you can really run an event when "all enemies are dead" by simply writing


 
Last edited by a moderator:

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
Sweet! I've been using a workaround script to get this effect, but it was just an ugly hack so I could start balancing numbers.

This looks like something I can build on :)
 

omen613

Veteran
Veteran
Joined
May 22, 2012
Messages
309
Reaction score
109
First Language
English
Primarily Uses
Nice script, this will make things run a bit smoother for boss fights

thanks for taking the time to put this together
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Sweet! I've been using a workaround script to get this effect, but it was just an ugly hack so I could start balancing numbers.

This looks like something I can build on :)
Maybe you can look into this issue:

I've exposed the current end-phase which can be accessed using



Code:
BattleManager.end_phase
It will return :win, :lose, or :abort

The idea is that you can use the extended page condition to say



Code:
if BattleManager.end_phase == :win
   # do this
Which will cause the event to always run when you win***

Now the problem is it goes into an infinite loop because something is happening where the event runs...and then the battle manager checks the phase...and then the event runs again, and repeat.

of course, if you just say



Code:
$game_troop.all_dead?
That is logically equivalent (based on the default engine anyways), but if there are other ways to get a "victory" end phase then it'd be nice to fix the bug.

I haven't found a solution, though that is because I haven't figured out where the problem is coming from. I guess you could always set a self-switch or something.

***well, when I say "always" that's only if the event actually gets to that page. If another page returns true then only that page will be run I think and nothing else...
 
Last edited by a moderator:

antega34

Anthony
Veteran
Joined
Mar 18, 2012
Messages
144
Reaction score
35
First Language
English
Primarily Uses
This is exactly what I've been looking for!

EDIT: However, just as Tsuki said above, it goes into an infinite loop. I'll have to wait for this to be fixed, since i need an event to run once every enemy is defeated. Still good script so far, it has great potential.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
This is exactly what I've been looking for!

EDIT: However, just as Tsuki said above, it goes into an infinite loop. I'll have to wait for this to be fixed, since i need an event to run once every enemy is defeated. Still good script so far, it has great potential.
Just use the other script call I wrote which achieves the same effect under usual (default) conditions.
 

antega34

Anthony
Veteran
Joined
Mar 18, 2012
Messages
144
Reaction score
35
First Language
English
Primarily Uses
You mean $game_troop.all_dead I've tried but kept getting a loop. Or do you mean something else? (if you could maybe show like in a screenshot that'd be easier, or if not I can probably figure it out)\
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Hmm it was working before guess it isn't working anymore.

Will have to figure out how to deal with it.
 

antega34

Anthony
Veteran
Joined
Mar 18, 2012
Messages
144
Reaction score
35
First Language
English
Primarily Uses
Ok. I'll try and figure something out, if it helps. maybe through conditions or variables.
 
Last edited by a moderator:

antega34

Anthony
Veteran
Joined
Mar 18, 2012
Messages
144
Reaction score
35
First Language
English
Primarily Uses
Bump, just in case someone knows how to fix the loop issue, since this script would be very beneficial to myself and others. (Are we allowed to bump other's topics btw?)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I found the issue. It was in the extended page condition script that was not checking whether the event was already run or not (assuming battle/turn span). If you use "moment" it will just keep looping, which is also a bug but I haven't looked at the default conditions long enough to figure out which ones I need to check.

I've updated that script.
 
Last edited by a moderator:

antega34

Anthony
Veteran
Joined
Mar 18, 2012
Messages
144
Reaction score
35
First Language
English
Primarily Uses
Good to know the script is progressing. Hopefully the bug isnt too big and timeconsuming for you.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
It was one line of code. I've already fixed the issue.
 

antega34

Anthony
Veteran
Joined
Mar 18, 2012
Messages
144
Reaction score
35
First Language
English
Primarily Uses
Oh ya, it works perfectly now, thanks! I'll post any bugs I might find, but so far its good.
 

Silent Darkness

Robomage
Veteran
Joined
Nov 28, 2013
Messages
2,283
Reaction score
323
First Language
English
I think it's worth noting, that, for me, at least, you run into compatability issues if, when you're using Battle Rules, that you put Battle Rules before End Phase Triggers. As in, end phase trigger doesn't work, period.
 
Last edited by a moderator:

AdamGlasier

Warper
Member
Joined
Mar 17, 2014
Messages
2
Reaction score
0
First Language
English
Primarily Uses
Wow, this thread is pretty old.

I can't get this script to function. Just like it's promoted, I want a new enemy to appear after the old one has been killed. So I have set the event condition in the battle to activate when the enemy's HP is 0 or less %, it's set for Span = Battle, I've marked then for the new enemy to appear, yet nothing happens. The victory sequence goes on normally. I even started a new project and pasted the script into it (just in case any other scripts in the other project were interfering) but the end-phase event doesn't trigger after my enemy is defeated.

Also tried using the Custom Page Conditions script. That doesn't work either.

If this thread's still alive, could somebody help me out?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I created a new project, set slime HP to 0% or less, set demon king to appear halfway, then attacked the slime normally to kill it. When it died, the demon king appeared.
 

ShinySlowqueen

Veteran
Veteran
Joined
Dec 22, 2015
Messages
49
Reaction score
3
First Language
English
Primarily Uses
RMVXA
Hi, I can't seem to get the $game_troop.all_dead? script to work at all.


Here's my page.  No matter how much is there, I can't get $game_troop.all_dead? to trigger at all.

script.png
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Your condition box say "Don't run".  I haven't used this script, but logically, if you tell it not to run, then it won't.
 

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top