Placeholder States

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

Placeholder States are special states that use a formula to determine which state will be added, when they are actually being added to a battler.

For example, let’s say you had a state called “Freeze”. When you first apply the freeze state, the enemy will be frozen. However, if you applied the freeze state to an enemy that is already frozen, they will shatter and die.

As another example, suppose you had a state called Poison. When you first apply the state to a battler, Poison 1 will be added. When you add the Poison state to a battler that already has Poison 1, it will be removed, and replaced with Poison 2.

This allows you to create states that can be used on the same battler multiple times, but potentially have different results.

Download

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

This is for MV only. For the Ace version, click here.

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 HIME_PlaceholderStates plugin.

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

Usage

Note-tag states with

<placeholder state>
  FORMULA
</placeholder state>

Where the FORMULA is any javascript expression that returns a number, which will be the ID of the state that is actually added or removed. You can use any number of conditions.

The following formula variables are available

a - "this" battler.
v - game variables

So for example, if you wanted a state to have the following logic

  if state 4 is applied     
     add state 5
  else
     add state 4

You can write

  if (a.isStateAffected(4)) {
     5;
  }
  else {
     4;
  } 

Note that the value that the formula resolves to must be a number, so be careful with complex logic.

This plugin can be used in conjunction with any other of my state-related plugins. For example, in the Poison 1 –> Poison 2 example I showed, you can use Overriding States to have Poison 2 automatically remove Poison 1 when it is added.

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...

9 Responses

  1. Sundricat says:

    Could this work for switching out the death state used when HP reaches 0?

  2. AresSF says:

    How can I use this in a way that when the affected enemy is attacked by a certain element do extra damage and change the state to another?
    As an example, an state “Greek Fire” that indicates that the enemy is “soaked” with greek fire, and when attacked by the element “Water”, this attack does extra damage and after that the state change to and state that indicates that is on fire, we can say “Burned” o simply “On fire”.
    Can I use this in a way that an state is removed by a certain element? As an example, a “Frozen” state removed by a “Fire” element attack.

    • Hime says:

      The plugin basically allows you to execute a formula when the placeholder state is added or removed.
      It only runs under those two situations.

      You can have the state have a trait that makes the target weak against water using the element rate feature.
      If you want a state to be removed when attacked by a certain element, you should take a look at the State Damage Modifiers plugin, which are formulas that run whenever you’re affected by an action.

      State damage modifiers is intended to be used on top of damage formulas, so that you CAN change the amount of damage that is dealt, and other things like removing the state after being hit by a fire spell or something.

  3. Jason Banchs says:

    For example, if i don’t put a else handler it doesn’t activate the state at all, but when i put what was given it never took the state off… i still cant figure out what is wrong. (sorry I have been busy)

    • Hime says:

      If you want the state to be activated when your MP is not 0, and automatically removed when your MP is 0, placeholder state isn't meant to do that on its own.

      The plugin simply allows other state-related functions to add or remove a state, and then the game dynamically figures out which state will actually be added or removed, based on the formula.

      If you're adding a state, and the placeholder says 0, that means no state is added. If you're removing a state, and the placeholder says 0, that means no state is removed.

  4. Jason Banchs says:

    Hey Hime, I’ve been trying to use your plugin and i keep getting some errors. I don’t know the limitations of this plugin but i’m trying to use it to make some sort of hyper form. I’m using most of the Yanfly plugins as well but i think i’m getting the concept wrong. I’m trying to do this based of the example:

    if (a.mp(0)) {
    0;
    }
    else {
    28;
    }
    </placeholder state>
    what I am trying to do is if the user’s MP is 0 then the state disappears on the spot, as with the tutorial I was previously using left on turn on the state even if the MP was zero. any help?

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