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 wonder if it's possible to dynamically create menu choices from array in RenPy? Let's say you have 100 skills in the game, and player can use 1-5 of them (like in any rpg). Is it possible to display current skillset as a menu choices and remember the one that player picked? I wrote the following code, obviously it doesn't work:
python:
menu_items = []
for item in player.skills:
menu_items.append(skillsList[item].name)
choice = menu(menu_items)
for i in Skill.name:
if Skill.name == choice:
chosen_skill = choice
#CalculateDamage(player, enemy, chosen_skill)
menu_items = []
for item in player.skills:
menu_items.append(skillsList[item].name)
choice = renpy.display_menu([(skill, skill) for skill in menu_items])
Last edited by JackDoe on Thu Feb 21, 2019 11:20 am, edited 1 time in total.
Alex wrote: ↑Wed Feb 20, 2019 3:19 pm)) Instead of calling a menu call a custom screen with bunch of buttons that will let player to choose skills and all.
The question is how to make these buttons dynamically from the array.
Never use screens before.