โœฆ JVDesignStudio ยท No Sign-Up Required

OpenRCT2 Modding Cheat Sheet

A one-page printable reference for plugin basics, the park/ride/guest API, UI windows and map/tile access the most-used TypeScript snippets for OpenRCT2 plugins. Pin it next to your monitor!

๐Ÿ”Œ Plugin Basics

registerPlugin({
    name: "My Plugin",
    version: "1.0",
    authors: ["You"],
    type: "remote",
    licence: "MIT",
    main: function() {
        console.log("Plugin loaded!");
    }
});

The main function runs once when the plugin is loaded set up your hooks and UI here.

๐Ÿž๏ธ Park API

// read/write park cash
console.log(park.cash);
park.cash += 10000;

// park name
park.name = "Fun World";

// current in-game date
console.log(date.year, date.month, date.day);

๐ŸŽข Ride API

const rides = map.getAllEntities("ride");

rides.forEach(function(ride) {
    console.log(ride.name);
    console.log(ride.excitement);
    console.log(ride.intensity);
    console.log(ride.nausea);
});

Excitement, intensity and nausea are raw rating values, divide by 100 for the displayed star value.

๐Ÿง‘ Guest API

const guests = map.getAllEntities("guest");

guests.forEach(function(guest) {
    console.log(guest.happiness);
    console.log(guest.energy);
    console.log(guest.cash);
});

๐ŸชŸ UI Windows

ui.openWindow({
    classification: "my-plugin-window",
    width: 200,
    height: 120,
    title: "My Plugin",
    widgets: [
        { type: "label",  x: 10, y: 20, width: 180, height: 14, text: "Hello!" },
        { type: "button", x: 10, y: 40, width: 80,  height: 16, text: "Click", onClick: function() {} },
        { type: "dropdown", x: 10, y: 60, width: 100, height: 14, items: ["A","B"] }
    ]
});

๐Ÿ—บ๏ธ Map & Tiles

const tile = map.getTile(10, 15);

tile.elements.forEach(function(el) {
    console.log(el.type);
});

// surface height (in z-units, divide by 8 for game height)
const surface = tile.elements.find(function(e) { return e.type === "surface"; });
console.log(surface.baseHeight);

๐Ÿช Events & Hooks

context.subscribe("interval.tick", function() {
    // runs every game tick
});

context.subscribe("ride.ratings.calculate", function(e) {
    console.log("Ride ratings calculated for ride " + e.rideId);
});

๐Ÿ› ๏ธ Common Patterns: Minimal Plugin with a UI Button

registerPlugin({
    name: "Cash Booster",
    version: "1.0",
    authors: ["You"],
    type: "remote",
    licence: "MIT",
    main: function() {
        if (typeof ui === "undefined") return;

        ui.registerMenuItem("Cash Booster", function() {
            ui.openWindow({
                classification: "cash-booster-window",
                width: 180,
                height: 90,
                title: "Cash Booster",
                widgets: [
                    {
                        type: "button",
                        x: 10, y: 30, width: 160, height: 20,
                        text: "Add ยฃ10,000",
                        onClick: function() {
                            park.cash += 1000000;
                        }
                    }
                ]
            });
        });
    }
});

Want to build a whole game?

Follow one of our free step-by-step workshops in the Workshop hub.

๐Ÿ”ง Browse Workshops โ†’