-1

I have been developing an adventure map in 1.12.2 for quite some time, and decided to upgrade to 1.13+. I created NPC-s who talk when the player approaches them. It works this way:

  • /execute @e[tag=talking_npc] ~ ~ ~ testfor @p[r=2] <- in a repeat, always active command block.

  • A redstone comparator

  • /execute @e[tag=talking_npc] ~ ~ ~ say "Something" <- in a regual, redstone activated command block

This way when the first command block finds a player, it sends a redstone signal to the comparator, which in turn activates the second command block. This way the npc executes the SAY command only once. picture of command block system

My question is that now from 1.13 the testfor command has been removed, I've been trying to create this system with execute command and failed so far. When I approach the npc, the command executes repeatedly, which is obviously not correct. Is there any way to make it post 1.13?

Thanks for the answers in advance!

0

1 Answer 1

0

The /execute command received some new features in 1.13, such as conditional statements ("if" and "unless") which can be used as an equivalent for /testfor. here is the 1.13 version of your commands:

/execute at @e[tag=talking_npc] if entity @a[distance=..2]

/execute as @e[tag=talking_npc] run say "Something"
2
  • This is actually not the problem that the asker has, the question is just confusingly worded. Their problem is executing it only once. Commented Apr 20, 2020 at 1:07
  • I indeed worded the question confusingly, but his answer was what I was looking for! Thanks for the help! :)
    – Xyrusson
    Commented Apr 20, 2020 at 3:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.