Make entity say something once when setting attack target.

Started by moffmoth1 on Sat, 04/23/2022 - 22:54

Topic category: Help with MCreator software

Last seen on 04:43, 27. May 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Make entity say something once when setting attack target.
Sat, 04/23/2022 - 22:54

Hello!

I have my code set up so that, upon a custom entity spotting a player and choosing to attack, it plays a sound. However, it rapidly plays it as long as it's attacking the player and I can't seem to make it stop. I want it to only happen once per player it attacks.

Last seen on 20:29, 24. Jun 2022
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
First calculate the length…
Sun, 04/24/2022 - 05:36

First calculate the length of the sound in ticks, then in the same procedure add the blocks - wait <#> ticks, and insert <execute command [stopsound ... your_custom_sound}

Last seen on 04:43, 27. May 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I have three sounds in the…
Sun, 04/24/2022 - 18:55

I have three sounds in the soundbank for it. I want it to only play once per time the entity sets its sights on a player. Something like this:

Entity sees Player
Entity plays sound once
Entity is hit by skeleton, changing attack target
Entity does not play sound
Entity kills skeleton
Entity re-sees Player
Entity plays sound once

I have it working, except the sound plays each tick that the entity has its eyes on the player.

Last seen on 19:47, 23. Jun 2022
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Have an nbt that turns to…
Sun, 04/24/2022 - 19:06

Have an nbt that turns to true if it is focused on player, and false if it isnt. If focused on the player, play the sound then turn it true.

Last seen on 04:43, 27. May 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Like this? Because still no…
Sun, 04/24/2022 - 19:14

NBT code; not working.

Like this? Because still no luck.

Last seen on 04:43, 27. May 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Update! I got it working, it…
Sun, 04/24/2022 - 19:57

Update! I got it working, it just doesn't re-play the sound if the entity changes targets and then back to the player. Still! This is great!!