my armour spawns too many entitys

Started by froodbar1000000 on

Topic category: Troubleshooting, bugs, and solutions

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
my armour spawns too many entitys

I want an entity to spawn when wearing a full set of my custom armour but when the entity spawns it spawns it more than once is there an alternative to on player tick

 

 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can just add another…
Thu, 10/26/2023 - 23:20

You can just add another condition to make sure there aren't too many entities in nearby, and/or use randomization to make sure it isn't literally just spawning an entity every game tick. 

To check for entities nearby, you can make a local number variable for your procedure, then use the 'entity iterator' bracket, (found somewhere around the bottom of the world tab), to target all entities in a radius. In this case, inside the bracket, you want to check if the entity iterator, (the currently selected entity), is your custom entity. If it is, you want to increase the local number variable to its current value, +1. Then, you can check if the variable is below a certain number before you actually spawn an entity.

Randomization is even easier; you can just use the 'do with 70% chance' procedure template, but adjust the chance to be very, very small. ('On Player Tick' triggers twenty times per second, just keep this in mind.)