User Tools

Site Tools


Sidebar

Translations of this page:
en
mods

FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)

Mods

By default you should have 3 mod sources: Local Mods, Ammo Mods and Official.

  • Local mods - These are mods that are already installed
  • Ammo Mods - Official source of mods available only to ammo.
  • Official - Official source of mods available to everyone.

To install a mod, select it from the list and click the Install button. The mod will download and install, but it won't work yet. For the mod to work, you need to restart the game. This can be done via the Reload Game button in the top right corner.

To disable a mod, select it in the list and click the Disable button. Restart the game to disable the mod.

Sources

List of sources

How to create a source

To do this, you need either your own server or file hosting like github.com.

The URL must return JSON in the format

{
  "name": "Source name",
  "mods": [
    {
      "id": "mod-id",
      "name": "Mod name",
      "version": "1.0",
      "description": "Description of the mod",
      "game_version": "0.16",
      "file_name": "mod_archive.zip"
    },
    {
      "id": "mod-id-2",
      "name": "Name of another mod",
      "version": "2.0",
      "description": "Description of another mod",
      "game_version": "0.16",
      "file_name": "another_mod_archive.zip"
    }
  ]
}

The files mod_archive.zip and another_mod_archive.zip must be available at source_url/file_name.

Or, if the source URL ends in .json, then the mod files should be next to the json file.

Examples

Source URL: https://example.com/mods
file_name: example_mod.zip
Mods URL: https://example.com/mods/example_mod.zip

Source URL: https://example.com/mods/manifest.json
file_name: example_mod.zip
Mods URL: https://example.com/mods/example_mod.zip

Format

  • name - String - Source name
  • mods - Array - Array with mods
  • mods.N.id - String - ID of the mod. Must be unique for each mod
  • mods.N.name - String - Mod name
  • mods.N.version - String - Mod version
  • mods.N.description - String - Description of the mod
  • mods.N.game_version - String - The minimum version of the game that the mod can run on
  • mods.N.file_name - String - The name of the archive with the mod. Only zip archive!

Mods

The mods folder should be named mods and should be located in the game folder, next to the game folder.

Each mod should be in a separate folder named the same as the mod's id.

There should be a manifest.json file in the mod folder. This file must contain the same information as in the source, except for the file_name field.

Example

{
    "id": "mod-id",
    "name": "Mod name",
    "version": "1.0",
    "description": "Description of the mod",
    "game_version": "0.16"
}

Scripts

Code files must be in .rpym or .rpymc format. This is the same as .rpy and .rpyc. Don't know about .rpy and .rpyc? See RenPy documentation.

You write mod code in .rpym files, when you start the game they will be compiled into .rpymc.

The files can simply be in a folder, or in a .rpa archive.

How to replace an image from a game

To do this, you need to add a new parameter merge_folders in manifest.json, which is an array of strings. This parameter specifies a list of folders, files from which will be recognized by the game, as if they were in the game itself from the very beginning.

To change the image in the game, you need to know the location of the original image. In folder, specified in the merge_folders parameter, you need to place the new image in the same path as the original image.

Example

A simple mod that replaces the background of the room in which the player appears at the very beginning of the game.

The original background is stored in this path:

images/bg/beginning_room.webp

Mod folder structure:

 mods
└───mod-id
│   │   manifest.json
│   └───my_folder
│       └───images
│           └───bg
│               └───beginning_room.webp

Where mod-id/my_folder/images/bg/beginning_room.webp is the new image we want to replace the original one with.

The content of the manifest.json file is:

{
    "id": "mod-id",
    "name": "Mod name",
    "version": "1.0",
    "description": "Description of the mod",
    "game_version": "0.16",
    "merge_folders": ["my_folder"]
}

That's all it takes to replace the image.

How to interact with game events

To do this, you need to create a class (in the .rpym file) that inherits the Module class and subscribe to the necessary events. See List of events

For example, a module that reacts to a change in the time of day and a change in location.

init python:
    class DemoModule(Module):
        id="demo" # Each module must have a unique id
        subscribe_on_events=["time_update", "change_location"]
 
        def on_event(self, event):
            if event.type == "time_update":
                if event.is_morning:
                    renpy.notify("Morning has come")
                elif event.is_evening:
                    renpy.notify("Evening came")
            elif event.type == "change_location":
                renpy.notify("New location: " + event.new_location.id)

How to add an item to the store

To do this, you need to create a variable from the Item class if it's just an item, or from the Outfit class if it's an item of clothing.

  • It is desirable that the variable name starts with item_.
  • Item name must be unique and must not be repeated.

Examples

Adding a regular item to the Tenten shop.

init python:
  item_pen = Item(
    name=__("Handle"),
    cost=5,
    icon="my_mod_folder/pen.webp",
    descr=__("Pen with ink."),
    shop="tenten",
  )

Adding clothes to the Ten-Ten store.

init python:
  item_ino_my_new_costume = Outfit(
    name=__("New costume for Ino"),
    cost=100,
    descr=__("Item description"),
    char="Ino",
    lust=10,
    layer="costume",
    val="my_new_costume",
    shop="tenten",
    ptr=False,
    icon=KTCharInventoryPreview(
      char_name="ino",
      layers=ino_preview_layers + [("costume", "my_new_costume")],
      crop=ino_costume_inv_preview
    ),
  )

Mod folder structure:

mods
└───mod-id
│   │   manifest.json
│   └───merge_folder
│       └───images
│           └───characters
│               └───ino
│                   └───costume
│                       └───my_new_costume.webp

With this approach, the item will only be in the store if you start a new game. To add an item to the store, if the player is loading an already existing save, use Module. See. How to interact with game events and event game_loaded.

You will get something like this:

def on_event(self, event):
  if event.type == "game_loaded" and not inv_shop.has_item(item_my_item):
    inv_shop.add(item_my_item)

Game variables

Times of Day

if game.time.is_morning:
    "Now is the day"
elif game.time.is_evening:
    "It is evening now"
 
$ game.time.set_morning()
"Now is the day"
$ game.time.set_evening()
"Now it's evening"
 
$ game.time.next_cycle()
"If there was a day, now it is evening. If it was evening, it is now day and the counter of days has increased."
 
$ game.time.next_day()
"It is now exactly a day and the counter of days has increased by 1."
 
$ game.time.skip_days(10)
"The day counter has increased by 10."
mods.txt · Last modified: 2022/07/16 00:21 by restu