How to make entity teleport slightly closer to the player, wait about 8 seconds, then teleports slightly closer again

Started by AgPixie on

Topic category: Help with modding (Java Edition)

Last seen on 22:27, 20. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make entity teleport slightly closer to the player, wait about 8 seconds, then teleports slightly closer again

I'm making an entity and I'm not sure how to make it teleport slightly closer to the player not to where it teleports ON the player, just near the player, then if the player doesn't move away from the entity it WILL teleport on the player and kill them. I'm making an SCP-173 entity

 

Please someone help me with this. I'd very much appreciate it.

Last seen on 21:33, 21. Feb 2024
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In general, a good way of…
Thu, 01/04/2024 - 03:24

In general, a good way of doing this is getting the average (or weighted average) of your entity's position and the player's position.

Something like:

set X to ( ( ( player X * 2 ) + ( entity X * 3 ) ) / 5 )

(then same with Y and Z)

would teleport the entity 2/5 of the way to the player.

Last seen on 22:27, 20. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you for replying…
Wed, 01/24/2024 - 02:44

Thank you for replying. Where do I put the code, in the Entity's AI page or do I create a procedure?

Last seen on 22:27, 20. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also could you give a more…
Wed, 01/24/2024 - 02:45

Also could you give a more specific line of code?

Thank you