Class Names in Dialogue Boxes

Status
Not open for further replies.

silverphoenix08

Villager
Member
Joined
Jul 22, 2013
Messages
9
Reaction score
0
First Language
English
Primarily Uses
Hello, everyone! I'm back with another question!

Me:  :D

RPG Maker Community:  :headshake:

So! I know of the \P[n] command in text boxes for calling up a party member's name, but I was wondering if there were a similar command that would allow me to pull up a party member's class rather than his name.

The reason for this is that I'm currently working on a superhero-themed project, and I have the characters' names as their real names, and their classes as their heroic codenames. 

Can anyone help me? In exchange, metaphorical cookies for everyone! Chocolate chip ones, too!  
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
Hello, everyone! I'm back with another question!

Me:  :D

RPG Maker Community:  :headshake:

So! I know of the \P[n] command in text boxes for calling up a party member's name, but I was wondering if there were a similar command that would allow me to pull up a party member's class rather than his name.

The reason for this is that I'm currently working on a superhero-themed project, and I have the characters' names as their real names, and their classes as their heroic codenames. 

Can anyone help me? In exchange, metaphorical cookies for everyone! Chocolate chip ones, too!  
You can create your own variable and set it to text.  I suggest making a common event like this:

Conditional Branch: Eric is Soldier

Control Variable: [001:Actor1's Class_Name] = Solider

Branch End

Conditional Branch: Eric is Monk

Control Variable: [001Actor1's Class_Name] = Monk

Branch End

and so on for all of your classes.

Then you just display that variable into your text by typing \V[1] into your message window after calling this event (you'll want to use the actual number of the variable you decide to use).  That way you don't have to retype a new message every time the actor changes class.  The actual process of setting the variable to text is really simple once you know where to go.  Just go to control variables and at the bottom you'll see a tab labeled Script.  Just click that and type "Solider" into the box, or which ever class you are working on at the time.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
It's easier than that.


Control Variables: [0001: Class Name] = Script: $data_classes[$game_actors[n].class_id].name


where n is the id of the actor you want to show.


And then use \v[1] in your text box, as Berylstone indicated.
 
Last edited by a moderator:

silverphoenix08

Villager
Member
Joined
Jul 22, 2013
Messages
9
Reaction score
0
First Language
English
Primarily Uses
You can create your own variable and set it to text.  I suggest making a common event like this:

Conditional Branch: Eric is Soldier

Control Variable: [001:Actor1's Class_Name] = Solider

Branch End

Conditional Branch: Eric is Monk

Control Variable: [001Actor1's Class_Name] = Monk

Branch End

and so on for all of your classes.

Then you just display that variable into your text by typing \V[1] into your message window after calling this event (you'll want to use the actual number of the variable you decide to use).  That way you don't have to retype a new message every time the actor changes class.  The actual process of setting the variable to text is really simple once you know where to go.  Just go to control variables and at the bottom you'll see a tab labeled Script.  Just click that and type "Solider" into the box, or which ever class you are working on at the time.
Thanks for the reply, Berylstone! Actually, I'm not sure this helps me in my current predicament, and looking back on my OP, I don't think I explained myself properly. My apologies.

What I'm working on is a common event for when someone uses a save point in my game. The save points are computers, so I've got it displaying text along the lines of:

ACCESSING: Computer Network...

USER NAME: \P[1]

PASSWORD: ***********

 

As things stand, that should call up the name of the player in the first slot of the party, the "leader" of the party, right?

However, what I'm hoping to get the save events to do instead are call up the class names of the person in the first slot of the party. So if my character Bob (class=Superlad) is lead, it'll say "USER NAME: Superlad," but if my character Anna (class=Mega Girl) is lead then the event says "USER NAME: Mega Girl." ((These are not actual names I'm using. I swear, I'm much more creative than that!  :guffaw: ))

 

Does that all make sense? If it didn't, I'll try again.  :guffaw:
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Control Variables: [0001: Class Name] = Script: $data_classes[$game_party.all_members[0].class_id].name
Show Text: ACCESSING: Computer Network...


USER NAME: \v[1]


PASSWORD: ****************
 

silverphoenix08

Villager
Member
Joined
Jul 22, 2013
Messages
9
Reaction score
0
First Language
English
Primarily Uses
Control Variables: [0001: Class Name] = Script: $data_classes[$game_party.all_members[0].class_id].nameShow Text: ACCESSING: Computer Network... USER NAME: \v[1] PASSWORD: ****************
I wasn't able to put all of that into the script box. It stopped at "[0]." and I can't squeeze the rest in. 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Okay, instead of Control Variables, use Call Script:

$game_variables[1] = $data_classes[$game_party.all_members[ 0].class_id].nameCopy and paste so the line breaks are in the same spots.Then the Show Text will be just the same.
 

silverphoenix08

Villager
Member
Joined
Jul 22, 2013
Messages
9
Reaction score
0
First Language
English
Primarily Uses
I got an error message:

Script 'Game Event' line 209: AugmentError occured.

comparison with String of 9 failed. 

Did I break it? I broke it, didn't I?  >_>  

You'd think that living with 3 software engineers, some of their knowledge of code would've rubbed off on me. ;_;   
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Line 209 of Game_Event is checking event conditions, so make sure the variable you're using for the class name in the script call is ONLY used for that. Make sure you're not using the same variable for other things as well.


Easiest way to check is to assign a NEW variable to the class name (in the variables box, write Class Name DO NOT USE, just to make extra sure), and change the script call above to use $game_variables[n] where n is the variable id, instead of $game_variables[1].
 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
add this somewhere below materials

class Window_Base < Window  def convert_escape_characters(text)    result = text.to_s.clone    result.gsub!(/\\/)            { "\e" }    result.gsub!(/\e\e/)          { "\\" }    result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }    result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }    result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }    result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }    result.gsub!(/\eCL\[(\d+)\]/i) { class_name($1.to_i) }    result.gsub!(/\eG/i)          { Vocab::currency_unit }    result  end    def class_name(n)    actor = n >= 1 ? $game_party.members[n - 1] : nil    actor ? actor.class.name : ""  end endand use \cl[n] to show party member n's class name
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
Thanks for the reply, Berylstone! Actually, I'm not sure this helps me in my current predicament, and looking back on my OP, I don't think I explained myself properly. My apologies.

What I'm working on is a common event for when someone uses a save point in my game. The save points are computers, so I've got it displaying text along the lines of:

ACCESSING: Computer Network...

USER NAME: \P[1]

PASSWORD: ***********

 

As things stand, that should call up the name of the player in the first slot of the party, the "leader" of the party, right?

However, what I'm hoping to get the save events to do instead are call up the class names of the person in the first slot of the party. So if my character Bob (class=Superlad) is lead, it'll say "USER NAME: Superlad," but if my character Anna (class=Mega Girl) is lead then the event says "USER NAME: Mega Girl." ((These are not actual names I'm using. I swear, I'm much more creative than that!  :guffaw: ))

 

Does that all make sense? If it didn't, I'll try again.  :guffaw:
It makes sense and I understand better what you mean now.The common event I described will only work for your event if Actor1 is always the party leader.  So if you are wanting to do a conditional branch based on who is the party leader you would have to use Game Data to set a variable to member #1 instead, rather a specific actor.  Or just use scripts - of which I'm woefully inadequate. 

But just in case you want to try the event route, I would think you could write a common event something like this.

Control variables:

[Party:Leader_ID] = Game Data/Member#1's Actor ID

Conditional Branch: [Party:Leader_ID] = 1

Conditional Branch: Actor1 is Solider

Control Variables: [Party Leader's Class_Name] = "Solider"

Branch End

Conditional Branch: Actor1 is Monk

Control Variables: [Party Leader's Class_Name] = "Monk"

Branch End

Branch End

and so on for all your classes.  And since you are wanting to allow different actors in the member#1 slot, you would have to create a new conditional branch for them as well.

Conditional Branch: [Party:Leader_ID] = 2

Conditional Branch: Actor2 is Solider

Control Variables: [Party Leader's Class_Name] = "Solider"

Branch End

Conditional Branch: Actor2 is Monk

Control Variables: [Party Leader's Class_Name] = "Monk"

Branch End

Branch End

and so on again for all of your classes and possible party leaders.  So this could wind up being a pretty big event depending on how many actors and classes you have, and is probably a lot of unnecessary work since there seems to be better script alternatives. 
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,859
Messages
1,017,030
Members
137,566
Latest member
Fl0shVS
Top