Advanced functions - Kalendarz2/Ultimate-Player-Recorder GitHub Wiki
A collection of tutorials for creating advanced animations.
TBD
Some situations require recording multiple animations at the same time. If you want to create fighting or racing NPCs, animation synchronization comes in handy.
In order to synchronize 2 or more animations, you have to record a regular animation and execute a sync event at the time you want your other animations to begin.
Then, start recording a new animation and set the start trigger setting to sync
. After signing the book, the recording will not start automatically. Play your last animation on any entity. When it executes a previously recorded sync event, recording of your new animation will begin.
Your animations are now synchronized, however you still need to start them both at the same time. You can do it by using the events section in the editor.
Open your first animation (the one that executed the sync event) in the editor and find the frame with the event (purple particles should appear above the armor stand). While in the event editor, delete the sync event
and add a new command. You can start the animation however you want, but in most cases this command will be sufficient:
scoreboard players set <Your entity> animation <ID of your second animation>
If you have recorded multiple animation with the same sync event, duplicate this command for each subsequent animation.
To play your animations, summon an entity for each animation and play only the first recorded one. If you have set everything up correctly, the rest should begin automatically.
An example of 2 synchronized animations (alpha 0.6 teaser)
TBD
TBD
TBD
TBD
The datapack includes tools for map makers to automatically perform some of the built-in functions and record dynamic animations while playing the map. API can be used to record player's movement path in racing maps, create security cameras showing the player in the past, record mobs during battles, save and playback player builds, and much more.
To receive debug info related to API mode, give yourself the rc_debug
tag. After completing a map that uses this feature, do not delete the MovementRecord
datapack, but use the command /function rc:api/enable
. This will disable all trigger commands and notifications, thereby hiding the existence of the datapack from the player.
You can check if a given ID is occupied using:
scoreboard players set $id rc_id <Your ID>
function rc:api/check_id
This function will return a value on the fake player $id_out rc_id
of 0, if the ID is free, and 1 if in use. For example:
scoreboard players set $id rc_id 4
function rc:api/check_id
execute if score $id_out rc_id matches 1 run say Id 4 is occupied
If you want to include ID's that are being recorded at the time of executing the command, use function rc:api/check_id_extended
instead.
You can record simultaneously up to 10 players or entities. There are 2 ways to do so using the API.
- By using a
record
scoreboard on the entity. A value of 1 will automatically select an available id. To stop recording, set the scoreboard again to any value. - By setting the
$id rc_id
fake player value to your id (or 1 to generate automatically) and running afunction rc:api/record/start
command as your entity. To stop recording, usefunction rc:api/record/stop
.
The second option is more reliable and has more functionality. In this method, you can change the animation settings before you start recording by adjusting the minecraft:animation RecordAPI
storage values. All available settings with their default values:
{Name:"Missing Name",Loop:0,Relative:0,Beginning:0,Manual:0,Frequency:0,Reverse:0,Speed:0,Interpolation:0,Position:1,Rotation:1,Item:1,Placed:1,Broken:1,Spawned:1,Sneaking:1}
Detecting placed and destroyed blocks (Placed
, Broken
) significantly impacts performance, so it is recommended not to use it excessively. Unspecified settings will be taken from minecraft:animation DefaultSettings
storage.
An example of a looped animation that does not record placed or destroyed blocks:
scoreboard players set $id rc_id 4
data modify storage minecraft:animation RecordAPI set value {Loop:1,Placed:0,Broken:0}
execute as @e[type=villager] run function rc:api/record/start
...
(After x ticks)
...
execute as @e[type=villager] run function rc:api/record/stop
An example of a named animation that records only movement and rotation:
scoreboard players set $id rc_id 1
data modify storage minecraft:animation RecordAPI set value {Name:"Walk",Position:1,Rotation:1,Item:0,Placed:0,Broken:0,Spawned:0,Sneaking:0}
execute as @e[type=armor_stand] run function rc:api/record/start
...
(After x ticks)
...
execute as @e[type=armor_stand] run function rc:api/record/stop
You can detect if an entity or player is recording an animation by checking for is_recording
tag. function rc:api/record/stop
returns the ID of the just recorded animation on the fake player $id_out rc_id
.
To delete an animation, use the following commands:
scoreboard players set $id rc_id <Your ID>
function rc:api/delete
To remove all available animations, set the rc_id
scoreboard to a negative number.
You can copy an existing animation by using:
scoreboard players set $id rc_id <Your ID>
function rc:api/copy
To paste the copied animation, use:
scoreboard players set $id rc_id <Your ID, or "1" for auto>
function rc:api/paste
This function will also return the ID on which the animation was pasted, and set it on the fake player $id_out rc_id
.