Commands: Extensions

Section 4.B.7

You cannot have more than one key in a single hash with the same name. If you do, the last instance of that key will overwrite all of the others, effectively making the duplicate keys meaningless. Because of this, you cannot have duplicate Command Keys in a single hash at the same time. This poses a problem, however, if you wish to use the effects of a Command Key multiple times in a single hash to do different things.

For example, say you want to use the "UserDealtCriticalHit_player" Trigger Key so that some text is displayed when the player's Pokemon scores a critical hit in battle.

"UserDealtCriticalHit_player" => {
  "speech" => [:Opposing, "No fair! Lucky hit...", "C'mon, {1}!"],
  "text"   => [:Opposing, "{1} is raring to go!"]
}

In this example, the opponent will comment on the player's lucky hit. But what if you wanted the player to respond to this with their own line of dialogue? Using the "speech" Command Key is no longer possible, since it has already been used once, right? Well normally, yes. However, you can bypass this limitation by using Command Key extensions.

This is very simple, and much more straightforward than Trigger Key extensions. For Command Keys, all you need to do is include an underscore and then add any other character you want to the key to make it unique. For simplicity's sake, I tend to just use letters in alphabetical order to keep things neat and tidy. However, you can use whatever you want, in reality. Letters, numbers, symbols, or entire words - pretty much anything that can be used in a string can be used here, just as long as it appears after an underscore.

"UserDealtCriticalHit_player" => {
  "speech_A" => [:Opposing, "No fair! Lucky hit...", "C'mon, {1}!"],
  "text"     => [:Opposing, "{1} is raring to go!"],
  "speech_B" => "Hmph, looks like they aren't giving up so easily!"
}

Building off of the previous example, we now added dialogue for the player in response to the opponent's text. Because "speech_A" and "speech_B" are different names, the key limitation is bypassed, allowing you to use as many of the same Command Keys as you'd like in a single hash.

Here's a much more elaborate example, building off of the previous example even further:

"UserDealtCriticalHit_player" => {
    "speech_A"       => [:Opposing, "No fair! Lucky hit...", "C'mon, {1}!"],
    "text_A"         => [:Opposing, "{1} is raring to go!"],
    "speech_B"       => "Hmph, looks like they aren't giving up so easily!",
    "setBattler_A"   => 1,
    "battlerStats_A" => [:ATTACK, 1, :SPEED, 1],
    "speech_C"       => "Hah! Looks like my {1} will stop at nothing to win!",
    "setBattler_B"   => 0,
    "speech_D"       => "Two can play at that game! Let's go, {1}!",
    "battlerStats_B" => [:SPECIAL_ATTACK, 1, :SPEED, 1]
  }

Last updated