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.
I'm super new to this but I'm trying for a certain affect. It mostly works except it's setting off the wrong random scenes on occasion and I don't know if it's a coding issue or if there's something more that I need that I haven't learned about yet. My code for the most part looks like this-
label talk:
$ rand_themtalk = renpy.random.randint(1,2)
if rand_themtalk == 1 and talking: #the second part just to show that I'm trying to only
trigger it if there's a second variable at play (mentioning as
I'm not sure if it might be part of the problem)
$ you_talk = "Some words"
if rand_themtalk == 2 and talking:
$ you_talk = "Some other words.
$ rand_youtalk = renpy.random.randint(1,2)
if rand_youtalk == 1 and fighting:
$ you_talk == "Them's some fighting words."
if rand_youtalk == 2 and fighting:
$ you_talk == "Some more fighting words."
menu:
[you_talk]
"Say something else" if talking:
$ talking = True
$ fighting = False
jump talk
"Fight it out" if fighting:
$ talking = False
$ fighting = True
jump talk
"Do something else":
jump some_other_label
Okay if that makes sense (I'd copy the actual code but it's about 10 times as long with a bunch of variables that I don't want to have to explain).
So, my problem is, say every time I jump back to the talk label, half the time it does it right, but the other half, instead of 'talking' it switches to 'fighting', and vice versa.
I checked my code to see if maybe I've messed up a = or something but so far I'm not seeing an issue. I was wondering if maybe it's they way I have the random part set up- putting two different randoms together, and it's not happy about it.
If this doesn't make sense I'll try to explain further.
Jaitzche wrote: ↑Fri Mar 22, 2019 3:31 am
I'm super new to this but I'm trying for a certain affect. It mostly works except it's setting off the wrong random scenes on occasion and I don't know if it's a coding issue or if there's something more that I need that I haven't learned about yet. My code for the most part looks like this-
label talk:
$ rand_themtalk = renpy.random.randint(1,2)
if rand_themtalk == 1 and talking:
$ you_talk = "Some words"
if rand_themtalk == 2 and talking:
$ you_talk = "Some other words. ## closing " missing
$ rand_youtalk = renpy.random.randint(1,2) ## why a different variables for random value? You only use one of them.
if rand_youtalk == 1 and fighting:
$ you_talk == "Them's some fighting words." ## double ==
if rand_youtalk == 2 and fighting:
$ you_talk == "Some more fighting words." ## double ==
menu:
[you_talk] ## " " missing
"Say something else" if talking: ## if talking the use of if talking and if fighting makes it impossible to change mode
$ talking = True
$ fighting = False
jump talk
"Fight it out" if fighting: ## if fighting see above
$ talking = False
$ fighting = True
jump talk
"Do something else":
jump some_other_label
Okay if that makes sense (I'd copy the actual code but it's about 10 times as long with a bunch of variables that I don't want to have to explain).
So, my problem is, say every time I jump back to the talk label, half the time it does it right, but the other half, instead of 'talking' it switches to 'fighting', and vice versa.
I checked my code to see if maybe I've messed up a = or something but so far I'm not seeing an issue. I was wondering if maybe it's they way I have the random part set up- putting two different randoms together, and it's not happy about it.
If this doesn't make sense I'll try to explain further.