How do i make a mob despawn when i get near it?

Started by One_and_Online on

Topic category: Help with MCreator software

Last seen on 22:22, 26. Jan 2024
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do i make a mob despawn when i get near it?

So i wanted to create herobrine, so i made a procedure that should make him despawn when i get into a 25 block radius around him. Here's the procedure i used:

 

OnInitialEntetySpawn
repeat [infinite] times

- if does entity exist at: x: [x] y: [y] z: [z] in square cube with size [25] of type [player]

- - play at x: [x] y: [y] z: [z] level: [1] pitch: [1] category: [neutral] sound: [ambient.cave]

- - Despawn Event/Target entety

- - [break out] of loop

- if-then end

repeat end

 

Thats how it logically should work in my opinion, but it does not for some reason. it only does when i spawn him right next to me.

 

Can someone please help me?

Last seen on 22:21, 18. May 2024
Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Don't use on initial entity…
Fri, 01/28/2022 - 18:10

Don't use on initial entity spawn, use on entity tick update and do not use repeat.

 

On entity tick update:

- if does entity exist at: x: [x] y: [y] z: [z] in square cube with size [25] of type [player]

- - play at x: [x] y: [y] z: [z] level: [1] pitch: [1] category: [neutral] sound: [ambient.cave]

- - Despawn Event/Target entety

Last seen on 15:19, 14. May 2024
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If this issue has not been…
Sun, 01/30/2022 - 00:31

If this issue has not been resolved, you can check out the example I've created on my website for download! There are two examples, and two procedures.
On has a Tick Timer, while the other is just on player tick update.
You can download and import them into your MCreator software!

[ View Website ]

[ Virus Total Report ] : Entity_Despawn_Timer.zip
[ Virus Total Report ] : Entity_Despawn_NoTimer.zip

File > Import workspace from shareable zip...
Find "Entity_Despawn_Timer.zip" or "Entity_Despawn_NoTimer.zip"
Or Import the procedure directly by:
Going to your created procedure > Import procedure...
Find "Entity_Despawn_Procedure.ptpl" or "Entity_Despawn_Procedure_NoTimer.ptpl"

I noticed after adding a new entity, right after creating the procedures,
I had to remove the "Does entity exist..." and "Get nearest entity...", and re-add them with the new entity.

If you need more help, consider checking out my profile to email me.