Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] my name/variable problem

Started by Erk64, June 03, 2007, 10:44:23 PM

0 Members and 1 Guest are viewing this topic.

Erk64

Okay. This one going to be fun. I am in the early stages of developing a game where you get to select a party or four members from about ten possible characters. It sounds goods, but I ran into a problem as soon as I came across my fist major cutscene. Because I have no way of predicting what characters the player has in their party, it makes writing the dialogue extremely difficult.

Here's what I need to (hopefully) fix this. Is there any way to assign a character's name to a variable? That way, I can make it so the first character the player chooses to their party will be assigned to variable 1, and the second to 2, and so one. That way, when I come to dialogue scenes, I can just type \v[001] or whatever instead of typing the character's name.

Sorry if this is confusing. Basically, can you assign a name to a variable. And if you think you have a good understanding of my situation, do you see any other possible solutions (no scripting, please, unless you can direct me to a script). Thanks in advance.
[spoiler=My Game Recommendations] 1) Demon Gate --- A great game with a terrific character-relationship system, an engaging story, and plenty of secrets and options for players who wish to be good/evil.
http://www.raizap.com/demongate/

2) Midnight --- A survival-horror game created with RPG Maker XP. Combat plays out in the smoothest running real-time battle system I have seen yet.
http://rmrk.net/index.php/topic,23239.0.html

3) The Healer --- A charming game with beautiful mapping and a fun battle system. One of the few games to use a healer as a main character, and so far it's pulled off well.
http://rmrk.net/index.php/topic,23524.0.html[/spoiler]

Polraudio

#1

you would use \N[1] to display yhe 1st chars name and \N[2] for the secont
Is this what you needed?
if this dont help you just let me know

modern algebra

And if you don't need each character to say unique things all the time, you could just set variables to the ID of the heroes in your party.

I.e.

Variable 1 = 1st hero in party ID
Variable 2 = 2nd hero in party ID
etc...


And then to display name, write \n[\v[1]] for lead party member, \n[\v[2]] for second party member.


If you want them to say unique things, then do as Polraudio said.

Erk64

#3
Okay, that should work. Thanks to both of you, because I willl probably do a little of each, depending on the importance of the scene.

But my question now, is how do you assign a character's ID to a variable? (I'm using RMXP, if I hadn't said so already.)


EDIT: Ah, nevermind. It assigns them automatically. I should have paid more attention to Seamus' post. Seamus got the explanation right, but the coding wrong, however. It should be:  \n[1] and not \n[\v[1]]. Polraudio was right about that part. But you two both helped me out in the end, so thanks!
[spoiler=My Game Recommendations] 1) Demon Gate --- A great game with a terrific character-relationship system, an engaging story, and plenty of secrets and options for players who wish to be good/evil.
http://www.raizap.com/demongate/

2) Midnight --- A survival-horror game created with RPG Maker XP. Combat plays out in the smoothest running real-time battle system I have seen yet.
http://rmrk.net/index.php/topic,23239.0.html

3) The Healer --- A charming game with beautiful mapping and a fun battle system. One of the few games to use a healer as a main character, and so far it's pulled off well.
http://rmrk.net/index.php/topic,23524.0.html[/spoiler]

modern algebra

eh? It doesn't do it automatically. \n[1] will always display the name of the first hero in the databse, \n[2] the second, etc...

\n[\v[1]] will display the name of the hero who's ID is represented by Variable 1.

So, if Variable 1 = 4, then \n[\v[1]] will display the name of the fourth hero in the database.

What I was suggesting is that as each member joins your party, then you assign a variable to their ID. So, you choose your first character, who, for example is the 3rd hero in the database, you assign variable 1 to 3. Second hero is actor 5, you assign: Variable 2 = 5

Then, \n[\v[1]] will give the name of the first hero in your party

\n[\v[2]] would give the name of the second hero in your party, whereas \n[1] would give the name of first hero in DB and \n[2] would give name of 2nd hero in DB

Erk64

Ooooohhh. Okay. But I still need to know how to assign a particular chararacter's ID to a variable.
[spoiler=My Game Recommendations] 1) Demon Gate --- A great game with a terrific character-relationship system, an engaging story, and plenty of secrets and options for players who wish to be good/evil.
http://www.raizap.com/demongate/

2) Midnight --- A survival-horror game created with RPG Maker XP. Combat plays out in the smoothest running real-time battle system I have seen yet.
http://rmrk.net/index.php/topic,23239.0.html

3) The Healer --- A charming game with beautiful mapping and a fun battle system. One of the few games to use a healer as a main character, and so far it's pulled off well.
http://rmrk.net/index.php/topic,23524.0.html[/spoiler]

modern algebra

Oh, well you can do it like this:

Manually:

I will be using Variables 1-4 to hold the party member ID's. And I will be using Variable 5 to keep track of the size of the party. Note that <new character> is just the character in that event who you are adding. So, if it is Aluxes/Arshes, his ID is 1, so <new character> is replaced by Aluxes/Arshes, and <new character ID> is replaced with 1. If it is Basil, and his ID is 2, then <new character> is replaced by Basil and <new character ID> by 2, etc...

So, in the event where you are adding the party member, put this:

Conditional Branch: Variable [005: Party Size] <= 4
   Change Party: + <new character>
   Control Variables: Variable [005: Party Size] + 1
   Conditional Branch: Variable [005: Party Size] = 1
       Control Variables: Variable [001: Party Member 1 ID] = <new character ID>
   Else
      Conditional Branch: Variable [005:: Part Size] = 2
        Control Variables: Variable [001: Party Member 2 ID] = <new character ID>
      Else
         Conditional Branch: Variable [005: Party Size] = 3
             Control Variables: Variable [001: Party Member 3 ID] = <new character ID>
         Else
             Conditional Branch: Variable [005: Party Size] = 4
                 Control Variables: Variable [001: Party Member 4 ID] = <new character ID>
             Branch End
         Branch End
      Branch End
   Branch End
Else
   Text: Your party is full, and you cannot add another person.
Branch End


I believe that would work. I would think there would be an easier way, but I can't think of it right now. Just put that in each event that you want to give you a party member with the values <new character> and <new character ID> replaced appropriately.
         

Erk64

That doesn't work. All you are really doing is assigning a number to a variable, but you never really assing the variable to the character's name.
[spoiler=My Game Recommendations] 1) Demon Gate --- A great game with a terrific character-relationship system, an engaging story, and plenty of secrets and options for players who wish to be good/evil.
http://www.raizap.com/demongate/

2) Midnight --- A survival-horror game created with RPG Maker XP. Combat plays out in the smoothest running real-time battle system I have seen yet.
http://rmrk.net/index.php/topic,23239.0.html

3) The Healer --- A charming game with beautiful mapping and a fun battle system. One of the few games to use a healer as a main character, and so far it's pulled off well.
http://rmrk.net/index.php/topic,23524.0.html[/spoiler]

modern algebra

Essentially, you are though, since \n[\v[X]] will then display that character's name, because \v[X] is the character ID. Basically, if a character ID is 5, then that number is assigned to \v[X]. Thus \n[\v[X]] is the same as \n[5], which is the character's name. So, if you are using variable 1 to hold the ID of actor 7, then \n[\v[1]] is equivalent to \n[7], which is the "variable" (you could say) which contains that actor's name.

Erk64

I don't know...I tried it but it didn't work. However, I looked under that sticky thread at the top of the tut page, "Blizzard's Little Tricks," and there is a solution posted there. You use the call script event and type in:

$game_variables[1]=
$game_party.actors[0].name

That will assign the first actor in your party to the first variable, for instance. I appreciate your help though.
[spoiler=My Game Recommendations] 1) Demon Gate --- A great game with a terrific character-relationship system, an engaging story, and plenty of secrets and options for players who wish to be good/evil.
http://www.raizap.com/demongate/

2) Midnight --- A survival-horror game created with RPG Maker XP. Combat plays out in the smoothest running real-time battle system I have seen yet.
http://rmrk.net/index.php/topic,23239.0.html

3) The Healer --- A charming game with beautiful mapping and a fun battle system. One of the few games to use a healer as a main character, and so far it's pulled off well.
http://rmrk.net/index.php/topic,23524.0.html[/spoiler]

modern algebra

That's undoubtedly an easier way to do it. But, just so you know that my way does in fact work, I took 5 minutes and made a demo.

Erk64

Oh. Well, in that case, I stand corrected.
[spoiler=My Game Recommendations] 1) Demon Gate --- A great game with a terrific character-relationship system, an engaging story, and plenty of secrets and options for players who wish to be good/evil.
http://www.raizap.com/demongate/

2) Midnight --- A survival-horror game created with RPG Maker XP. Combat plays out in the smoothest running real-time battle system I have seen yet.
http://rmrk.net/index.php/topic,23239.0.html

3) The Healer --- A charming game with beautiful mapping and a fun battle system. One of the few games to use a healer as a main character, and so far it's pulled off well.
http://rmrk.net/index.php/topic,23524.0.html[/spoiler]