Skip to content

Cosmetics

Alexandre 'kidev' Poumaroux edited this page Oct 21, 2026 · 1 revision

Cosmetics

proleak.cosmetics changes what this player hears and sees of the game: a plugin's own sound files in place of the game's music and sounds, music added to the game's, the map's decorations moved, hidden, resized or added, and the game's effects swapped. The changes reach this player only, so they work in every game. When the plugin unloads, everything it changed goes back to the game's own.

What the game sells stays the game's: skins, monuments, and the sounds and effects of units (which come with their skins).

from proleak import cosmetics

theme = cosmetics.load_sound("music/theme.ogg")
cosmetics.replace_sound("Sounds/Music/Menu", theme)        # the main menu's music
cosmetics.add_music(cosmetics.load_sound("music/battle.ogg"))  # after the game's tracks
cosmetics.replace_ui_sound("Click", cosmetics.load_sound("sounds/click.wav"))

Contents

Loading a sound

load_sound(file) loads a WAV or OGG file of the plugin's folder, at most 32 MB, in the background. sound.state is loading, ready, or failed: and the reason. A sound given a place while it loads takes it once ready. play_music needs a ready sound.

Music

The game plays these tracks; each is a sound bank path to give to replace_sound:

Path Plays
Sounds/Music/Login while the game starts
Sounds/Music/Menu in the main menu
Sounds/Music/LoadingScreen on the loading screen
Sounds/Music/01 to Sounds/Music/08 in a game, one after the other
Sounds/Music/Campaign/<mission> on a campaign mission's screen
Sounds/Music/CardTraderBackground at the card trader
Sounds/Music/MonumentBackground on the profile's monument tab

add_music(sound) plays the sound after the game's eight tracks in each game, and remove_music(sound) takes it out. play_music(sound) plays a sound as the music now, until the game changes its music (a menu, a loading screen, a new game); stop_music() stops it.

Sounds

replace_sound(path, sound) takes a path of the game's sound bank in one of these folders:

Folder Holds
Sounds/Music/ the music
Sounds/Effects/ effects, such as gold coins and the king's hits
Sounds/Buffs/, Sounds/Auras/ buffs and auras starting and ending
Sounds/Powerups/ legion spells
Sounds/Mastermind/ Mastermind rolls
Sounds/Environment/ the map's ambient sounds
Sounds/Extras/ the card trader and other extras
Sounds/Campaign/, Sounds/Tutorial/ the announcer's campaign and tutorial lines

A unit's sounds (Sounds/Units/, Sounds/Missiles/, Sounds/Equips/) are refused: units and their skins keep the sounds the game gives them. replace_ui_sound(name, sound) replaces a UI sound of sfx.names(), such as Click or GoodJob2.

heard() lists the sound bank paths the game has played since it started, which is the way to find a sound's path: play the game, then read the list. A replacement takes effect the next time the game plays the sound. Each sound has one replacement at a time: a path another plugin replaced raises ValueError with that plugin's name. restore_sound(path) and restore_ui_sound(name) give the game its own sound back, and replaced() lists what the plugin replaced.

The map

The map's decorations are its doodads: trees, rocks, buildings, lights, the water's effects. doodads() lists those of the map loaded now, each with its path under the map's doodads (siblings of one name are told apart by #2, #3), its place (x, z, height y), turn, scale, visible and the effect it shows.

from proleak import cosmetics

pine = cosmetics.doodad("Trees/Pine_03")
pine.hide()                     # or show()
pine.move(42, 61)               # on the ground; move(42, 61, y=3) at a height
pine.turn_to(90)
pine.resize(1.5)                # against its own size, at most 10
pine.reset()                    # as the game made it

cosmetics.add_doodad("Trees/Pine_03", 40, 60, turn=45)                     # a copy of a doodad
cosmetics.add_doodad("Models/Doodads/CrystalCoast/Lightshafts_Day", 90, 80)  # a doodad model

A change holds the doodad for the plugin until it resets it, and stays for every map that has the doodad, each time the map loads. add_doodad copies a doodad of the map by its path, or a doodad model of the game by its path in Models/Doodads/, whatever its map; reset() on an added doodad removes it. A doodad another plugin changed raises ValueError with that plugin's name.

Effects

The game's effects are paths such as Particles/VFX/Effects/GoldCoins.pkfx. These folders are open to plugins:

Folder Holds
Particles/VFX/Effects/ effects, such as gold coins and mythium
Particles/VFX/Buffs/, Particles/VFX/Auras/ buffs and auras
Particles/VFX/Environment/ the map's weather and ambience, such as falling snow

A unit's missiles and gear (Particles/VFX/Missiles/, Particles/VFX/Equips/) keep their effects. swap_effect(path, to) shows to wherever the game starts path from then on, and restore_effect(path) gives the game its own back. doodad.show_effect(path) gives a doodad's effects another effect, and an empty path shows none.


Previous: Chat, camera, input and more | Next: Game modes

Clone this wiki locally