What might be needed?
- A text editor that supports utf-8 text encoding. For example, Notepad++. In no case, do not use Microsoft Office, Libre Office: their tools are too smart for our tasks and… they can ruin the code.
- Game resource map.
- If the resource map is not enough for you, you can access the contents of rpa packages using this tool. At the time of editing this page, the current version of the unpacker is suitable.
- Ren’Py engine documentation (is mostly in English, but on YouTube and other resources you can often find hints in your native language).
- A script written by you or your friends (optionally based on a fanfic).
First Steps. Guidelines for adding stories to the game
- Create a folder for your story. For this… In the game folder find the game folder, then the stories folder, and in it create a folder with a name with Latin characters and no spaces, for example: harry_and_first_lesson. It should get the following path: game/stories/harry_and_first_lesson/. In this folder will be placed all the files of your story.
- Add a file with the description of your story. It must have the extension rpy (you can make a new text file, and then change the extension from txt to rpy). In this file, be sure to include information in the form of a dictionary (code-value). This will allow the game to see and run your story.
Here is the template:
init -100 python:
mods_list.append({
"name": "Name of your story", # Title. This is a comment to the code
"tech_name": "unique_story_name", # All labels and variables of your story should start with this!
"description": "Description of your story", # Description of your story
"language": "en", # Language of the story (e.g, 'de', 'en')
"start_label": "label_start", # Label for start
})
label label_start:
"Your text or actions here. Your story starts in this block of code."
return
3. If you want to use additional resources: music, backgrounds, characters, you can add folders for them in the folder of your story. Their names can be: images, sounds, music, characters.
Tips:
- Make sure file, folder and label names are unique to avoid conflicts. Always start them with your “unique_story_name”. You can see an example in the folder stories/example_story
- Use comments in the code for convenience: add the # symbol and after it specify what this code fragment is for. it will be useful when you decide to remember in six months what you wrote there…
Testing
Make sure that the story is correctly displayed in the list of these very stories in the game and runs without errors.
Professor Flitwick’s lesson
This is what the code for a short story might look like, using backgrounds and characters.
init -100 python:
mods_list.append({
"name": "Professor Flitwick's school for creating stories",
"tech_name": "flitwick_school_en", # Unique name for the story
"description": "Professor Flitwick will teach you how to create stories for this game!",
"language": "en",
"start_label": "flitwick_start_en", # Starter Label
})
label flitwick_start_en:
scene bg chants day
show fl norm:
xalign .32 ypos 30 zoom .4
show chants_tumb
show chants_tables day
with Dissolve(1, alpha=True)
fl "Welcome to my School for creating stories! Today I'm going to tell you how to create a story for this game."
fl "It's very easy if you follow my instructions. Shall we get started?"
fl "First, create a folder for your story."
fl "It should be placed in the {color=#6495ED}game/stories/{/color} folder, and named so that it is clear what kind of story you are creating."
centered "\"game/stories/your_story/\""
fl "Second, you need to add a script file. Let's name it, for example, {color=#6495ED}your_story.rpy{/color}."
fl "This file should contain information about your story. For details on how it is written, see the README.md file."
show fl lecture3
fl "Note the {color=#6495ED}\"tech_name\"{/color}! This is a unique name to avoid conflicts. All your variables and labels must start with it."
show fl smile
fl "Next, create a label with your start script. It should match the {color=#6495ED}\"start_label\"{/color} from the dictionary."
fl 'label label_start:\n "Your text or actions are here."\n return'
fl "If your story uses resources - images, music, and so on - put them in the same folder as your script."
fl "For example, images can be put in the {color=#6495ED}your_story/images/{/color} folder."
fl "After that, test your story. Make sure it shows up in the stories list and runs without errors."
fl "That's it! Now you know how to create stories for this game. Good luck!"
fl "And remember: unique variable names are the key to successful stories creation!"
return