Custom Page Conditions

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

customPageConditions5

Events are a collection of pages. Depending on which page is active, the event will appear and behave differently. To determine which page is active, a set of page conditions are used. If all page conditions are met, then that page can be activated.

By default, RPG Maker provides 5 different page conditions:

customPageConditions1

But if you wanted to have a different condition, you would need to find a way to accomplish that using only these 5 conditions. This may involve using parallel processes to check whether conditions are met, in order to turn on a switch or change a variable.

This plugin provides you with an easy way to define your own page conditions without having to come up with workarounds. If you want to check whether you have a certain weapon or armor, or whether a given combination of actors is in the party, you can directly specify this in your event.

By using custom page conditions, it improves productivity and makes it easier to manage your project. Need some more page conditions? Download the plugin and try it out!

Downloads

Plugin: download here (right-click and save as)

  • Want to read the motivation behind this plugin? Check out the dev log!

Installation

Download the plugin and place it in the “plugins” folder in your project’s “js” folder. Then open your Plugin Manager (F10), double-click an empty row, and select the Custom Page Conditions plugin.

Once it is in your list of plugins, turn the plugin on.

Usage

To create a custom page condition, in your event, start by creating a comment that reads

<page condition>

This tells the engine that you are now beginning a page condition.

Next, you can create any event commands as your page condition.

  • You can use conditional branches to check whether certain conditions have been met.
  • You can use Control Variables to set a variable to a random number, and check that value to see if the page should activate. This is random page activation!

Here is an example of an event page that will be activated only when two specific combinations of actors are in the party.

customPageConditionsMV3

These commands are executed during the page selection process, which is done by checking the last page and working up to the first page. Any commands that are in the page condition will be processed like usual.

A page will only be considered active when this plugin command is executed

activate_page

This gives you a lot of flexibility over when a page should be activated or not.

Finally, when you are done with your page condition commands, create another comment and write

</page condition>

Which will tell the engine that the page condition is complete.

Page conditions will not be executed as part of the normal event processing, so you should only have page condition logic in there.

Custom Troop Page Conditions

You can use these page conditions in troop events as well!

The instructions are the same as for a regular event: add the start comment, write your logic, and then add an end comment.

However, note that troop events require one of the default page conditions to be met. So for example, suppose you wanted an event to run the first time someone was poisoned and you wrote this:

customPageConditionsMV4

This won’t actually acticate because the default condition is “Don’t Run”. If you want it to run at anytime, reserve a switch that will always be ON and then use that as the default troop page condition.

customPageConditionsMV5

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

23 Responses

  1. Marc Baril says:

    I got a question.
    I use your script and I enconter some begavior. I did’t know if that came from your script or if it’s a rpg maker bug.
    inside my page I use conditional brench with script.
    I use this script:
    $gameParty.leader() === $gameActors.actor(3);
    That look of actor 3 was the leader…
    But it’s did’t work as long as I did’t talk to another npc.

    On the other side if I put actor id in variabl first(exempl 300) it’s work immediatly:
    $gameParty.leader() === $gameActors.actor($gameVariables.value(300));

    I tryed to find out the problem.
    If after going in the menu and changing player position I talk to a NPC wih text only, it’s did reresh it and still didt check the condition.
    If I talk to a player that add a player on the team, the event immediatly refresh.
    If I talk to a playr that just affct a valu to a variable(any variabl) it’s refresh corectly.
    Any idea where that comming from?

    Also did you have an idea by the way how check if the leader have a specific skill?

  2. Erick Sandoval says:

    Could it works with the “Common Events”?

  3. Sundricat says:

    In a troop event page, how would I check for a specific enemy ID in troop position 1?

    • Sundricat says:

      I also need to do a script call to check if a certain troop position contains an enemy.

      • Hime says:

        !!$gameTroop.members()[3]

        Will determine whether the fourth position contains an enemy or not. You can use that as your condition.
        If there is no enemy, it will be false.

    • Hime says:

      $gameTroop.members()

      returns an array of enemies in the current troop. It is zero-indexed, so position 1 is index 0.

      $gameTroop.members()[0]
      

      Will give you the enemy in position 1, which is a Game_Enemy object.

      $gameTroop.members()[0].enemyId()
      

      Will give you the ID of the enemy (default, the database ID). You can then check if it’s equal to a particular ID or not.

  4. Kiki says:

    I was wondering if someone could help me. I’m trying to make an after-battle pre-victory screen conversation, ala Tales of-series. I have HIME Endphase trigger, and this one, and a yanfly(i think) plugin that duplicates the first troop pages for every troop. But there’s no “if all enemies are defeated” conditional branch that I can do, and I’m not sure how to get around it.

    • Kiki says:

      Nevermind, I got it! Just have to mark the conditional branch as knockout enemy 1/2/3/4 etc and it will apply to all monsters, and it works,

  5. Sundricat says:

    This is a perfect match to go with a quest system can look up information on a quest using a conditional branch script call.

  6. SoulOfRock says:

    Can you help me to use your awesome plugin with Vlue Time System I want to make appear an event only at the 8pm. Help pls >u<

  7. Troctzul says:

    This looks super helpful! Downloading now, and hope to make good use of this plugin!

  8. PenutChen says:

    I have some problems with scripts.
    I made this:

    comment: < page condition >

    script: false;

    http://imgur.com/UkUqOMt

    but this page still appear, why?

  9. MuteDay says:

    have you thought about adding
    < page condition or >

  10. MuteDay says:

    i was wondering if you could add something like so we wouldnt have to use the script calls, for instance

    if: party has (item)

    end

  11. Bearsmith says:

    One of my favorite scripts. I love anything that reduces the number of workarounds I have to do. It gets out of hand sometimes! Thank you so much.

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax