Making An RPG Character With Responses
Posted: December 24th, 2009, 1:51 am
I'm going to teach you how to make an RPG Character with Responses.
As all of you coders/pre-coders should know, // = commenting. That means that line of text doesn't affect anything.
WARNING: This script was made in/for the Developer's SVN Version. This script MAY NOT work in the 2.4
spawn_RGuard = [
//This is the name of the spawned character it will be used ingame as /spawn RGuard
r_name "Fort Ruik Guard"
//The character's actual name
r_model "rpg/characters/npcman"
//The character's model
r_interact [
r_face $rpginterract
//Makes you face the spawned character
r_select $rpginterract
//Makes you select the spawned character
r_face $rpgself
//Makes the spawned character face you
r_talk $rpgself
//Initiates the talk sequence
]
r_say "Yes Citizen? Speak quickly, I am a busy man." [
//0 the first line of r_say always starts off as 0 and goes down. r_say = what the spawned character says and r_response is what you can choose from.
r_response "Can I ask you some questions?" 1
//this option goes down to the first line of r_say basically the 1st gui of text.
r_response "[Leave]" -1
//this option ends the chat.
]
r_say "Make it quick citizen." [
//1 the second line of r_say
r_response "Do you know of a place to rest?" 2
//Goes down to the third menu. Catching on yet? 0=1 1=2 2=3 etc.
r_response "What is this place?" 3
//This brings you to the fourth option.
r_response "Where can I buy supplies?" 4
//This will bring you to the fifth option, catching on?
r_response "Nevermind, Goodbye!" -1
//exits the chat.
]
r_say "The White Wyvern is a tavern known for it's variety of drinks. It's the place to go if you're looking for a night out." [
//2 third line of r_say
r_response "Can I ask you something else " 1
//brings you back up to the second line or r_say
r_response "Alright thanks! Goodbye." -1
//exits chat
]
r_say "This is Fort Ruik, a training grounds for militia men. Fort Ruik is also a resting place for travelers and merchants." [
//3 fourth line of r_say
r_response "Can I ask you something else?" 1
//brings you back up to the second line or r_say
r_response "Thank you, Goodbye!" -1
//exits the chat.
]
r_say "The Golden Hammer is a militia man's store, they sell everything from swords to bows, although I do believe they are out of stock at the moment." [
//4 fifth line of r_say
r_response "Do you know when the next shipment will be in?" 5
r_response "Can I ask you something else?" 1
//brings you back up to the second line of r_say
r_response "Alright thanks! Goodbye." -1
//exits the chat.
]
r_say "The next shipment is due within 3 months." [
//5 sixth line of r_say
r_response "Can I ask you something else?" 1
//brings you back up to the second line or r_say
r_response "Thank you, Goodbye!" -1
//exits the chat.
]
]
Now that you've got all of that covered, you shouldn't need the commenting to help you along the way. Here's the same code, without the commenting help.
As all of you coders/pre-coders should know, // = commenting. That means that line of text doesn't affect anything.
WARNING: This script was made in/for the Developer's SVN Version. This script MAY NOT work in the 2.4
spawn_RGuard = [
//This is the name of the spawned character it will be used ingame as /spawn RGuard
r_name "Fort Ruik Guard"
//The character's actual name
r_model "rpg/characters/npcman"
//The character's model
r_interact [
r_face $rpginterract
//Makes you face the spawned character
r_select $rpginterract
//Makes you select the spawned character
r_face $rpgself
//Makes the spawned character face you
r_talk $rpgself
//Initiates the talk sequence
]
r_say "Yes Citizen? Speak quickly, I am a busy man." [
//0 the first line of r_say always starts off as 0 and goes down. r_say = what the spawned character says and r_response is what you can choose from.
r_response "Can I ask you some questions?" 1
//this option goes down to the first line of r_say basically the 1st gui of text.
r_response "[Leave]" -1
//this option ends the chat.
]
r_say "Make it quick citizen." [
//1 the second line of r_say
r_response "Do you know of a place to rest?" 2
//Goes down to the third menu. Catching on yet? 0=1 1=2 2=3 etc.
r_response "What is this place?" 3
//This brings you to the fourth option.
r_response "Where can I buy supplies?" 4
//This will bring you to the fifth option, catching on?
r_response "Nevermind, Goodbye!" -1
//exits the chat.
]
r_say "The White Wyvern is a tavern known for it's variety of drinks. It's the place to go if you're looking for a night out." [
//2 third line of r_say
r_response "Can I ask you something else " 1
//brings you back up to the second line or r_say
r_response "Alright thanks! Goodbye." -1
//exits chat
]
r_say "This is Fort Ruik, a training grounds for militia men. Fort Ruik is also a resting place for travelers and merchants." [
//3 fourth line of r_say
r_response "Can I ask you something else?" 1
//brings you back up to the second line or r_say
r_response "Thank you, Goodbye!" -1
//exits the chat.
]
r_say "The Golden Hammer is a militia man's store, they sell everything from swords to bows, although I do believe they are out of stock at the moment." [
//4 fifth line of r_say
r_response "Do you know when the next shipment will be in?" 5
r_response "Can I ask you something else?" 1
//brings you back up to the second line of r_say
r_response "Alright thanks! Goodbye." -1
//exits the chat.
]
r_say "The next shipment is due within 3 months." [
//5 sixth line of r_say
r_response "Can I ask you something else?" 1
//brings you back up to the second line or r_say
r_response "Thank you, Goodbye!" -1
//exits the chat.
]
]
Now that you've got all of that covered, you shouldn't need the commenting to help you along the way. Here's the same code, without the commenting help.
Code: Select all
spawn_RGuard = [
r_name "Fort Ruik Guard"
r_model "rpg/characters/npcman"
r_interact [
r_face $rpginterract
r_select $rpginterract
r_face $rpgself
r_talk $rpgself
]
r_say "Yes Citizen? Speak quickly, I am a busy man." [ //0
r_response "Can I ask you some questions?" 1
r_response "[Leave]" -1
]
r_say "Make it quick citizen." [ //1
r_response "Do you know of a place to rest?" 2
r_response "What is this place?" 3
r_response "Where can I buy supplies?" 4
r_response "Nevermind, Goodbye!" -1
]
r_say "The White Wyvern is a tavern known for it's variety of drinks. It's the place to go if you're looking for a night out." [ //2
r_response "Can I ask you something else " 1
r_response "Alright thanks! Goodbye." -1
]
r_say "This is Fort Ruik, a training grounds for militia men. Fort Ruik is also a resting place for travelers and merchants." [ //3
r_response "Can I ask you something else?" 1
r_response "Thank you, Goodbye!" -1
]
r_say "The Golden Hammer is a militia man's store, they sell everything from swords to bows, although I do believe they are out of stock at the moment." [ //4
r_response "Do you know when the next shipment will be in?" 5
r_response "Can I ask you something else?" 1
r_response "Alright thanks! Goodbye." -1
]
r_say "The next shipment is due within 3 months." [ //5
r_response "Can I ask you something else?" 1
r_response "Thank you, Goodbye!" -1
]
]