Check If a Do Procedure worked

Started by guy.24 on

Topic category: Help with modding (Java Edition)

Last seen on 15:36, 9. Dec 2020
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Check If a Do Procedure worked

Im new to this and i don't know if this is the right place for this but here i go. I want to make a item when right clicked it will kill a entity in a radius then give the player a item. What i made was If a player is holding item then Do kill the entity in a radius, and i want a procedure to activate only if i killed that entity. Any ideas?

And sorry for my bad grammar

Last seen on 00:30, 24. Aug 2023
Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You might have to wait on…
Sun, 06/14/2020 - 07:16

You might have to wait on this one. If you look in MCreator's changelog, you can see that they are actually adding a block for just this purpose that can detect entities in a given radius. Unfortunately, you will at least have to wait until the snapshots to use that feature. Without this, I don't know of any way to accomplish what you're asking.

Last seen on 04:13, 19. Jun 2023
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can easily do that by…
Sun, 06/14/2020 - 07:43

You can easily do that by creating a logic global variable that will be true when right clicking the item, then you need a procedure on player tick update that will get players coordinates and save them as number global variables PosX, PosY and PosZ. Then on this entity on entity tick update verify if player is near by the mathmatical distance formula in 3 dimensions (easily find on google) and if the logic global variable is true, then kill the entity.

Last seen on 15:36, 9. Dec 2020
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks
Sun, 06/14/2020 - 23:54

Thanks