Started by
FluvKii
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a boss that spawns minions and make a sound when spawning them using a timer. The sound does play but the minions don't spawn. Can anyone help me with this?
It would be easier if I could see the code. However, the basic idea is that you need some sort of timer, (which I assume you've gotten working if the sound works), and then you need to randomly spawn additional entities around the boss. There's a 'spawn entity' function, one for normal spawning, another that allows you to spawn them with velocity. (If you wanted to, say, launch them outwards from the boss.) You could do the timer with an incrementing NBT number tag for the boss, (which you decrease by one every update tick, and reset when it reaches zero and spawns minions), or if there's only ever going to be one such boss at a time, you could do the same thing with a global number variable.
The simplest method for spawning is to make some local variables for offset, and set them to random integers every time you spawn a minion, so they spawn with random x/z offset from the boss. You may want to also check that the position they're trying to spawn isn't, say, inside a wall, on top of a player, etc.
https://drive.google.com/file/d/14NJJ5JrI7JZdy9JOXq15xm73e0ogPWyv/view?usp=sharing
here are some screenshots of the timer
Your timer looks like it should work correctly. I'm not sure then why the minions wouldn't be spawning. Do you have an additional procedure to despawn them after a certain duration?
I don't
Don't know what the problem is then; if you're hearing the sound effect periodically, the timer is working. You could also try executing a /summon command if you think the spawning process is somehow to blame, but that really shouldn't make a difference. Have you tried summoning the minions normally, without a boss present?
i've already tried it with the command and it didnt work either. and i spawned the minions manually and they spawned just fine
That's quite unusual. So you're saying you can spawn them in-game using a command, but not using a function, or a function that runs a command? And there isn't anything else that could possibly be causing them to despawn? (Low render distance, plugin interferance, the boss attacking them, low tracking distance or size, etc?)
If that's the case, It's possible there's something wrong with the way it's compiling the code, and it might be worth regenerating the code, or reloading the gradle project, which you can do from the 'build & run' menu. (Just to make sure it isn't just a corrupted cache or something.) You could also try using the other 'summon entity' function, the one that uses velocity instead of yaw. There's also a possibility, if you're using the newest release of MCreator, that this is some sort of unresolved bug, and if you've tested it thoroughly and can't find a way to fix it, it may be worth reporting on the issue tracker. Otherwise, I really don't know what to tell ya. :(
I just discovered that this aparently also doesn't work with explosions and particles.. :(
That's... really weird. What version of MCreator are you using? This stuff should definitely be working first try. Definitely try reloading the gradle caches.
(This is probably really dumb, but have you also checked your difficulty isn't set to peaceful, and your particles are enabled? I have separately spent several hours debugging things where it turns out I just forgot to change the difficulty/reenable particles.)
i always put my difficulty on hard when testing my mod and i am using version 2023.4, im probably gonna download 2024.1 soon