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 am trying to make a point based game, but every time I try and have the player gain or lose points I get an error saying something like NameError: name 'Dren_points' is not defined. I did the coding at the very beginning like the guide said
You need to make sure those variables are defined before they are used. This is not necessarily done by putting one after the other.
Anything that needs initialization should go in an init block, to ensure it executes before any part of the story code. (see http://www.renpy.org/wiki/renpy/doc/tut ... _Structure)
Except, if you save the game and then restart it'll init them back to 0, which presumably isn't what you want. Tell me, when you were getting the errors, were you testing from a saved game? If so, then it makes sense you'd get errors, because the save won't go through the start label and initialise them, if you added the $ Dren_points = 0 etc. after making the save. Initialising after the start label is fine, but you need to test all over from the beginning rather than using a prior save if you do so.
I think this post can go here, anyways I have a point system and have reached the ending, but I get this error:
ERROR:
While running game code:
File "game/script.rpy", line 279, in script
if puntos_buenos > max (puntos_malos):
File "game/script.rpy", line 279, in python
if puntos_buenos > max (puntos_malos):
TypeError: 'int' object is not iterable
The game runs well until it reaches the if after the "more random text" in label choice6_done. Im trying to have the good ending if the chracter has a mayority of good points, bad ending if the chacter has 4 or less bad points (in which case the maximun of good points is 2 anyways so bad points are still mayority) and the worst ending only if player got 5 bad points, my code is this:
CODE:
label choice6_done:
e "random text"
"more random text"
wow, thanks I just removed the max and it worked just fine, now I just have the problem of being unable to get the worst ending to work, earlier in the game there was a jump directly to the worst ending, so the label of the worst ending is before the menu for the last otion and the other endings, does that matter or should I move the worst ending to the end of the script were the other endings are?
You´re right, since there are only 5 points in the game except for the last menu I hadn´t put a tie option but I already did, .
I doubled checked my code and all seemed fine , the game runs fine and normally and you can get the other endings no problem or even the worst ending by the direct option earlier on the game, the problem was solded, with an "and" , this one to be more specific
elif puntos_malos > puntos_buenos and puntos_malos <= 4:
jump finalmalo
Thanks again, I hope this helps other people too now I just need to figure where to change the "are you sure you want to quit" message to personalize it LOL