How can I make it so when I walk near a command block, it spawns one mob in a certain area? I'm trying to make an adventure map, so I want mobs to spawn around the corner when you near it. I don't want to use pressure plates, but instead like a radius type thing if that makes sense. Thanks for any help!
Start with a repeating command block on always repeat that has
execute if @a[distance=r]
where r is the distance away from the command block. Then put a comparator measuring that command block facing outward, and put a default command block next to it with the summon command. Then every time that you walk within r blocks of the repeating command block, the default command block will run once and summon a mob. If you wanted it to only work once, you could make the signal from the comparator go to a repeater signal lock. this picture should help explain if I didn't already:
First, edit the spawner detection radius, then edit the "Pos" tag in the spawner's entity nbt. The entity will spawn at the Pos coords. If you want me to explain deeper, just tell me!
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Well, you could place a repeating block under the spawner then use a /fill command to break both the spawner and the repeating block if it detects a spawned entity (so it'll no longer run, which is always better)
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Edit: I figured out a way to make the mobs spawn like I want, but there's still a small issue. What I did is I spawned a spawner in a wall and made the spawning distance 1 so they are forced to spawn right infront of the block. When that happens, the mob spawns on a pressure plate with 2 command blocks under. One command block replaces the spawner with whatever block the wall is, while the other replaces the pressure plate with air. Only problem with this is that the mobs don't spawn immediately, or at least quickly. Is there a way to speed up the spawning? Here's my command (if you try this, you may need to change the coords)
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Spawn time is set with "MinSpawnDelay" and "MaxSpawnDelay"
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I guess 1 would be the fastest but you could try 0 if it works as well
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
How can I make it so when I walk near a command block, it spawns one mob in a certain area? I'm trying to make an adventure map, so I want mobs to spawn around the corner when you near it. I don't want to use pressure plates, but instead like a radius type thing if that makes sense. Thanks for any help!
One way you could do that is probably like this:
Start with a repeating command block on always repeat that has
where r is the distance away from the command block. Then put a comparator measuring that command block facing outward, and put a default command block next to it with the summon command. Then every time that you walk within r blocks of the repeating command block, the default command block will run once and summon a mob. If you wanted it to only work once, you could make the signal from the comparator go to a repeater signal lock. this picture should help explain if I didn't already:
How does the other command block activate when you're near it? Like, how does the repeating command block activate the impulse one through redstone?
You could do this simply with spawners!
First, edit the spawner detection radius, then edit the "Pos" tag in the spawner's entity nbt. The entity will spawn at the Pos coords. If you want me to explain deeper, just tell me!
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Can I make it so it only spawns one?
Edit: I found a website that does spawner commands for you. I'm gonna try that!
Alright, so the spawner is working, but is there any way I can make it so when an enemy spawns, the block breaks right after?
Well, you could place a repeating block under the spawner then use a /fill command to break both the spawner and the repeating block if it detects a spawned entity (so it'll no longer run, which is always better)
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
What would the command for that be?
(Sorry, I'm somewhat new to command blocks haha)
Edit: I figured out a way to make the mobs spawn like I want, but there's still a small issue. What I did is I spawned a spawner in a wall and made the spawning distance 1 so they are forced to spawn right infront of the block. When that happens, the mob spawns on a pressure plate with 2 command blocks under. One command block replaces the spawner with whatever block the wall is, while the other replaces the pressure plate with air. Only problem with this is that the mobs don't spawn immediately, or at least quickly. Is there a way to speed up the spawning? Here's my command (if you try this, you may need to change the coords)
/setblock 181 67 -110 spawner{SpawnData:{id:skeleton,CustomName:"\"Skeleo\""},SpawnRange:1,SpawnCount:1,MaxNearbyEntities:30,Delay:1,MinSpawnDelay:1,MaxSpawnDelay:1,RequiredPlayerRange:16} replace
You can set any spawn coord with the "Pos" tag :
/setblock 181 67 -110 spawner{SpawnData:{id:skeleton,Pos:[10.0,5.0,2.0],CustomName:"\"Skeleo\""},SpawnCount:1,MaxNearbyEntities:30,Delay:1,MinSpawnDelay:1,MaxSpawnDelay:1,RequiredPlayerRange:16} replace
Here, the mob will spawn at x=10,y=5,z=2
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Do you think that'd also increase spawn times? Or is it going as fast as it can?
Spawn time is set with "MinSpawnDelay" and "MaxSpawnDelay"
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
So it being set to 0 or 1 would be the quickest it could possibly go?
I guess 1 would be the fastest but you could try 0 if it works as well
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).