Fixed local vars not saving in the advancement complete section thanks to @Fusezion
Example Usage:
on load:
create advancement tab named "quests":
create advancement named "root":
set root to true
# Sets the background of the advancement tab. It only works for root advancements.
# For those who know resource packs, you can use a texture path for more customization instead:
# set background texture to "textures/.../image.png"
set background to birch log
# This is the name that shows on the second line of toasts and when hovering in the advancement menu.
# The root advancement title determines the title shown when hovering over the advancement tab.
set title to "Quests"
set description to "This is the description.", "It can also" and "be a list!"
# Set to 'task' by default.
set frame to goal
# Set the icon of the frame:
set icon to stone pickaxe
# This will let you increment progression as the player does something.
# Example: Each time a player fishes, add 1 to progress of the custom advancement "quests/root" for player
set max progress to 5
# The X and Y values determine the placement of the advancement in the tab.
# X is horizontal (side to size) and Y is vertical (up and down)
set x to 1
set y to 3
# You can set the visibility to: 'shown,' the default value; 'hidden,' to hide the advancement until completion; or 'parent granted,' to hide the advancement until the parent is granted.
# The 'parent granted' visibility option can NOT be used for root advancements.
set visibility to shown
# Options for after completion:
set announcement to false
set toast to true
# The complete section runs when a player completes an advancement. It can be useful for granting rewards easily.
on complete:
give player diamond
# You can use the expressions used above inside of the on complete section.
send formatted "Congratulations! You completed <tooltip:%description%>[%title%]!" to player
if root is true:
send "It was a root advancement!" to player
# Finishes the creation process
build advancement
# Use the same logic for base advancements, but set the parent of the advancement, too.
# Since there's only one advancement in the tab, you would use "quests/root." The format is "tab/advancement"
# set parent to "quests/root"
# If you want multiple parents, you can set it to a list of advancement.
# set parents to "quests/root" and "quests/mine_10_blocks"
build tab