Main Menu
  • Welcome to The RPG Maker Resource Kit.

Character origin to change dialogue options?

Started by Rukishou, December 03, 2009, 02:09:48 AM

0 Members and 1 Guest are viewing this topic.

Rukishou

At the beginning of my new game you will be able to choose some info about yourself (or your character) such as your name, if not too troublesome sex (as in gender, you pervert), as well as your birthplace (or more accurately, current hometown) which will all alter the entire game in different ways.

Now, without using scripts (I do not know how like anything about object-oriented scripting language) or common events (which I have no idea how to use or how they even work since I have never gotten any good explanation about this) making the dialogue of the game differ slightly (or extremely) depending on where you lived in the beginning of the game or other factors would require every event to have lots of conditional branches and not only is that tedious work but it's messy! So I'm wondering is there any way to simplify this using scripts or common events or something? Thank you in advance!

~Rukishou


Rukinet. - the dot's included!

modern algebra

Tedious, yes, but the only thing that makes it tedious is that you have to write the dialogue, which is something you would have to do whether you did it with events or with scripts. If all you want are superficial changes, like insert this name instead of that name, then any message script would do that. But if you want substantial changes, there is no way to get around writing extra dialogue - no script can do that for you.

I would also think that scripting would be messier, because the easiest way I can see doing this is on a per-event basis, and scripting would more or less require a database of text.

Rukishou

Well I was actually thinking that in eventing, if there are let's say 5 character origins to choose from, I would have to check 5 different switches for all dialogues which need a minor or major change, but I just realized I can use a variable where 1 represents the first background story, 2 represent the next one etc...

Should I use variables like that, or is there a better way?


Rukinet. - the dot's included!

modern algebra

Ultimately, it would make little difference whether you use five switches or one variable, though perhaps the variable would be more efficient -that would be a fine way to do it - better perhaps because you'd be able to make a binary tree. It's still going to be five conditional branches if you want a different dialogue for each origin though.

Rukishou



Rukinet. - the dot's included!

modern algebra

It wouldn't be important with such a small number of conditional branches, but the basic idea, trying to put it plainly, is that it would reduce the possibility of a lot of conditional branches being gone through by eliminating by halves. Take for instance, if you had eight possibilities. Then one way to do it would be:


if var == 1
else
  if var == 2
  else
    if var == 3
    else
      ...
          if var == 8
          end
      ...
end


So, in the case where the value of the variable is 8, then that would have to check the conditions eight times every time it goes through. The purpose of a binary tree would be to reduce the maximum number of conditionals, though this may also raise the minimum number of conditionals.

So, you could rewrite that and have it as this instead:


if var <= 4
  if var <= 2
    if var == 1
      # code for when var == 1
    else
      # code for when var == 2
    end
  else
    if var == 3
      # code for when var == 3
    else
      # code for when var == 4
    end
  end
else
  if var <= 6
    if var == 5
      # code for when var == 5
    else
      # code for when var == 6
    end
  else
    if var == 7
      # code for when var == 7
    else
      # code for when var == 8
    end
  end
end


That way, there would only be three checks necessary, no matter what the variable is. So it reduces the worst case scenario. It would become particularly important where there are lots and lots of options, like for instance, 128 possibilities.

shane2243

Quote from: modern algebra on December 03, 2009, 02:57:45 PM
Ultimately, it would make little difference whether you use five switches or one variable, though perhaps the variable would be more efficient -that would be a fine way to do it - better perhaps because you'd be able to make a binary tree. It's still going to be five conditional branches if you want a different dialogue for each origin though.

You say 5, but I think it's look more like, because I think they want it where npcs respond to men and women differently even from the same origin? But I may have misread?

shaz

the method remains the same ;)  If he learns how to do it with 5, he can do it with 10, or 15, or however many he wants.
Always remember you're unique.
Just like everybody else.