SnootGame/game/mods/README.md
2021-10-10 13:47:41 +11:00

76 lines
3.7 KiB
Markdown

To normal users installing multiple mods: It's recommended to only have one mod folder installed in the mods directory in case two mods have duplicate `green_fang_story` label, otherwise the game will error out if mods conflict each other, this includes not only labels but images & sound too.
The game loads an alternate storyline.rpy, this allows you to control the flow of the game's storytelling
Examples include:
- You want to inject more stuff inbetween chapters, maybe you hate time skip writing
- You want to have more of an after story kind of ordeal, for example expanding Ending 2
- You want to replace the entire story route
You can still call the vanilla game's chapters like the intro (call chapter_1) for example but you might want to either copy the vanilla scripts and mix in your edits to have full control
Run the convert.py included in the `mods/` folder
story.py -> one-liner exec('') rpy
for a 'debug' file you can still use rpy and call into it
```
'Name': "Mod Name", 'Label': (the exec string) or label in your rpy
```
for maximum compatibity with other mods (creating no conflicts with names) you will have to use the one-liner exec script
`python yourmod.rpy newmod.rpy`
Keep a `yourmod.rpy.original` included with the `newmod.rpy` as the game does a hash check between both of the contents files to confirm it's the same character for character the exact same for verification reasons.
We also recommend to license the script under `AGPLv3` just like Snoot Game.
You will need to learn bit of Ren'Py & bit of actual Python anyways but you don't have to think too hard in learning anything new other than familiarizing with this game's script.rpy's already defined Character objects and images, you can freely ignore most of the UI and so on for the inexperienced but passionate artist and/or writer.
Textbox limitation: ~300 characters / four lines, the maximum in the vanilla game's script is around roughly ~278 and that only barely overflows to four lines, so <200 characters / three lines of text should be fine.
--- Ideal file structure of your mod ---
In the root of the mods folder:
folder_of_your_mod_name
- storyline.rpy
-> asset_folder
-> images
- asset.png
-> sound
- song.png
-> script_folder
- script.rpy
`name_of_storyline.rpy`
```
init python:
# Modding Support variables
# All mod rpy files must have title of their mod (this shows up on a button)
# and finally the label that controls the flow of dialogue or the execstring
#mod_loader.add_mod(name, label/execstring) #return 'pointer' to your mod
#mod_loader.add_image(name, filename)
#mod_loader.add_variable(name, default)
#mod_loader.get(_id)
mod_loader.add_mod("Mod Example", "mod_storyline")
mod_loader.add_image("asset", "mods/folder_of_your_mod_name/asset_folder/asset.png")
label mod_storyline:
call chapter_1_new
```
`script_folder/script.rpy`
```
label chapter_1_new:
python:
mymod = mod_loader.get("Mod Example")
renpy.show(mymod['asset'])
renpy.say("Sample Text")
hide template_sample
play music 'audio/OST/Those Other Two Weirdos.ogg'
show anon neutral flip at aright with dissolve
A "Sample Text"
return
```
Do note that we do not write in the normal ren'py way (this also means you would have to translate the original script to a certain degree if you want to add in routes or whatever), save files are indepdenent from other mods and the main game, for example: you can't use the main game save file into your new mixed in mod.
You have to write the dialogue in the python way, all of the ren'py related stuff is possible as it's just syntax sugar for the actual python functions.
The funny thing is I don't even like 'fanfictions' to begin with but this mod support allows these 'fanfictions', ironic.