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 Experienced Users, A more in-depth Talkative NPC Tutorial [Skill Level: Experienced]
Garlyle
post Feb 3 2008, 01:27 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!

Unlike the first tutorial, this one assumes you already know all of what's in that tutorial - and includes several other fun things you can do with messages! Also unlike the first, this one has a separate sample code for EACH example, showing an excellent way to make use of these commands.



1. Message Display Options / Sample Creation: A narrative
This button allows you to change the way messages display. Like Face Graphics, these settings will be universal once set - they will carry over between events and messages that follow, and should theoretically be set back after use - unless you plan to keep things that way.
The Message Display Options has the following choices:
Window Type: A Normal window will have a background; a Transparent window will have nothing.
Window Position: The default window position on the screen
Autoselect Window Position: If this is checked, then if the message would appear 'overtop' of the Hero, the message window's location will be automatically adjusted. Turn this off when you absolutely want the message to appear in a specific part of the screen.
Allow other events to continue: Not often used, this will make it so that other actions in the event will continue to run while the message is displayed. We will be using this later.
Using a setup like this, it's easy to create a text such as this: Three sets of transparent text display on the screen, one after the other - each one goes progressively lower, as though revealing parts of a page.
CODE
<>Change Face Graphics: hero1, 1, Left
<>Message: Hero:
:     Hey, wait, what's this story...?
<>Change Face Graphics: Erase
<>Message Display Options: Transp, Top, Fixed, Halt Processes
<>Message: This is the first paragraph of our story
:     You may not find it interesting
:     But it's important to write
:     For the sake of science
<>Message Display Options: Transp, Center, Fixed, Halt Processes
<>Message: And this is the second paragraph
:     It will be displaying in the center of your screen
:     Don't believe me?
:     Try it out yourself
<>Message Display Options: Transp, Bottom, Fixed, Halt Processes
<>Message: Finally, the last part of our story
:     Is no less important than those that came before
:     But they didn't really matter
:     Oh yeah, the password is 777
<>Message Display Options: Normal, Bottom, Auto, Halt Processes
<>Change Face Graphics: hero1, 1, Left
<>Message: Hero:
:     Oh... well, that was pointless.
<>




2. Input Number / Sample Creation: A Password Machine
The Input Number command gives the player a chance to enter a number. This number becomes stored in a variable, which can then be checked using Conditional Branches or New Pages. We won't worry about what a Variable is right now - we'll get to that shortly. Instead, we'll just assume it works, alright? Trust me on this.
The Input Number command has two options:
Digits Allowed: The number of digits the number is allowed to be. A 1-digit is any number from 0-9, a 2-digit is any number from 00-99, and so on. Remember that even if you give them 5 digits, if they enter 00003, the result of the variable will be 3.
Variable: Pick a variable. Name it. This is what the command will set.
To test to see if the inputted number matches what is done, use the Conditional Branch thing that was in the last Tutorial. Pick Variable, and you can choose how to compare it...

CODE
<>Change Face Graphics: faces1, 3, Left
<>Message: Please tell us the password, o heroic one!
<>Input Number: 3 Digit, [0001: PasswordGoesHerePlease]
<>Branch if Var [0001: PasswordGoesHerePlease] is 777
...<>Message: Correct!  You can come into the base now!
...<>Switch Operation: [0002: EnteredTheRightPassword] ON
...<>
: Else Handler
...<>Message: You're a newb.  Didn't you do the last example?
...<>
: End
<>




3. Variable Operations Sample Creation: Potion Trader
Variables are, for advanced programmers, the very heart and soul of programming, even more so than Switches at times. But we won't get too complex about them right now...
Remember how, in the last example, we had the Input Number affect a Variable, then we checked to see if that Variable met a certain number? Well, Variables are like switches - however, instead of "ON" and "OFF", variables actually store numbers! We can add to these numbers, reduce them, set them to match certain values, and all kinds of things! Like switches, variables will be carried over between events. Variables will also default to a value of "0" until another value is given to them.
Let's look at a brief selection of options:
Variable to Change: This is the part that affects what variable exactly we're going to change. Most of the time you'll be using a single variable. Because the others are part of more complex codes, let's ignore them.
Operation: This is what we're doing to the variable's value. In short, we're forming an equation: [Variable] [Operation] [Operand] - for instance, ChestsOpened Plus One. The options are pretty obvious. Set Equal will set the variable exactly to what it's told to; the others will affect the variable's current value. (Modulus is the "Remainder" value, for you mathematicians)
Operand: This is where we determine the actual value we're going to either set or alter. We can make it either a specific number... or have the variable be affected by something else - such as having the variable become set to the Hero's Level, the number of Potions a hero is carrying, or even the value of another variable.

Other Commands: Item Management: I'll only stop briefly by this command. Use it to add/remove items from the party's inventory. Remember, if it tries to remove an item the party doesn't have, it simply won't remove anything - but the event will still run! Be sure to use Conditional Branches or a new page to make sure the hero HAS the item first.

The code below shows you how to check to see if the hero has enough of an item!
CODE
<>Change Face Graphics: faces1, 7, Left
<>Message: Old Creepy Guy:
:     Hey, Hero.  I've got something that might
:     interest you!  If you give me five Potions,
:     I'll make you a super potion!
<>Change Face Graphics: hero1, 1, Right, Mirror
<>Message: Hero:
:     Eh... sure?
<>Variable Oper: [0002: PotionsHeld] Set, Potions Posessed
<>Branch if Var [0002: PotionsHeld] is 5 or more
...<>Show Choices: Sure/No Way in Hell!
...: [Sure] Handler
......<>Change Face Graphics: Erase
......<>Message: Handed over five potions!
......<>Change Items: Potion 5 Remove
......<>Change Face Graphics: faces1, 7, Left
......<>Message: Old Creepy Guy:
......:     Sure, sonny!  Here's your Hi-Potion!
......<>Change Items: Hi-Potion 1 Add
......<>
...: [No Way in Hell!] Handler
......<>Message: Hero:
......:     Forget it, Freakazoid.
......<>
...: End
...<>
: Else Handler
...<>Change Face Graphics: faces1, 7, Left
...<>Message: Old Creepy Guy:
...:     You don't have enough potions, sonny!  Sorry.
...<>
: End
<>




3a. A whole slew of commands!
Here are a bunch of commands you might want to use during a talk with an NPC:
Change Money: Similar to the Item Management command used previously, but this one adds/removes money. Like Item Management, the event will continue to play even if this command reduces your funding to 0, so make sure to check!
Open Shop Window: Used to open up a shop. You can define which items are available for sale, and whether or not the player can sell items to the shop. Plus, you can choose between one of three "Text styles" with different sets of messages. You can also have a special handler pop up whether the character bought something or not.
Show Inn Message: Allows you to define the price, and have an "inn" feature typical of RPGs. You can also select messages to appear, and to have special conditions if they do spend the night.
There are a lot more too... but those are some of the most important in dealing with common NPCs.



4. Final Tutorial: Message (Advanced!) / Sample Creation: A statistics-revealing NPC
I cannot guarantee that -any- of these commands will work for any maker other than 2k3!
For the final part of this tutorial, we're going to go back to the very -root- of the commands - the "Message" command, and spruce that up! This seemingly boring, typical command has a few secrets!
"Control Characters" are the names for special keys that can be inputted into a message. When they are done, they will not show up in the message - instead, they will provide a special effect! All control characters start with the \ key. There are two kinds of Control Keys:

Message Changers actually change the content of the message they're put in.
\\ - Since the \ key causes Controls, actually putting in that key in a message will cause it to vanish. Use this when you want to actually display the \ key.
\$ - If you want your message to show the amount of money the party has, this command will be replaced by a number indicating the party's money
\_ - This inserts half a space. Use this if words seem too close together, or even for effect.
\n[0] - Displays the name of the leader of the current party.
\n[#] - A bit different from the above. This is the first 'variable' control command. By replacing # with any number (from 1 up), the game will automatically replace this sequence with the name of the hero with the ID number you entered. If you're using the Enter Hero Name command, or the hero's name has changed any other way, this is the way to display it. The hero's ID is listed right next to their name in the Database.
\v[#] - This is akin to the above. By replacing # with any number (from 1 up), the game will show the value of the variable with the ID number indicated. The ID Number of a variable is always shown right beside its name.

Visual Changers will alter the way the text appears - speed and color.
\! - The message will pause at this point, and will not continue until the user presses a key.
\^ - The message will automatically close at this point, without waiting
\. - The message will pause for 1/4 of a second at this point
\| - The message will pause for 1 second at this point
\> \< - These are two separate tags. Put one at the start of a text section, and the other at the end, and the part between will be displayed instantly.
\s[#] - Another variable command. Once this is implemented, all further text in that individual message will be displayed at the indicated speed. # should be a number between 1 and 20 - and 20 is fastest. I'm not sure what number is 'normal'.
\c[#] - This variable command changes the display color of all text that follows in the message. 0 will set the color to the default text color, but you can set any value up to 19 to change it.

Unlike switches, variables, face graphics, and so on, the \s and \c commands will not carry over between messages. You will have to reuse them at the start of every message if you want non-default settings

CODE
<>Change Face Graphics: hero1, 1, Left
<>Message: \c[2]Hero:
:     \c[0]Who are you?
<>Change Face Graphics: faces1, 3, Right, Mirror
<>Message: \c[2]Familiar NPC:
:     \c[0]I'm that guy you told to worship you!
:     So I decided I would!  I've learned all kinds
:     Of things about you!
<>Change Face Graphics: hero1, 1, Left
<>Message: \c[2]Hero:
:     \c[0]That's\..\..\.. kinda creepy.
<>Change Face Graphics: faces1, 3, Right, Mirror
<>Message: \c[2]Familiar NPC:
:     \c[0]Wanna know what else is creepy?\|
:     I can tell you a whole lot of information!\!
:     Things you don't keep track of!
<>Variable Oper: [0002: PotionsHeld] Set, Potions Posessed
<>Variable Oper: [0003: Battles] Set, No. Battles
<>Variable Oper: [0004: Escapes] Set, No. Escapes
<>Message: \c[1]Did you know you've got \$ gold right now?\|
:     Or that you have \v[2] Potions?\|
:     And that you've run from \v[4]\\\v[3] battles?\|
:     I also know your best friend's name is \n[2]
<>Change Face Graphics: hero1, 1, Left
<>Message: \c[2]Hero:
:     \s[10]\c[0].\..\..\.Creepy.\|
:     Remind me to kill you later.
<>Change Face Graphics: faces1, 3, Right, Mirror
<>Message: \c[2]Creepy Stalker NPC:
:     \c[0]Will do, sir!
<>


Another secret of Messages: Using the $ key can also produce special results - simply follow the $ key with any capital or lowercase letter of the alphabet... you'll get special icons printed as part of your text!

Want to know where to find a list of all Control Characters and Special Characters? When you're in the Message window in 2k3, just hit the "Help" button, and they'll all be listed there!





Well, that's it. Seriously. From here on out you can figure things out by exploring commands. Flashes, screen quakes, sound effects, music changes, picture displays, teleportation... there's so many more event commands that I can't be arsed to show you how they all work - so now that you understand the basics - and even some of the advanceds - of making casual, small NPCs... you can start to create a truly satisfying villager indeed.





Final Secret: Chances are you'll never need to use this, as only really advanced systems would likely have need of this. However, it is possible to stack the \v[#] command into the \n and \v commands - for instance...
\n[\v[#] - Will display the name of the hero with the ID number given in the variable specified. Notice that you do -not- use a second ] mark, for some reason.
It's worth noting that the only maker I can guarantee this works with is 2k3.


__________________________
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
   
Donline
post Feb 20 2008, 09:41 AM
Post #2


Level 34
Group Icon

Group: Revolutionary
Posts: 845
Type: Artist
RM Skill: Masterful




Nice I done the same thing on my Game but... instead of using Choices...I did it using the Name Input mixed with conditional branches...basicly so you dont know what you can say until you type it. I have an npc with 26 word inputs (max 16 letters)
example

Hello
Ill kill you
wheres the shop
go away
I need money

but you have to type it like you would a Name..... so Imagine 1000 words later it should be liking taslking to a real person
(hehe well advanced A.I anyway ) wink.gif

This post has been edited by Donline: Feb 20 2008, 09:44 AM


__________________________
Tales Of Aria- My Earlier Epic Attempt (Action RPG) 2348 D/L!!
http://www.mediafire.com/?f44wmbt2m0m
Go to the top of the page
 
+Quote Post
   
LOT7V
post Feb 25 2008, 09:01 PM
Post #3


The Lord of the Seven Voices
Group Icon

Group: Revolutionary
Posts: 151
Type: Developer
RM Skill: Beginner




Donline, one problem I see in your plan: what happens if one letter is wrong... Your entire thing would be thrown off. RGSS is very similar to Python, but it doesnt have an in-built difflib function to compare strings.


__________________________
[Show/Hide] Lord of the Seven Voices


I'll do custom text sigs like this one if you want me to-just PM me.
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: 19th June 2013 - 10:30 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker