Custom Page Conditions
This script allows you to add custom page conditions to your events using comments and conditional branches. You can add an unlimited number of custom page conditions as long as your event page has room for more commands.
A “page condition” is a condition that determines whether the page will be “selected”. For example, if your page required switch 1 to be ON, then it will be skipped while that switch is OFF.
A page will only be selected if all page conditions and custom page conditions are satisfied. This allows you to easily set up complicated activation conditions using built-in functionality. This applies to all events, including troop events and common events.
Download
Script: download here
Installation
Place this script below Materials and above Main
If you are using the “negated conditional branches” script, this script must be placed under it.
Tutorials
- Page Conditions by Sinweaver
Usage
Insert this script below Materials and above Main.
To create a custom event condition, first create a comment with the string
<page condition>
Then create a conditional branch command after the comment.
This conditional branch will be converted into a page condition, and will
be deleted from the command list. Note that any commands inside conditional
branch will also be deleted, for performance reasons.
Troop Page Conditions
For troop events, if you specify custom page conditions, they will be checked at the beginning of each turn (excluding turn 0) if no built-in condition has been applied. This is a workaround because the default engine does not check any conditions if no built-in condition is specified.
Common Event Conditions
For common events to run automatically, the trigger must be set to auto-run or parallel. Since the trigger requires a switch by default, you can use a dummy switch that is always true if you don’t need the switch condition to run your common event. Otherwise, there is no way to determine whether you actually need the switch or not.
Negated Conditional Branches
If you have installed support for negated conditional branches, you can use them as page conditions by writing both tags into the same comment.
<negate condition> <page condition>
Hi Tsukihime,
Not sure if this script is still supported, but I got an odd situation. It seems that if I trigger an event on the other side of a counter, and if this trigger changes a condition that is tested on page condition, the page condition does not detect the change if I dont move… I have to move away from the counter, go back, and trigger it again, and then the change seems to be detected by page condition. If I just stay there and trigger it again, it reacts as the conditions has not been changed. And it seems to have been changed, since I print the value on the console to check it.
Thanks!
Any idea why this script doesn’t work to use as a custom condition?
http://www.rpgmakervxace.net/topic/6138-simple-detect-script/
Thanks in advance! Cheers ^-^
Are you adding the page condition comment above the example in the screenshot?
Just wanted to say that in two and a half years of game making on Ace, this is – by far – the most useful script I have ever used from anyone. Lets me do all kinds of nifty stuff with events that I couldn’t do otherwise (without a ton of hard-to-make, lag-inducing Parallel Processes).
I hope Enterbrain makes the smart move to include such Page Conditions in the next Maker, but for now, Hime, you’re a life saver. Thanks!! 😀
What if you have multiple conditions. Can you nest those conditions, or do you have to use on each one?
My note-tag format does not support nesting so unfortunately you will have to expand your nested conditions.
would be expanded to
So it’s going to be like this?
<page condition>
Conditional Branch: (Condition 1)
Branch End
<page condition>
Conditional Branch: (Condition 2)
Branch End
I’m thinking (“Condition 1” AND “Condiiton 2”) here.
Yes, multiple conditions are treated as cond 1 AND cond 2.
Hey there,
I recently added both this and the Negated Conditional scripts to my map. Before I say anything further I should add that I do have this script (event page conditions) listed BELOW the Negated Conditional Branch script. Here's the error: http://imgur.com/dM0Wg1q
" Script 'page condition' line 514: NameError occurred. undefined method 'custom_condition_met?' for class Game_Interpreter' "
I haven't added anything to my map since I put in both of these scripts, this error pops up a few moments after start-up, so I can't get into my map. As a temporary fix, I've removed lines 512-525 as comments and it lets me run my game fine, but I imagine it may not let me use both 'negate condition' and 'page condition' in the same event until I can find a fix.
The issue should be addressed. Get the latest version of this script and try again.
I'm having trouble. It works great but when I transfer player to a new map it crashes and states: Script 'Custom page condition' line 359: NoMethodError occurred. undefined method 'Custom_condition_met?' for nil:NilClass
This is line 356 to 362
alias :th_event_page_conditions_active? :active?
def active?
th_event_page_conditions_active? && @event.custom_conditions.all? {|cond|
@page_interpreter.custom_condition_met?(cond)
}
end
end
My custom condition is a common event that when you get a specific state it flicks a switch. When you use an item and get a different state it flicks the switch back. I only have two custom conditon common events and they work great. It just crashes when I transfer player to a new map, but not when I transfer player around on the current map. please help/advice.
Problem likely occurs when the common event is already running, but when you change maps, it hasn't been set up properly to take custom conditions. I've switched the order of some code so see if that works.
Yes it does! may i ask why that is?
i guess all the extra event pages… ill just have to have 27 separate events then 😛
That’s how events work. It takes the last available page (where “available” means all conditions are met) and runs that. You need to make sure that every page has a unique condition if you want the correct one to run.
If you have two pages like
1. if A
2. if A or B
Then page 2 will ALWAYS be the one that’s selected because if 1 is satisfied, then so is 2. You can solve the problem by making the conditions unique (that is, it is not possible for two pages to be available)
1. if A
2. if A AND B
However, there might actually be a bug in my script. Do all pages have unique conditions?
I feel stupid now because I knew that. Thanks for everything
and how would one go about doing that? ><
Open your event editor, press prntscrn on your keyboard, open paint, paste the image, then upload it to something like http://www.imgur.com or dropbox
oh ok. lol i have the picture but was trying to figure out how to post it on this site. https://www.dropbox.com/s/9ti83qnmaqvjjjt/helpscreenshot.png
I was trying to recreate the kingdom hearts difficulty setting in this scenario. when you answer the first choice to each of the questions, it sets the variables to 1. when the variables are all one this event is supposed to autorun…
Create a new map, copy the event over, and then delete the other pages (so you only have that page). Does it work then?
Hey Tsukihime. thanks for the great script! ive used it multiple times already but now i have ran into a problem. Im using the script to run an event that i want to activate when 3 variables are at certain numbers. i have the event set to autorun but when the variables reach the desired value, the event doesn’t run. im not too new to rpg maker but it is still very possible i could be making a newbie error. however i have been looking at it for a long time now and it still wont work. is there any advice you can give me here?
Show me a screenshot of your event setup.
Hi Tsukihime,
Thank you for all your scripts, they are amazingly useful! Might I request a bug fix for this one though? It works like a charm the first time, but when troops are called through “battle processing” on a map event (not randomly encountered) and you are allowed to trigger the map event more than once regardless of whether you won, lost or escaped that battle, all battles after the first seem to completely ignore the page conditions. This also happens when a different map event calling the same troop is triggered, so it seems like the script parses the page conditions only once for each troop, and does not keep them in memory for when the troop is called again. Can this be easily fixed?
FYI, I don’t know if this is relevant, but I’m also using the functionality of your Battle Rules and Troop Event Spans on the same troop, so most of my event pages look something like this:
Comment:
Comment:
Conditional Branch: Script: [etc]
Anyway, thanks once again, I really appreciate your sharing all your hard work! (:
Oops.
Comment: [page span: action]
Comment: [page condition]
with the different brackets
The page span script seems to conflict with the custom page conditions. Have to check why.
I don’t think they are conflicting, because the same thing happens when I disable the page span script. But nevermind, come to think of it the page span script is enough, I can even use it to approximate battle span with additional conditions when necessary. The action span is a real lifesaver. Sorry to have bothered you, and thanks again for your scripts!
There might be a different conflict then.
Script has been updated with support for custom conditions for common events.