Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [RM2k3] Conversation for New Users, A talkative NPC tutorial [Skill Level: Newbie]
Garlyle
post Feb 3 2008, 12:10 AM
Post #1


RRR's little gay boy
Group Icon

Group: Revolutionary
Posts: 3,375
Type: Developer
RM Skill: Advanced




This tutorial is meant for RPG Maker users of -any- maker: This tutorial is written specifically with 2k3 in mind, however, it should still work for 95, 2k, XP, VX, and even SimRPGmaker. HOWEVER, not all of this will work with all makers - some do not have face graphics, others will have differently named commands, but regardless this should prove a good starting point.

The tutorial is divided into progressively more complex sections. Each section ends with a Code, which is a sample of how the code will look with each new technique added. You can then test these out yourself! Remember, these are NOT RGSS Codes - these are event window codes that you'll have to input manually. However, once you do, you'll be able to test them out and see them at work yourself!



1. Message: A very simple command, and a pretty straight forward one. The box allows you to enter a message, and what you enter will show up. As a tip, remember that just because the NPC's code contains the message, your heroes don't have to be silent. Try attaching a character name at the start of a message.

CODE
<>Message: NPC:
:     Hello, Hero!  You're looking good today!
<>Message: Hero:
:     Of course I'm looking fine today, I'm the hero!
<>

Note: Messages do not auto-wrap - that is to say, if a message is too long (in terms of width), the window will simply not display the entire line. For this reason, be sure to check all messages that you send, and hit enter to turn them into multi-lined messages.


2. Face Graphics: An option that can spruce up your text. By selecting a Face Graphic with this command (Third on the list in 2k3), you'll be able to add a face graphic to automatically appear next to the message! Use it before the message you want to have the picture show up against. You can set it to be on the left or right side, and whether you want it facing normally or flipped around. If you pick (Erase), you can also remove the face graphic from later messages.

CODE
<>Change Face Graphics: faces1, 3, Left
<>Message: NPC:
:     Hello, Hero!  You're looking good today!
<>Change Face Graphics: hero1, 1, Right, Mirror
<>Message: Hero:
:     Of course I'm looking fine today, I'm the hero!
<>

Note: If you use this, remember to also set the face graphic at the start of every event, because the chosen graphic will continue to display for all messages - even if you change events - until you change the graphic



3. Show Choices. This is how you create the first stage of interactivity in your conversations. When you open this window, the four dialog boxes will be choices - fill in at least two of them. Any that are left blank will not occur. On the right side of this window is the "Cancellation Behaviour". This is what the selection will default to if you hit the cancel button. Ignore prevents you from using the cancel button on this conversation, while Execute Handler causes an additional condition to occur if you hit cancel. This is what a basic Show Choices looks like.
CODE
<>Show Choices: Why thank you/Worship me like a god
: [Why thank you] Handler
...<>
: [Worship me like a god] Handler
...<>
: End
<>


You can now have different things occur by placing them in the indented areas. For instance, the above example becomes:
CODE
<>Change Face Graphics: faces1, 3, Left
<>Message: NPC:
:     Hello, Hero!  You're looking good today!
<>Change Face Graphics: hero1, 1, Right, Mirror
<>Show Choices: Why thank you/Worship me like a god
: [Why thank you] Handler
...<>Message: Hero:
:     Why thank you.  You're looking swell yourself.
...<>
: [Worship me like a god] Handler
...<>Message: Hero:
:     I'm the main character, and you're just a lousy
:     NPC.  Of course I look good to you.  Now worship me
:     like the god and saviour I am to you people
...<>
: End
<>

Obviously, the stuff that comes after "End" will happen after whatever choices you made.




4. Switch Operations: This is the part of the code where we make it so that, once you've talked to this NPC once, he'll start talking differently to the Hero from then on. To do this, we're going to need Switches.

Switch: An 'indicator' of sorts. These are normally all set to OFF. An event can set them to ON or OFF. Depending on whether they're ON or OFF, different things can happen.

The best way to explain it is this example: A chest.
Without a switch: The player goes to open the chest and gets the item. Once he's picked it up, it can be opened and obtained again and again.
With a switch: The player goes to open the chest and gets the item. At the end of the event, a switch is turned on. By having the game check to see if that switch is on, it can be prevented from giving the player the item over and over again.

At the end of our NPC Talking code, add a new line using the Switch Operations action. You will see a small box appear. Do not freak out. First, in "Switch to Change", select Single Switch then hit the button at the end of the box beside that. This will bring up a complete list of all switches. Pick one (Probably number 1), give it a name, then hit OK. Lastly, make sure that it is set to "Turn ON". Once this is done, hit OK.

The NPC will now turn on the switch at the end of the conversation, but we don't have a way to actually -check- about the Hero yet. Let's do this by using a New Page. At the very top of the event's window, click the "New Page" button. A tab numbered '2' will appear. Click on it. You will notice there is nothing there. This is a whole new place for you to put commands.

First, let's set it up so that this page is a conditional page - in short, this version of the events will only happen if a specific condition is met. On the left side of the event window, while Page 2 is selected, mark one of the Switch boxes under "Preconditions", and select the switch we turned on earlier. Now, the NPC will use the event page 1, but once the switch is turned on, it'll use the second page.

The code can now look something like this:

CODE
(((((((((PAGE 1))))))))))

<>Change Face Graphics: faces1, 3, Left
<>Message: NPC:
:     Hello, Hero!  You're looking good today!
<>Change Face Graphics: hero1, 1, Right, Mirror
<>Show Choices: Why thank you/Worship me like a god
: [Why thank you] Handler
...<>Message: Hero:
:     Why thank you.  You're looking swell yourself.
...<>
: [Worship me like a god] Handler
...<>Message: Hero:
:     I'm the main character, and you're just a lousy
:     NPC.  Of course I look good to you.  Now worship me
:     like the god and saviour I am to you people
...<>
: End
<>Switch Operation:[0001: TalkedToTheNPC] ON
<>


((((((((((((((PAGE 2 [Condition: Switch 0001 [TalkedToTheNPC] ON]))))))))))))))
<>Set Face Graphics: faces1, 3, Left
<>Message: NPC:
:     Good to see you again, hero!
<>Set Face Graphics: hero 1, 1, Right, Mirror
<>Message: Hero:
:     Yeah, yeah, same to you too.
<>

Note 1: When using events with multiple pages, where more than one set of conditions are met, the one with the highest number will take precedence
Note 2: Yes. Events that have multiple pages can have multiple graphics, animations, and movement types. For instance, you can have a person who disappears once a specific switch has been turned on.
Note 3: Switches are universal - this means that once any event has turned a switch on, it is considered to be turned on by -all- events, until an event turns it back off.



So where can I go from here?
There's a lot more you can do, for sure. But take a look at the ability to use choices, and especially the New Pages/Conditions system. You'll notice it's not just having a switch ON that can cause an event to work differently - having an item or having a party member can affect it too, as can the more complex Variables and Timers. Still, try making a couple events like this... and you'll have the basics for Switch Control down.



Optional: Conditional Branch
This is another way to the changing events. However, this change actually takes place as a part of the script. To do it, look on the later selections for event commands, and pick Conditional Branch. A new window will open up. Don't be scared by its complexity; you just pick one type of Condition that must be met - this can include Switches being ON -or- OFF, an Item beind held -or- not held, having more or less money than a specific value, and more. In addition, you can also check the "Execute Custom Handler if Condition Not Met" box - if you do this, then if the condition -isn't- met, there is a separate set of commands that can go there!
It functions akin to the Choice handler, but it automatically makes the Choices based on conditions.
The following code shows an example where the message given will change based on whether the message has been done once before.

CODE
<>Change Face Graphics: faces1, 3, Left
<>Message: NPC:
:     Hello, Hero!  You're looking good today!
...<>Change Face Graphics: hero1, 1, Right, Mirror
<>Branch if   Switch [0001: TalkedToTheNPC] is ON
...<>Message: Hero:
:     Didn't I talk to you already?
...<>Change Face Graphics: faces1, 3, Left
...<>Message: NPC:
:     Yeah, so?
...<>Change Face Graphics: hero1, 1, Right, Mirror
...<>Message: Hero:
:     Why aren't you worshipping me yet?
: Else Handler
...<>Message: Hero:
:     I'm the main character, and you're just a lousy
:     NPC.  Of course I look good to you.  Now worship me
:     like the god and saviour I am to you people
...<>Switch Operation:[0001: TalkedToTheNPC] ON
: End
<>



There are a lot more things you can do with messages, too... but I'll save that for a second installment!


__________________________
RRR 2006 Awards: Best Topic Starter, Ultimate Debater, Most Likely To Bail You Out of Jail, and Most Likely To Become Ruler of the World.
RRR 2007 Awards: Master Debater, Elite Gamer, and Uber-Nerd
RRR 2008 Awards:
Former staff member - VG Hub & General maker discussion
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 04:36 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker