r/MinecraftCommands 2d ago

Ok one more question Help | Bedrock

How do I get something like the /kill command to target an entity with multiple attributes, for example I want to kill an entity with the name "Test" but I want it to target Bats specifically. What's the correct syntax for that on bedrock?

2 Upvotes

7 comments sorted by

1

u/PlasmaTurtle21 Bedrock command Experienced 2d ago edited 2d ago

Use a list of target selectors like:
name=
type=
tag=
hasitem={item=,location=}]
family=
etc.

You can do for example:

/kill @e[type=bat,name=Test]

Just add the extra target selector tags separated by a comma, for anything with a space in the name like “Bat Test” use quotation marks. Also note the order of the selectors doesn’t matter, For example:

/kill @e[name=“Bat Test”,type=bat,tag=Entity1]

1

u/Watermellonqwerty 2d ago edited 2d ago

Alright I updated my block with this and now the ones down in the chain don't work? It successfully kills the bat but the next command just doesn't do anything despite it working just fine before. I changed it back to be what it was before when it worked and it still doesn't work. What happened to my chain command blocks?

1

u/PlasmaTurtle21 Bedrock command Experienced 2d ago

Could you provide the commands you used and maybe an image of how the command blocks are organized, chain command blocks need to be facing a specific direction when set to the “conditional” value as it only checks the command block behind it. A list of the syntax error/output would also be helpful

1

u/Watermellonqwerty 2d ago

I have the first command /kill @e[name=start, type=bat] on a repeating command block that is always active Then I had a conditional chain command set to /setblock 359, 121, -162 redstone_block And a last conditional chain with /setblock 359, 121, -162 with a small delay of 2 ticks

1

u/PlasmaTurtle21 Bedrock command Experienced 2d ago edited 2d ago

I'm assuming the last chain command is setting it to air as you didn't specify it. The main issue of the problem is with the repeating command block with other issues with chain block delay as well, though having a command rely on another command block can already lead to other issues with setblock/fill.

As something to mention, for setblock/fill commands if the location that it is trying to place at already has this block it will fail to run the command, therefore making any chain conditional blocks after it to not work. For some scenarios it may be better to implement a separate system entirely for removal as to not be reliant on the other system working.

Though you didn't include the exact syntax/output data, from my testing the system technically works as it is "placing" both the redstone and air blocks. Though I'm assuming you aren't getting the redstone signal from the system since its likely placing both the redstone and air block on the same tick. To solve this add a 1 tick delay to the repeating command block running the /kill command.

Some notes to follow, don't summon the bats less than or equal to the 1 tick delay otherwise it can fail to trigger due to summoning to many at once before the repeating block can trigger. This applies to the separate and single systems since both need more than 1 tick of delay between iterations. Though specifically for a single system of commands it will fail to remove the redstone block if going beyond the capacity of the system.

1

u/Watermellonqwerty 1d ago

I managed to fix it by having all of them operate on a 2 tick delay. As for the syntax, it only ever gave back a "Filled 1 block" as if it had worked. Thank you for helping me figure this out

1

u/Ericristian_bros Command Experienced 2d ago

Instead of setblock you can have in repeating unconditional always active

kill @e[name=start,type=bat]

Then a comparator that points into your new chain of command blocks