Started by
wowlmao
on
Topic category: Help with Minecraft modding (Java Edition)
I recently saw this youtube video. I want to make a similar feature like how the air raids came in. But I don't know how to Run a piece of code at every player at a timed interval. Basically every 10 minutes an air raid spawns at every player
You could either do this by making a procedure that runs on every player tick, (that is, ticks for each player individually), or every world tick, (that is, ticks for all players simultaneously), depending on what you want. Just keep in mind that you don't want super complex procedures firing every 20th of a second. Make sure the conditions are simple, and if the conditions are met, have it execute a more complicated procedure to spawn the raids.
I thought about that too but the problem is that to count I need to spawn the entity at every players coords so the world tick wouldn't work. Thenif I Incremented the player tick once every time and there was two players it wont work. Even if I divided the increment by the number of players that woiln't work
I'm not entirely sure what you're getting at, but here's a more consise explanation of an idea for how this could work:
If you're doing something every World Tick:
If you're doing it every player tick, (players would then have raids occurring at different times), basically do the same thing, but make the number variable player-persistent instead of world based. (Or player-lifetime, if you want it to reset on death.) Then just trigger your raid relative to that specific player's position.