Quote
$IanSchoolPeople = []
$IanSchoolPeople.clear
if $game_switches[2] == true
then
$IanSchoolPeople.push("Ask About\
Bartholomew")
end
Notes: I created an array, $IanSchoolPeople, which will store my list of choices, and empties it, in case I go through the same conversation more than once. I also check to see if Switch 2 is ON, which means I've met Bartholomew, so I can logically ask about him. Note that it is usually easier to go to Conditional Branch, and type "$game_switches[2] == true" in the script box on page 4 of the Conditional Branch options. I show this method because, using scripting, you can also check the self-switches of other events.
Just replace $game_switches[
switch number] with $game_self_switches[[
map number, event number, "switch letter"]], like so:
if $game_self_switches[[2, 8, "B"]] == true
EDIT: Note that, unlike $game_switches, $game_self_switches contains its data in double brackets [[]]. I learned this the hard way--you'll get a "Wrong number of arguments" error if you use single brackets.
You can use a similar process to check for items in the inventory, character stats, etc. I haven't figured out how to do any of that yet, but all of the information is stored in a number of variables, arrays, and objects. (An array is basically a list of numbers or "strings" of words; an object is a complex combination of variables that are connected to one thing--like one party member's stats, armor, name, and ID number.) Use Conditional Branches or $game_variables[
variable number] to check the variables that events usually access.
The command $YourArrayHere.push("New Choice Here") adds a new choice to your list of choices. Next, you need to call up the choice screen:
Quote
Choices.setup(350, $IanSchoolPeople)
The first number--width--is in pixels, I believe. Experiment around 200 to get a feel for it. Now, if you try to run the event, but all of your switches are off, then your array may be completely empty! This will crash the game. So, go
right before the Choices.setup script, and enter in a Conditional Branch using $YourArrayHere.empty? == true to prevent this crash. You can either set it to "Exit Event Processing" or "Jump to Label" to jump to a different place in your event. Either way, it needs to skip the Choices.setup script. Ideally, it should skip the check-what-the-player-chose scripts ahead, also, or a choice from a previous event might make something weird happen.
Now for the part I had the most fun figuring out--processing what the player chooses. The choice script will set a variable (number 15 by default) to the number of the choice; the first choice in the array is 1, the second is 2, etc. But because the player won't always have the same choices, the number doesn't always mean the same thing. In my game, the player could have the options to "Ask About Prof. Evan" (1), "Ask About Bartholomew" (2), and "Ask About Charlie" (3), but they could also have the options "Ask About Isaac" (1), "Ask About Charlie" (2), and "Ask About Training" (3). The numbers and options don't necessarily match up. So, here's my solution:
Quote
@>Script: $chosen = $game_variables[15] - 1
@>Conditional Branch: Script: $IanSchoolPeople[$chosen] == "Ask About Bartholomew"
@>Show Text: Bartholomew doesn't seem very interested in
@> : his classes, does he?
@>
: Branch End
@>Label: JumpHereToSkipChoices
@>
The purpose here is to go backwards and use the choice number to generate the actual Choice the player picked, which we can use as a condition no matter what switches happen to be on or off. Creating a new variable (in this case, $chosen) is necessary because the first choice in $game_variables[15] is 1, but the first choice listed in $IanSchoolPeople[] is string 0, $IanSchoolPeople[0]. If your condition was $IanSchoolPeople[$game_variables[15]], then you would always be one choice off from what you wanted. I don't think I explained that very clearly, but the code works just fine.
Another note: So far as I can tell, the script simply ignores all nil choices. So, even if your array is "Choice A", "Choice B", nil, "Choice D", Choice D will still register as #3, and you will need the technique above to process the choice's consequences.
If any of you more experienced coders see a better way to do the same process, feel free to post. If any of my fellow-newbies have questions, feel free to ask me. Or someone more experienced.