Skip to content

Commit f141f1c

Browse files
committed
More work on creating the challenge
1 parent 00a2b8d commit f141f1c

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

docs/custom-backpack/unlock-challenges/creating-the-challenge.mdx

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ sidebar_position: 2
66

77
## Getting Started
88

9-
Unlock challenge are defined in the same file used to [register the backpack](/docs/custom-backpack/register-the-backpack.md#registering). If you have not registered a backpack at this point, what the helly are you doing? Go back! Next you'll want to create a new object called `unlock_challenge` under the root object. This is where the unlock challenge will be defined, which includes an implementation of one of the [challenge types](/docs/custom-backpack/unlock-challenges/challenge-types.mdx), and setting the progress formatter.
10-
11-
The JSON should now look something similar to below:
9+
Unlock challenge are defined in the same file used to [register the backpack](/docs/custom-backpack/register-the-backpack.md#registering). Create a new object called `unlock_challenge` under the root object. This is where the unlock challenge will be defined, which includes an implementation of one of the [challenge types](/docs/custom-backpack/unlock-challenges/challenge-types.mdx), and setting the progress formatter. The contents of the file should now look something similar to below.
1210
```json title="data/<namespace>/backpacked/<your_backpack_name>.json"
1311
{
1412
"unlock_challenge": {
@@ -18,7 +16,25 @@ The JSON should now look something similar to below:
1816
```
1917
## Setting the Challenge
2018

21-
TODO
19+
To set the challenge, start by creating a new object called `challenge` inside of the `unlock_challenge` object. The `challenge` object requires a `type`, which is then followed by an implementation of that type. Select one of the [available challenge types](/docs/custom-backpack/unlock-challenges/challenge-types.mdx) and assign it to the `type` property. For the implementation, it is specific to the type of the challenge. On the list of [available challenge types](/docs/custom-backpack/unlock-challenges/challenge-types.mdx), each challenge will have an **ID**, **Description**, a **table of properties** that can be implemented, and a few **examples** for the challenge type.
20+
21+
Below is an example of the `backpacked:craft_item` [challenge type](/docs/custom-backpack/unlock-challenges/challenge-types.mdx#craft-item). It can be expressed as `The player must craft a total of 64 planks of any type or combination of planks to unlock the backpack`.
22+
23+
```json title="data/<namespace>/backpacked/<your_backpack_name>.json"
24+
{
25+
"unlock_challenge": {
26+
"challenge": {
27+
"type": "backpacked:craft_item",
28+
"crafted_item": {
29+
"tag": "minecraft:planks"
30+
},
31+
"count": 64
32+
}
33+
}
34+
}
35+
```
36+
37+
However based on property table of the [Craft Item](/docs/custom-backpack/unlock-challenges/challenge-types.mdx#craft-item) challenge, `crafted_item` is actually completely optional. Removing this property, the implementation would then be expressed as `The player must craft a total of 64 of any item or combination of items to unlock the backpack`. The `crafted_item` property is simply a filter to match a specific item. It is best to read the **description** of a property on the **property table** to get a full understanding.
2238

2339
## Customise the Progress Formatter
2440

@@ -30,7 +46,9 @@ There are many progress formatters available to use, and it's best to select the
3046
{
3147
"unlock_challenge": {
3248
"formatter": "backpacked:percentage",
33-
...
49+
"challenge": {
50+
...
51+
}
3452
}
3553
}
3654
```

0 commit comments

Comments
 (0)