Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Making An RPG Character With Responses

Learn more on how to use Sandbox, or submit your own tutorials or resources.
Post Reply
User avatar
Chaze007
Member
Member
Posts: 318
Joined: August 9th, 2009, 8:56 pm
Name: William
IRC Username: Chaze007
Location: MS

Making An RPG Character With Responses

Post by Chaze007 »

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.

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
    ]
 ]	
malkin61
Member
Member
Posts: 21
Joined: February 25th, 2010, 8:03 am

Re: Making An RPG Character With Responses

Post by malkin61 »

This looks good but I' having trouble grasping some things - just started using Sandbox - trying th develop a rpg.

1. Where does the code actually go? I've tried adding it to my cfg file but nothing happens.
2. How do you define where your npc is located in your map?

Thanks in advance

Malk
carter472
Member
Member
Posts: 14
Joined: June 18th, 2009, 1:34 am
Name: Adam

Re: Making An RPG Character With Responses

Post by carter472 »

You just put the code into your cfg.

Then when you're in the game, you go into edit mode by pressing F1, and you spawn the model.

For example, in edit mode, you type /spawn RGuard

That would spawn the exact model specified by the code and all its conversations will be available.

This also allows you set wherever you want the RGuard to be spawned.
malkin61
Member
Member
Posts: 21
Joined: February 25th, 2010, 8:03 am

Re: Making An RPG Character With Responses

Post by malkin61 »

Ok - I'm getting there.

I copied your code into the cfg file. Started my map in RPG, hit F1 and typed /spawn RGuard.

Good news - the new npc appeared. Bad news - there's no interaction. It doesn't turn to face me or communicate anything. I mean that no dialogue box appeared.

Getting closer! But more help and sorry to be a pain with my questions..

Malk
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Making An RPG Character With Responses

Post by arcones »

The reason he's not talking is because the "r_face" doesn't work in 2.5.... I've tried it and it won't work :|

So until it works, you can try to circumvent that by messing around with the code... (Unfortunately I don't know how :( )
Image
Want a user bar like this one? PM Leo!
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Making An RPG Character With Responses

Post by Hirato »

did you press E when he's your "hover" target?
This is not a url, clicking it is pointless
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Making An RPG Character With Responses

Post by Leo_V117 »

Thats True. Press E when youre facing him and a symbol appears. Then you can talk to him. And as for parts that dont work, apparently, if you type in "r_get" as a replacement for "r_" in the rpg_game.cfg, in the console during the game, it should give you an example of how to impliment that piece of code. Is that true or just a rumor?
User avatar
klimyriad
Support Team
Support Team
Posts: 969
Joined: December 23rd, 2009, 1:43 pm
Name: liam
Contact:

Re: Making An RPG Character With Responses

Post by klimyriad »

i just put this in my game if that is okay with you
Of course i change it a little bit

Also i put it in my forums too to show off your work on 3adstudios go and check it out if you want

http://3adstudios.darkbb.com/general-f7 ... t19.htm#19
Last edited by klimyriad on April 7th, 2010, 4:40 pm, edited 1 time in total.
Firstspace the attack Progress. Image
Maps= Image finishing the town of hisal map.
Models and textures Image Just started finding these.
Menus, script's and other stuff. Image
User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Making An RPG Character With Responses

Post by Leo_V117 »

What work? Ive done something that i dont remember doing. Shed some light on it please.
User avatar
klimyriad
Support Team
Support Team
Posts: 969
Joined: December 23rd, 2009, 1:43 pm
Name: liam
Contact:

Re: Making An RPG Character With Responses

Post by klimyriad »

sorry Chaze007 i will correct that but still your shop scripted is on the website and Leo i will change it sorry Chaze007

I still put this scripted on the website it was because i was reading your shop scirted and i gor confused when i was here oh well
It is night and i am tired and make mistakes i think i need to go to bed see ya all

lol
Firstspace the attack Progress. Image
Maps= Image finishing the town of hisal map.
Models and textures Image Just started finding these.
Menus, script's and other stuff. Image
Post Reply