Ren'Py [Ren'Py] [Programming] Common and main events

SPkiller31

Member
Game Developer
Dec 20, 2020
130
162
So first of all hi and thank you all in advance for help.

I have no idea how difficult/easy this will be but I'm slowly writing story for my game and I started facing problems regarding events.
Like many games my title will have relationship points/affection and by playing common events with characters, player will unlock new pieces of story, so "special" events.

I think that doing common event is very easy, just using jump to label when player decided to visit someone and then changing for example $ kaede_affection += 1

For me difficult stuff starts now: What would be easiest way to check so if points are 5, there is eventsthat plays only once and then we go back to normal events once again until 10 and so on for each character. Trying to bruteforcing that by doing that events play ONLY at EXACTLY 5/10/... would be not only stupid but incorrect as I have more than one way to increase affection.

I hope that I was able to somewhat explain that. Any ideas, tips are welcome, just remember I'm quite newbie and need newbie type of explaining, thans a lot.
 

bobdickgus

Active Member
Apr 9, 2020
711
1,930
Use >= for the value and set and event flag when completed is one way.

Python:
if kaede_affection >= 5 and kaede_event1_flag == False:

   jump kaede_event1 # during kaede_event1 set kaede_event1_flag = True

elif kaede_affection >= 10 and kaede_event2_flag == False:

   Jump kaede_event2 # during kaede_event2 set kaede_event2_flag = True

else:

   "Blah blah with Kaede"

   $ kaede_affection += 1
 

SPkiller31

Member
Game Developer
Dec 20, 2020
130
162
Use >= for the value and set and event flag when completed is one way.

Python:
if kaede_affection >= 5 and kaede_event1_flag == False:

   jump kaede_event1 # during kaede_event1 set kaede_event1_flag = True

elif kaede_affection >= 10 and kaede_event2_flag == False:

   Jump kaede_event2 # during kaede_event2 set kaede_event2_flag = True

else:

   "Blah blah with Kaede"

   $ kaede_affection += 1
Ohh right, how did I not think about flagging every event as false and unlocking them, Thanks a lot, I think that it should work perfectly.

By the way, can I bother you with one more question if you know answer, this time regarding player's name? If I let players choose name for character (and maybe set some basic one), what would be easiest way for game to remember custom name in replay mode (so in scene gallery and things like that, not whole game replay so to speak)?
I have something like that
$ persistent.mc = renpy.input("What will be name of protagonist? Leaving space blank will set name to default: Yamato.").strip() or "Yamato"

And in character file I defined:
define mc = Character("[persistent.mc]", color="#000000")

but for some reason in replay, when I use for example
mc "Yup that's me"
I can't see who is speaking. 2 people tried to help with that but to no succes. Maybe I will just force Yamato as base name in replay gallery but thought it would be cool to rember what player typed.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,318
15,208
  • Like
Reactions: SPkiller31

SPkiller31

Member
Game Developer
Dec 20, 2020
130
162
Not to do self promotion, but those two should be a bit more helpful: How-To have a dynamic story that react to player choices, and [How-To] Variables and save compatibility.
The first one answer his question, while the second one will help him avoid the usual mistakes.
Thanks a bunch (again as I think you save me a lot of time once again.) So far in my story I'm doing very basic stuff so counting and tracking few points is enough but it will help me.
Post regarding updating game will be definitly useful.