Integrating Chat Mapper: Part IV

So it’s come to this, we’re finally ready to take our dialogue tree – which we’ve painstakingly crafted in Chat Mapper and exported and converted to a file RPG Maker can understand – and do something with it! For this part, you’ll need the most important script, the parser. You can download it here. For this script, I ask that you give credit to Matthew Canterbury anytime you use it, whether commercial or non-com. Put this somewhere in your materials folder, like you would any other off-the-shelf script.

FACES: A Detour

But before we do that, there is one little customization option we have to consider – whether or not we’re going to use faces in our Game Messages. You must do one of the two options below.

1. Yes, I want faces: Your project should have a directory called Graphics/Faces. This is where the parser looks for face files to combine with the text in your Message Window. The hitch is that it expects one file per “Actor,” and I use that term not as RPG Maker uses it, but as Chat Mapper uses it (check out Part I for all of that stuff). Which means that if you have this in Chat Mapper:

We set up the Actors in Part I of the Chat Mapper tutorial

We set up the Actors in Part I of the Chat Mapper tutorial

Then in order to draw a face, you need to have a file called “Cecilia.png” in the Graphics/Faces folder. That file should be 4 faces wide by 2 faces high (just like the default RPG Maker templates) but for right now, really only concern yourself with the Top Left. I’ve just copied and pasted the same face 8 times for completeness. And my Graphics/Faces folder looks like this:*

Why did I do this? For features yet to come of course!

Why did I do this? For features yet to come of course!

If you don’t do this step for every actor you have in your Chat Mapper project, you’re going to get an error. So make sure everyone is there.

Sometimes, though, one of your dialogue boxes is just “Got a Lantern!” and you don’t want a face for that single box. What to do? In Chat Mapper, make a new Actor that has a completely blank name, and use them as the actor for that one box. Remember, even though the conversation has a default Actor, you can always change it from box to box. There’s no need to create a blank graphics file in your Graphics/Face folder – the parser will know just not to put a face when it comes to this box.

The dialogue boxes above and below this one will show a face - this single one will be faceless.

The dialogue boxes above and below this one will show a face – this single one will be faceless.

2. No, I don’t want faces: In the parser you just added, go find the section that reads:

if actor != nil && actor.name != ''
     $game_message.face_name = actor.name
else
     $game_message.face_name = ''
end

And replace all 5 lines with:

$game_message.face_name = ''

Remember, you must do one or the other from above. If you don’t do number 2, the parser will expect graphics for all of your Chat Mapper actors!

Load the File

Next, we need to ask RPG Maker to load the .rvdata option we spent all last week making. Create another script section in your RPG Maker file below where you inserted the Dialogue Parser. Add a single line:

DialogTree::load_dialog_file(" ")

And in the ” “, add the file path to the .rvdata file you made. Remember to start the path from the top folder of your project. This means you omit, for example, C:/Program File/RPG Maker/Honey Boo Boo’s Projects/My Game 1 ……all of the junk that comes before your actual project. If you just put the .rvdata file in the “Data” folder, you’d write: “Data/Dialogue.rvdata” – assuming your file is named Dialogue. Got it?

Make sure this runs AFTER the dialogue parser, but BEFORE main.

Make sure this runs AFTER the dialogue parser, but BEFORE main.

Curious as to what the rescue => e nonsense is in the screenshot? If you’re trying to figure out what error is happening, this prints out an error message to the console. It’s particularly helpful for scripting, and if you’re not getting something in all of these scripts and integrations to work, it’s an invaluable tool for your belt.

Call the Parser

It all boils down to a single script call. After everything we’ve done. In your NPC’s event page, where you would’ve had all of these conditional branches, Show Message commands, scripts, switches, variables – we’re going to replace all of it with a single script call:

DialogTree::run_conversation('ConversationName')

That’s it. You’ll obviously need to replace the ConversationName with, well, the name of the Conversation you want from Chat Mapper. Remember wayyy back when, we said that each “tree” is a separate conversation? So basically, you’re picking a tree.

The result is an event that looks something like this:

Elek is ready to converse!

Elek is ready to converse!

What’s fun about the script is that it’ll print to the console as it travels through your tree. So you’ll get to see each condition, and whether it evaluates to true or false. Hime has a post on his blog about how to enable the console.

And that’s it! Those are the steps to integrating Chat Mapper with RPG Maker. Remember, Part III lists all the steps you need to do to make edits to your tree and re-export. If you’ve done everything right, you won’t have to repeat any of the stuff in this post ever again!

The rest of this week we’ll be talking about Vidar, but next week we’ll pick this up again and look at some advanced ways to integrate with various off-the-shelf scripts that change your messaging system. We can use those for positions, for name blocks, for colors, for all sorts of things!

 

*You might be saying, Dean, this is a really weird way to save these graphics, why not have a face sheet with 8 different faces? Soon, the script will support using Chat Mapper’s “mood” function (most of it’s already built), and we’ll be able to do things like “Cecilia’s Sad Face” for just this bit of dialogue, then “Cecilia’s Angry Face” for the next. You’d have 8 emotions on the same sheet to do this.

Advertisements

One thought on “Integrating Chat Mapper: Part IV

  1. Pingback: Chat Mapper – Getting Fancy | The Iron Shoe

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s