Hi guys! This is probably an easy one, but I am new to coding and I couldn't find the answer in the tutorial. I'd like to assign variables to the Player Characters strength, speed, and relationship with other characters.
Any help is appreciated, sorry the question is so simple/stupid.
Help Setting Values?
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.
-
- Newbie
- Posts: 1
- Joined: Thu Jan 04, 2018 8:50 pm
- Contact:
- nature1996
- Regular
- Posts: 62
- Joined: Wed Jun 21, 2017 10:35 am
- Contact:
Re: Help Setting Values?
There is many way to do so, and even if I personally also have difficulty with the subject, I will try to help.
From what I got, there is three major way to create variable:
1-the initialization block
I believe the problem with that principle is the you variable might not be save (this is one of the point I have dificulty understand, as I believe they sometime do).
2-default
The usually recommended method from what I've heard:
This will set the variable to that value if no value is given in the save file (or for a new game). I was once recommended to always use that: viewtopic.php?f=8&t=44567&p=458047#p458054
3-define
If I remember well, this is recommended for variable that doesn't varies as it is not saved, or something like that.
I believe this is principally supposed to be used to create character.
In any case once that's done, you can interact with it later on by starting a python line by a starting it by a $
or by using logic statement:
In the end, you will generaly find more information in the manual, especially using the search function. You might need to go over a few article before finding what you want, but I almost always find what I need there.
Hope I could help
From what I got, there is three major way to create variable:
1-the initialization block
Code: Select all
init:
$strength=5.0
$defence=5.0
2-default
The usually recommended method from what I've heard:
Code: Select all
default strength=5.0
default defence=5.0
3-define
If I remember well, this is recommended for variable that doesn't varies as it is not saved, or something like that.
Code: Select all
define strength=5.0
define defence=5.0
In any case once that's done, you can interact with it later on by starting a python line by a starting it by a $
Code: Select all
$HP=HP-strength/defence
Code: Select all
if defence==5:
Hope I could help
Je parle aussi français
Who is online
Users browsing this forum: piinkpuddiin