#simple criteria problem

1 messages · Page 1 of 1 (latest)

boreal wadiBOT
umbral nova
#

What do you mean criteria?

summer turtle
umbral nova
#

So you want an advancement for successfully equipping a certain armor item?

summer turtle
#

but i dont know which trigger i should use to make it work

rocky pivot
#

tick and conditions checking in equipment and Whichever armor piece you want to detect

#

it should give u instantly once u wear the armor oiece

#

piece*

atomic cypress
#

you can use inventory_changed instead of tick and it will be way more efficient

rocky pivot
#

yes

#

you can also do that

summer turtle
#

hm

#

i'll "almoçar" really quick and test it after

summer turtle
#

i'm back

#

it took a while

#
  "criteria": {
    "gold": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "player": {
          "nbt": "{Tags:[\"goblin\"]}"
        },
        "slots": {
          "occupied": {
            "min": 100,
            "max": 103
          }
        },
        "items": [
          {
            "items": [
              "minecraft:golden_helmet",
              "minecraft:golden_chestplate",
              "minecraft:golden_leggings",
              "minecraft:golden_boots"
            ]
          }
        ]
      }
    }
  },
  "rewards": {
    "function": "afterlight:goblin/ggold"
  }
}```
#

like this?

little vortex
#

Occupied tracks the number/amount of slots that are used

#

Are you using the generator Misode made?

#

I would simply check for the armor in player -> equipment

#

Do you want to detect any piece or a full set of golden armor?

You will only detect the latter if you have only a single criterium

summer turtle
#

only a piece

summer turtle
little vortex
#

That, and you need to add the requirements section with a sublist containing all 4 criteria, so any of them counts as completing the entire advancement, regardless of which one it is.

#

the wiki explains as much, but in short.

Criteria: A,B,C,D,E

A or B or C or D or E = [["A","B","C","D","E"]]

(A or B or C) and (D or E) =
[["A","B","C"]["D","E"]]

#

The default is to require all of them

summer turtle
#
  "criteria": {
    "cabeça": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "player": {
          "nbt": "{Tags:[\"goblin\"]}"
        },
        "slots": {
          "occupied": 103
        },
        "items": [
          {
            "items": "minecraft:golden_helmet"
          }
        ]
      }
    },
    "peito": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "player": {
          "nbt": "{Tags:[\"goblin\"]}"
        },
        "slots": {
          "occupied": 102
        },
        "items": [
          {
            "items": "minecraft:golden_chestplate"
          }
        ]
      }
    },
    "pernas": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "player": {
          "nbt": "{Tags:[\"goblin\"]}"
        },
        "slots": {
          "occupied": 101
        },
        "items": [
          {
            "items": "minecraft:golden_leggings"
          }
        ]
      }
    },
    "pé": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "player": {
          "nbt": "{Tags:[\"goblin\"]}"
        },
        "slots": {
          "occupied": 100
        },
        "items": [
          {
            "items": "minecraft:golden_boots"
          }
        ]
      }
    }
  },
  "requirements": [
    [
      "cabeça",
      "peito",
      "pernas",
      "pé"
    ]
  ],
  "rewards": {
    "function": "afterlight:goblin/ggold"
  }
}```
summer turtle
#

actually i have a better idea

onyx vector
#

As Quimoth said, occupied tracks the number of slots that have items in them. Since player inventory is only 41 slots, this condition will always fail

#
{
    "criteria": {
        "eat": {
            "trigger": "minecraft:inventory_changed",
            "conditions": {
                "player": {
                    "equipment": {
                        "head": {
                            "items": "minecraft:golden_helmet"
                        }
                    }
                }
            }
        }
    },
    "rewards": {
        "function": "a"
    }
}```
#

Better would be to use a predicate for the player :

{
    "criteria": {
        "eat": {
            "trigger": "minecraft:inventory_changed",
            "conditions": {
                "player": [
                    {
                        "condition": "minecraft:reference",
                        "name": "a"
                    }
                ]
            }
        }
    },
    "rewards": {
        "function": "a"
    }
}
#
[
    {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
            "nbt": "tags:tags"
        }
    },
    {
        "condition": "minecraft:any_of",
        "terms": [
            {
                "condition": "minecraft:entity_properties",
                "entity": "this",
                "predicate": {
                    "equipment": {
                        "head": {
                            "items": "item"
                        }
                    }
                }
            }
        ]
    }
]
boreal wadiBOT
boreal wadiBOT