Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
MythicDungeons MythicDungeons
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 86
    • Issues 86
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • MythicCraft
  • MythicDungeonsMythicDungeons
  • Wiki
  • Custom Elements

Last edited by MarcatoSound Dec 14, 2023
Page history

Custom Elements

DISCLAIMER
The following is a feature only available in Mythic Dungeons 1.3.0+!

Mythic Dungeons has an extensive API for creating your own functions, triggers, and conditions for use in dungeons. We call these "Dungeon Elements". Many of them share code, and require a little work to setup in order to support the in-game menus needed to access them. Here, we will explore concepts that apply to all elements.

Important Annotations

Saved Fields

Mythic Dungeons will automatically save and load values stored on a Dungeon Element when players configure them in-game, however you must specify what you want to save and load! This is indicated with the @SavedField annotation.

@SavedField private String message; // Mythic Dungeons will save and load this value.
private int delay; // Mythic Dungeons will NOT save and load this value.

Saved fields will also be displayed in the menus of meta elements, such as the multi-function.

Hidden Fields

But what if you don't want your saved field to appear in the menus of meta elements? This is achieved with the @Hidden annotation.

@SavedField private String message; // Mythic Dungeons will display this in the meta element menu.
@Hidden @SavedField private int delay; // Mythic Dungeons will NOT display this in the meta element menu.

Required Constructors

Due to constraints with automatically saving and loading elements, all dungeon elements must include two constructors.

  • A constructor with no parameters: public FunctionMessage()
  • A constructor taking a <String, Object> map as a parameter: public FunctionMessage(Map<String, Object> config)
    public FunctionMessage() {
        super("Message"); // Parameter for the element's unique name.
    }

    public FunctionMessage(Map<String, Object> config) {
        super("Message", config); // Parameter for the element's unique name and the config map.
    }

The first constructor is used to create a brand new instance of the element with default options. The second constructor is used to load an existing element and all of its saved fields, which are stored in the map.

Within these constructors, you can configure certain details of your element, such as what category it belongs to, its colour when displayed, whether it requires a target, etc. What options are available for different kinds of elements will be explored in their tutorials.

You shouldn't ever need to call these constructors yourself! They are only required for Mythic Dungeons' internal systems to be able to use your custom element!

Next up: GUI Menus -->
Clone repository

NOTE: Items marked with * are incomplete or unwritten.

General Info
  • Changelogs
  • Free vs Premium
  • Commands and Permissions
  • Plugin Config
  • How it all Works
Guides
  • Getting Started
  • Your First Dungeon
  • Importing from DXL
Dungeon Elements
  • Dungeon Config
  • Dungeon Types
  • Functions
  • Triggers
  • Conditions
Generated Dungeons [2.0+]
  • Procedural Dungeons Overview
  • Dungeon Rooms
  • Default generation.yml
  • Generator Tips & Tricks
  • Troubleshooting
Compatibility
  • Mythic Mobs
  • Placeholder API
  • BetonQuest
Developer Documentation
  • Avoiding Memory Leaks
  • Introduction to API
  • Getting Started with Elements
  • GUI Menus
  • *Custom Functions
  • *Custom Triggers
  • *Custom Conditions
  • Adding Party Support
    [Coming Soon!]
  • *Custom Dungeon Types
  • *Custom Procedural Layouts