RSS

[Tutorial] 姫Hime’s Choice Options: $game_troop supported conditional statements

17 Sep

This article serves as an extension to Hime’s Choice Options script and deals solely with $game_troop conditions


$game_troop supported conditional statements

There are 2 methods that might come in handy:

  1. “$game_troop.members.size == x”, or you can write this as “t.members.size == x”. Replace x with the number of enemies you wish to check for.“$game_troop.member == 2” will return true if there are 2 enemies in the troop.
  2. “$game_troop.members[x]”, or you can write this as “t.members[x]”. Replace x with the enemy ID number. “$game_troop.members[0]” will return the reference to the first enemy in the troop in the order they are added. “$game_troop.members[1]” will return the reference to the second enemy in the troop, etc.

The first method can be used in troops event page (press F9 and click on the troops tab). Maybe you want to create a complex battle system that displays some choices to players in the middle of battle, and some of those choices are not available as long as there are more than x number of enemies in the field? You can easily do that using $game_troop.members.size == 3″ or “t.members.size == 3”

For example, you want to display a list of option to players at the start of battle, but some options are disabled if there are more than 2 enemies in battle.

If there are more than 2 enemies, Option 1 will be hidden, Option 2 will be disabled, and Option 3 will be renamed DEF.

Keep in mind that the use of $game_party(…), $game_switches(…), $game_variables(…), and $game_actor(…) are not restricted to non combat situation. We can also use them to disable choices in a combat.

Consider the following scenario:

You want to create a boss fight with 3 different levels of difficulties. You can totally pair up this script with Hime’s Enemy Reinforcement script to create the ultimate boss fight with hellish difficulties. We will not get into the details about how to use that script for now as the enemy reinforcement script is not within the scope of this tutorial. Troops event is done through the Troops page (Press F9, and click on the Troops tab)

For the scenario where you want the player to select the difficulty in the middle of a fight, you can do it like this.

Create a new event page and set the condition so that this happens at turn 0. Then call the Show Choices command and list the different options available to the players. In my case, the players are presented with 3 choices: Easy, Medium, Hard. I made it so that you cannot challenge the hard difficulty with only 1 character in your party, and you cannot challenge the easy difficulty with 4 characters in your party.

This is what you will get during the battle:

As you can see, the option for the hard difficulty is disabled because I have included the line “disable_choice(3, “p.members.size == 1″)”. There is only 1 character on the player’s side in the image, so the hard difficulty is disabled.

Now that I have 4 characters in my party, the option for easy fight is now disabled because I have included “disable_choice(1, “p.members.size == 4″)” in the troops event page.

Voila… mission impossible:

 
Leave a comment

Posted by on September 17, 2015 in Scripts

 

Tags:

Leave a comment