Skip to content

Custom Events

Swifter edited this page Feb 18, 2025 · 4 revisions

Prerequisites

Property Translations

What is this?

Raw JSON ReMapper
d unsafeData
t type

Location

Custom events are stored on the difficulty under the customEvents object.

difficulty
└── customEvents
    ├── animateTrackEvents
    ├── assignPathAnimationEvents
    └── ...

Creating

You have 3 options for creating custom events.

Option 1

You can use the object constructor to create a custom event.

rm.animateTrack(map, {
    beat: 2,
    duration: 4,
    track: 'myTrack',
    animation: {
        dissolve: [[0, 0], [1, 1]]
    }
})

When trying to convert events from the Noodle/Chroma/Vivify documentation into ReMapper, you can follow this format:

image

  • The 'beat' property is included in the object {}
  • The 'type' property is NOT included in the object {} you pass because it's already given by the function call (e.g. assignPlayerToTrack).
  • Additional properties are included in the root object {}, no need for an extra d object.

Option 2

You can pass parameters in order of relevance to create a custom event.

rm.animateTrack(map, 2, 'myTrack', 4, {
    dissolve: [[0, 0], [1, 1]]
})

Option 3

You can create an "abstract" custom event which is mostly untyped and not preferred if the event already exists in ReMapper.

rm.abstractCustomEvent(map, {
    beat: 2,
    type: 'AnimateTrack',
    unsafeData: {
        duration: 4,
        dissolve: [[0, 0], [1, 1]]
    }
})

You also have the option to create the abstract event in order of relevant parameters (beat, type, data).

rm.abstractCustomEvent(map, 2, 'AnimateTrack', {
    duration: 4,
    dissolve: [[0, 0], [1, 1]]
})

Unsafe Data

Just like how beatmap objects have their customData properties extracted on load, custom events have their d (data) extracted on load.

On load, all the properties that will be directly on the class are taken off of the d object. The remaining d object is given to the class as unsafeData.

// This is a simplified example of what happens on load

const inputJson = {
    d: {
        duration: 3
    }
}

event.duration = inputJson.d.duration
delete inputJson.d.duration

event.unsafeData = inputJson.d

On save, all the d related properties (such as duration) are recombined with unsafeData.

// This is a simplified example of what happens on save

const outputJson = {
    d: {
        duration: event.duration,
        ...event.unsafeData
    }
}

Clone this wiki locally