hello, I am a rookie in coding and I usually end up getting help from the forum by searching but this time I can't find code for changing relation with someone. I need help desperately,
I want to let people change relation with characters as they are introduced in story. for Example I have introduced Jake in my Novel, but a player wants "Jake" to be his friend but the default is brother. What code do I use?
its similar to changing name
So I used this but didnt work.
$ name = renpy.input("Please enter your Name")
$ name = name.strip()
Thank you.
How to change Relation of characters?
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.
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.
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: How to change Relation of characters?
Nikois wrote: ↑Sun Feb 03, 2019 11:13 am hello, I am a rookie in coding and I usually end up getting help from the forum by searching but this time I can't find code for changing relation with someone. I need help desperately,
I want to let people change relation with characters as they are introduced in story. for Example I have introduced Jake in my Novel, but a player wants "Jake" to be his friend but the default is brother. What code do I use?
its similar to changing name
So I used this but didnt work.
$ name = renpy.input("Please enter your Name")
$ name = name.strip()
Thank you.
You could use an input function, but a problem would be that the player could write any number of things and that would be hard to handle.
A menu would be better. That would limit the answers the player can enter. Something like this
Code: Select all
default jakeRel = "brother"
----
menu:
"Jake is your ..."
"brother":
$ jakeRel = "brother"
"friend":
$ jakeRel = "friend"
"butler":
$ jakeRel = "butler"
"arch-enemy":
$ jakeRel = "arch-enemy"
Code: Select all
if jakeReel == "brother":
[somethings will happen]
elif jakeReel == "friend":
[something different will happen]
-----
player "This is Jake, he is my [jakeRel]."
Re: How to change Relation of characters?
Its not working for me, I typed what you have shown but it takes me back to tracebacks. I really appreciate your reply but can you please tell me how to do it and where to do it? I also want players to type the relationship they want, not to choose from menus. i am real noob here i hope you understand. thanks for the helpPer K Grok wrote: ↑Sun Feb 03, 2019 12:09 pmNikois wrote: ↑Sun Feb 03, 2019 11:13 am hello, I am a rookie in coding and I usually end up getting help from the forum by searching but this time I can't find code for changing relation with someone. I need help desperately,
I want to let people change relation with characters as they are introduced in story. for Example I have introduced Jake in my Novel, but a player wants "Jake" to be his friend but the default is brother. What code do I use?
its similar to changing name
So I used this but didnt work.
$ name = renpy.input("Please enter your Name")
$ name = name.strip()
Thank you.
You could use an input function, but a problem would be that the player could write any number of things and that would be hard to handle.
A menu would be better. That would limit the answers the player can enter. Something like thisYou can then use the variable jakeRel to change what happens in the game depending on which relationship is chosen.Code: Select all
default jakeRel = "brother" ---- menu: "Jake is your ..." "brother": $ jakeRel = "brother" "friend": $ jakeRel = "friend" "butler": $ jakeRel = "butler" "arch-enemy": $ jakeRel = "arch-enemy"
Code: Select all
if jakeReel == "brother": [somethings will happen] elif jakeReel == "friend": [something different will happen] ----- player "This is Jake, he is my [jakeRel]."
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: How to change Relation of characters?
Here you have a complete script for a menu solutionNikois wrote: ↑Sun Feb 03, 2019 2:18 pm -----
Its not working for me, I typed what you have shown but it takes me back to tracebacks. I really appreciate your reply but can you please tell me how to do it and where to do it? I also want players to type the relationship they want, not to choose from menus. i am real noob here i hope you understand. thanks for the help
Everything in the script.rpy
definition and default before label start
Code: Select all
define J = Character ("John")
default jakeRel = "brother"
# The game starts here.###################################################
label start:
scene bg placeholder
menu:
"Jake is your ..."
"brother":
$ jakeRel = "brother"
"friend":
$ jakeRel = "friend"
"butler":
$ jakeRel = "butler"
"arch-enemy":
$ jakeRel = "arch-enemy"
J "This is Jake. He is my [jakeRel]."
jump start
(both solutions only give you the opportunity to chose relationship with Jake over and over again)
Code: Select all
define J = Character ("John")
default jakeRel = "brother"
# The game starts here.###################################################
label start:
scene bg placeholder
$ jakeRel = renpy.input("Is Jake you brother or your friend?")
$ jakeRel = jakeRel.strip()
J "This is Jake. He is my [jakeRel]."
jump start
My advice to anyone starting to learn a new game engine is to start out with really simple stuff. When you are secure in the basics, you can add new fancier stuff one at a time.
When you want to ask about something that has generated an error message in your game, it is helpful if you copy and paste the error message in your post and the portion of the script where things has gone wrong. For script text it is good to use the code-tags. [_code][_/code] but without the underscore.
Re: How to change Relation of characters?
Yeah I will definitely paste errors next time, thank you for the helpPer K Grok wrote: ↑Sun Feb 03, 2019 4:56 pmHere you have a complete script for a menu solutionNikois wrote: ↑Sun Feb 03, 2019 2:18 pm -----
Its not working for me, I typed what you have shown but it takes me back to tracebacks. I really appreciate your reply but can you please tell me how to do it and where to do it? I also want players to type the relationship they want, not to choose from menus. i am real noob here i hope you understand. thanks for the help
Everything in the script.rpy
definition and default before label start
and here is one using inputCode: Select all
define J = Character ("John") default jakeRel = "brother" # The game starts here.################################################### label start: scene bg placeholder menu: "Jake is your ..." "brother": $ jakeRel = "brother" "friend": $ jakeRel = "friend" "butler": $ jakeRel = "butler" "arch-enemy": $ jakeRel = "arch-enemy" J "This is Jake. He is my [jakeRel]." jump start
(both solutions only give you the opportunity to chose relationship with Jake over and over again)
but I would really advice against using an input solution. If you are going to use jakeRel to chose different paths you need to have some control over what the player enters.Code: Select all
define J = Character ("John") default jakeRel = "brother" # The game starts here.################################################### label start: scene bg placeholder $ jakeRel = renpy.input("Is Jake you brother or your friend?") $ jakeRel = jakeRel.strip() J "This is Jake. He is my [jakeRel]." jump start
My advice to anyone starting to learn a new game engine is to start out with really simple stuff. When you are secure in the basics, you can add new fancier stuff one at a time.
When you want to ask about something that has generated an error message in your game, it is helpful if you copy and paste the error message in your post and the portion of the script where things has gone wrong. For script text it is good to use the code-tags. [_code][_/code] but without the underscore.
Who is online
Users browsing this forum: Ahrefs [Bot], AWizardWithWords