dynamic character?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
greenteaproductions
Newbie
Posts: 2
Joined: Sun Jan 15, 2012 3:10 am
Projects: Our Story
Contact:

dynamic character?

#1 Post by greenteaproductions »

i do not get this thing at all :shock: how do you make a dynamic character? what's the code or whatever you need? explanation and examples would be nice.
and is there an option for the player to choose between 2 already-made characters or more?
thank you! :D

Fawn
Moe Imouto
Posts: 911
Joined: Sat Nov 06, 2010 10:38 pm
Contact:

Re: dynamic character?

#2 Post by Fawn »

Moved to the Ren'py questions forum. Also, please punctuate the first letter of your sentences and the I's, it's more respectful. :)

As for your question, have you checked the Ren'py documentation? Here's the section on Dynamic Characters: http://www.renpy.org/wiki/renpy/doc/ref ... cCharacter

ProxyPawaa
Newbie
Posts: 23
Joined: Sun Jan 16, 2011 5:43 pm
Contact:

Re: dynamic character?

#3 Post by ProxyPawaa »

Dynamic characters aren't that hard. Since I've had some really bad experiences with the wiki being inaccurate, or not descriptive enough, I'll help you out a bit. Here is the code I use to apply a dynamiccharacter for the protagonist of my story.

Code: Select all

    $ a = DynamicCharacter("q", color="#FFFFFF", show_two_window=True)
    $ q = "q"
EDIT: For the record, replace the color code with whatever color you want, and simply remove the comma and everything after that until the parentheses ends if you don't want the name in a separate window. I just think it looks prettier that way.

I put the dynamic character as a, since I'll be using him very often, and then q is required to actually name him. To make a dynamic character requires two strings, the dynamic character string refers to the string in quotations and takes whatever is within that string. For example, you can have a default name inside that string, or a name for the a string to say up until you name him, like 'mysterious stranger' or just 'protagonist'

I'm guessing you know how to make choices? Just add the string....

Code: Select all

   $ q = "Name"
In front of the choice made to change their name to that from then on. This way, you can write one script for two characters, only diverging into character specific portions when needed.

For something more complicated, namely, allowing them to name the character themselves....

Code: Select all

    $ q = renpy.input("My name is...?") or "Default Name"
This will allow you to change the name based on player input, you can do this if, rather than having premade characters to choose from, you simply want them to be able to choose a name to call the main character. This is places instead of the usual question. Another useful bit of code is

Code: Select all

%(q)s
This will say whatever is inside of the string q in normal speech, which in the case that you just copied my code word for word, would allow other characters in the story to call your character by name.

Any more questions? This is all what I've personally figured out, so if anyone has any corrections, step right in.

greenteaproductions
Newbie
Posts: 2
Joined: Sun Jan 15, 2012 3:10 am
Projects: Our Story
Contact:

Re: dynamic character?

#4 Post by greenteaproductions »

@Fawn Hehe sorry, I was in a hurry and typed that up in a rush. :oops: Yeah, I tried reading the wiki but I just sit there staring at my screen thinking, 'What the heck did I just read?' Because I'm a total noob like that. Trust me, I really wanna make a game but I do it and it's like, "Parsing the script failed." EVERYTIME x( But other than that I can do the basic stuff.

@ProxyPawaa OH GOSH, THANK YOUU! Yay! That was a cool code that I randomly put in, but it works so... :D If I have anymore question about DynamicCharacter I'll post it here!

cracklings
Newbie
Posts: 14
Joined: Sat Nov 19, 2011 10:53 am

Re: dynamic character?

#5 Post by cracklings »

I couldn't work the code in the documentation.

Looking through the forum before, this is the one I like to use the best because it has an option to put in a default name if the player doesn't give one. (Sorry to the person who supplied this code in the original thread, but I can't find the thread.)

Code: Select all

$ player_name = renpy.input("What is your name?")
    $ player_name = player_name.strip()
    
    if player_name == "":
        $ player_name="default.name"
When you define your character, you use:

Code: Select all

define p = DynamicCharacter("player_name", color="#FFFFFF")
When you write dialogue, you use:

Code: Select all

p "blah blah blah"

ProxyPawaa
Newbie
Posts: 23
Joined: Sun Jan 16, 2011 5:43 pm
Contact:

Re: dynamic character?

#6 Post by ProxyPawaa »

Code: Select all

    $ q = renpy.input("My name is...?") or "Default Name"
This code I gave in my original reply accomplishes the same feat, or so it seems. Or is there something I didn't notice that yours does that mine didn't?

cracklings
Newbie
Posts: 14
Joined: Sat Nov 19, 2011 10:53 am

Re: dynamic character?

#7 Post by cracklings »

ProxyPawaa wrote:

Code: Select all

    $ q = renpy.input("My name is...?") or "Default Name"
This code I gave in my original reply accomplishes the same feat, or so it seems. Or is there something I didn't notice that yours does that mine didn't?
It just didn't work with me. I couldn't run the game because I keep getting errors when I use it so I opted for the one I got from this forum.

I think it has something to do with my noob-ishness. :D

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Majestic-12 [Bot]