Trap Example
Template
{
"header": {
"output_type": "here",
"default_state": "trap"
},
"states": [
{
"name": "trap",
"length": 2,
"transitions": {
"1": ["proximity 15"],
"2": ["timer 5"]
},
"commands": {
"2": [
"/playsound custom_trap_sound @a",
"/say You have fallen into my trap!",
"/summon zombie",
"/summon skeleton",
"@s echo:despawn"
]
}
}
],
"entity": "default sirlich:trap"
}
With Comments
{
//Header is normal
"header": {
"output_type": "here",
"default_state": "trap"
},
//Just a single state will do
"states": [
{
"name": "trap",
"length": 2, //We must set length, since the text-list is undefined
"transitions": {
"1": ["proximity 15"], //First, detect the player at 15 blocks
"2": ["timer 5"] //Wait 5 seconds before triggering the trap
},
"commands": {
//Trigger the trap!
//These should probably be moved into a function
"2": [
"/playsound random.xporb @a",
"/say You have fallen into my trap!",
"/summon zombie",
"/summon skeleton",
//Custom command to remove the entity
"@s echo:despawn"
]
}
}
],
"entity": "default sirlich:trap"
}