Game Development Reference
In-Depth Information
Figure 15-1.
A screenshot of the
include?
array method
That means our expression currently looks like this:
$game_party.battle_members.include?(val)
. So close, yet
so far. What do we put in
val
? We have to know if Noah is in the active party, so we must check for his actor ID. Recall
from Chapter 12 (and, briefly noted, again in the previous chapter) that actor information arrays are called in RMVXA
in the form
$game_actors[actor_id]
. So, Noah's array would be
$game_actors[10]
. That is the value we need to
check for.
Creating the Forced Party Member Event
Following, I have placed the event commands belonging to the second half of page 1 of Gemini's event. It has been
tweaked, so that, instead of calling a Battle Processing command, it flips on a switch that will trigger our Autorun event.
@>Text: 'Evil', 3, Normal, Bottom
: : Heh, think you can surpass the power
: : that has been granted to me? Prepare to
: : suffer!
@>Change Battle BGM: 'Dungeon9', 100, 100
@>Control Switches: [0038:activepartymember] = ON
@>
When the
activepartymember
switch has been flipped on, this activates the Autorun event on the map, which
will check to see if Noah is in the active party.
@>Conditional Branch: Script: $game_party.battle_members.include?($game_actors[10])
@>Battle Processing: Gemini
@>
: Else
@>Text: 'Actor5', 6, Normal, Bottom
: : I wish to participate in this battle.
@>Text: -, -, Normal, Bottom
: : Use the Formation option from the menu to add
: : Noah to your active party.
@>Open Menu Screen
@>
: Branch End
@>
The conditional branch uses the Script option and reads as follows:
$game_party.battle_members.include?($game_actors[10])
You can fit it all in the single line provided, but it will appear cut off in the event's contents list. This has no
negative effects on the event itself. We can toggle “Set handling when conditions do not apply,” to get the
else
statement to work with when Noah is not included in
battle_members
. Alternatively, we can have another conditional
branch that reads:
$game_party.battle_members.include?($game_actors[10]) == false
. In either case, when
Noah is not in the player's active party, he expresses a wish to participate in the battle at hand, and then a system