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 tried searching but couldn't find an answer... This feels like it should have a simple solution but I'm not sure what I'm doing wrong (haven't touched renpy in a long time too so that doesn't help)
Anyway...
I'm using a dictionary to track how suspicious an NPC feels about other characters
#in a separate file
init python:
#dict for Lucius
lsus = {
"Ciro" : 0,
"Lucius" : 0,
"Bugra" : 1
}
find_lsus = max(lsus, key=lsus.get) #finds which character Lucius is most suspicious of
#these two are test variables so I can see if their values actually changed
lsus0 = lsus["Ciro"]
lsus3 = lsus["Bugra"]
I tried to make a sample menu to see if I could add more suspicion:
Well, you obviously don't realize that the block after "init python:" is only executed once when you start the game. So lsus0 and lsus3 are never updated of course, they are not references or pointers if you thought that.
I don't quite get why you need those variables, because you can just check for the dict's contents by doing:
Thank you! Yes, I didn't understand that about init python. I have figured it out now (and ended up switching from just a dictionary to using a class). Also thank you for showing me how to get the dictionary contents in renpy code.
✧ ✧
fastest way to contact me: DM @skyharborr on twitter