#Mobs breaking blocks
1 messages · Page 1 of 1 (latest)
have them scan nearby blocks, path find to, and apply black magic to destroy block
^^^
black magic?
you can just add some fancy particles and set block to air
I dont want it to instantly break the block
My plan is having a hologram above every block in the minigame (not much) and then when a zombie is near it removes 1 of the variable used in the hologram
but how im going to do it
no idea
do you have any idea how to do this
Set a variable at the event location
Then if theres a zombie in a smal radius “damage” it
and how do I check if a zombie is near the event location?
loop in small radius
and how would I do that
with a loop
you should read the docs
loop all %things% in radius x around {_loc}:
yes
seriously these are great resources
alright thanks, I will try to use this to make something now
will check them out
I fixed most of it but I can't figure out how to make a hologram and then link it to the event block without using the list
for example this {placed::turrets::%player's uuid%::*} how do I select the one that was just placed out of there for this set {health::%{placed::turrets::%player's uuid%::*}%}
1 sec
if name of player's held item contains "&3Turret":
add location of block above event-block to {placed::turrets::%player's uuid%::*}
play sound "entity.experience_orb.pickup" at volume 100 at pitch 1 for player
send action bar "&aSuccessfuly placed your turret!" to player
set {health::%{placed::turrets::%player's uuid%::*}%} to 10
set {_holohealth::%{placed::turrets::%player's uuid%::*}%} to new hologram at location block above event-block
set text of holo {_holohealth::%{placed::turrets::%player's uuid%::*}} to "test" in line 0 ```
I want to create a health hologram above but I was getting errors with the list and then when looking at it I got very confused about how lists worked and how I should fix this
im probably doing it completely wrong
the feeling i have (idk if its right) that if I fixed this code with the list and it would work that it would then create new holograms for all of the locations on the list and it would just be completely messed up
Do you know how I do this:
create a hologram above the placed block that shows a variable, and that variable is linked to the location of the block and will be set to 10
.
I got everything to work, I got 2 more questions that have to do with a radius, is it possible to make a minimum? so like atleast 3 block radius away but maximum of 20 blocks away
With conditions
I currently have:
set {_loc} to loop-value-2
set {_loc1} to a random element out of blocks in radius 10 of {_loc}
while y coord of {_loc1} is not y coord of {_loc}:
set {_loc1} to a random element out of blocks in radius 10 of {_loc}
if y coord of {_loc1} = y coord of {_loc}:
spawn zombie at {_loc1}```
this is definetly not the most efficient way to do this but what I am thinking of is something like
```if y coord of {_loc1} is not y coord of {_loc}:
start the loop from the beginning again (idk how to though)```
While a (!)= b:
set a …
So set {_a} to random element from {_list::*} while {_a} != {_list::43}: set {_a} to random element from {_list::*}
I dont understand tbh
While y1 != y2:
set y1
adding a ! before = just means "not equal to"
I get that, but how do I make it not spawn in a radius of 3 blocks
so in a radius of 10 blocks but not 3 blocks, so 3-10 blocks away
if location is within that 3 block radius, try again (find another location within the 10 radius)
alternatively
just add some amount to the location so its outside the 3 block radius
I currently have loop {zombie} times: set {_loc} to loop-value-2 set {_loc1} to a random element out of blocks in radius 18 of {_loc} while y coord of {_loc1} is not y coord of {_loc}: set {_loc1} to a random element out of blocks in radius 18 of {_loc} while distance between {_loc} and {_loc1} is less than 14: set {_loc1} to a random element out of blocks in radius 18 of {_loc} if: y coord of {_loc1} is y coord of {_loc} distance between {_loc} and {_loc1} is more than 14 then: spawn zombie at {_loc1}
but this doesnt spawn all of the zombies
so something is going wrong
well ur issue is that when conditions are not met
the zombie doesnt spawn and you havent tried to spawn another in its place
if {started} is 1:
loop all players:
loop {goldblock::%loop-player's uuid%::*}:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
loop {zombie} times:
set {_loc} to loop-value-2
set {_loc1} to a random element out of blocks in radius 18 of {_loc}
while y coord of {_loc1} is not y coord of {_loc}:
set {_loc1} to a random element out of blocks in radius 18 of {_loc}
while distance between {_loc} and {_loc1} is less than 14:
set {_loc1} to a random element out of blocks in radius 18 of {_loc}
if:
y coord of {_loc1} is y coord of {_loc}
distance between {_loc} and {_loc1} is more than 14
then:
spawn zombie at {_loc1}```
yes
loop {goldblock::%loop-player's uuid%::*}:
remove 1 from {zombie}```
move it outside the loops
the removing 1 on death of zombie works though, it works completely fine if i dont have the: while y coord of {_loc1} is not y coord of {_loc}: set {_loc1} to a random element out of blocks in radius 18 of {_loc} while distance between {_loc} and {_loc1} is less than 14: set {_loc1} to a random element out of blocks in radius 18 of {_loc} if: y coord of {_loc1} is y coord of {_loc} distance between {_loc} and {_loc1} is more than 14 then: spawn zombie at {_loc1} if and while things
you need to reorganise ur loops
since
everything is inside loop all players: loop {goldblock::%loop-player's uuid%::*}:
wait whats {goldblock::%loop-player's uuid%::*}
that is the "starting block" its basically the core of the base the player is trying to protect from the zombies
you can only place one
the issue is ur looping through players so all of that below will be executed per player
this is coop pve right
currently planning on only 1 person
its for a school project
but having it for multiple people wouldnt hurt
ah
right now ur looping all players
so if theres two players one zombie death will -2 from {zombie}
and both players will get money
yea
idk how to change that though
rn the most important thing is fixing that it spawns correctly though
same y level and 14-18 blocks away
is the area flat or na
yea
then dont bother with while y coord of {_loc1} is not y coord of {_loc}:
just set ur y coord for zombie spawn
is there a way to make set {_loc1} to a random element out of blocks in radius 18 of {_loc}
only set z and x
oh nvm
o
i just realised
what did you realise
radius is scanning in a sphere right
set {_loc1} to a random element out of blocks in radius 18 of {_loc}
while distance between {_loc} and {_loc1} is less than 14:
set {_loc1} to a random element out of blocks in radius 18 of {_loc} <--- This overrides y-coord from above```
yeah I got that
ok then u know how to fix right
bruh
it was this easy all along
(i know how to fix it from the code u sent but quickly deleted lol)
it works now tysm
wait what
what
u sent code and put while in while but quickly deleted it right?
huh
so whats ur code now?
set {_loc1} to a random element out of blocks in radius 18 of {_loc}
while distance between {_loc} and {_loc1} is less than 14:
set {_loc1} to a random element out of blocks in radius 18 of {_loc}```
damn
when i copied the indentation was broken
it worked for some waves but now it didnt work for 1
but that was the actual answer LMAO
haha
btw u can make it simplier
lmao
it worked for 3 waves
and last wave it had 1 {zombie} left
and this wave it has 4 {zombie} left
now im gonna figure out how to make this work for coop
wait no I gotta fix this first
isntead of the while loop to check y coord
just do
set {_loc1} to a random element out of blocks in radius 18 of {_loc}
set y-cord of {_loc1} to y-cord of {_loc}```
ah yes
ty
im very confused on why it doesnt work now
1 sec lemme test it from the start of the game
first wave its supposed to spawn 8
it only spawns 2
so something with the spawning is still wrong
its the set y coord that doesnt work
set y-coord of {_loc1} to y-coord of {_loc}
I have no idea how to do this
do you have any idea?
all I want is a wave system that spawns zombies and progressively spawns more
Couldnt you just where [input’s y-coord = …]?
And that way it’s circular not spherical so its more even
wait what
set {_loc1} to a random element out of blocks in radius 18 of {_loc} where input's y-coord = ...
that?
ive been trying for a while and have no idea h ow to fix this can you please help me
You can put a condition in the same line as the loop
loop all players in radius 5 around {_loc} where [input’s tool is a diamond]:
Input is what youre looping; player entity block whatever
So you can filter out blocks that are not on the same y-level
where [input’s y-coord = {_loc}’s y-coord]:
its been a while but im back at this
how would I implement that in spawning x amount of zombies in a 8-12 block radius at the same y level
but thats only for looping right?
I currentky have
loop {zombie} times:
set {_loc} to loop-value-2
set {_loc1} to a random element out of blocks in radius 12 of {_loc}
but no idea how to change that so its in a 8-12 block radius at the same y level
@uneven mirage
Ok
I assume you dont want ALL the code but just this part of the code
#on death of zombie:
if {started} is 1:
loop all players:
loop {goldblock::%loop-player's uuid%::*}:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
loop {zombie} times:
wait
Use code format please.
the # is messing it up
#on death of zombie:
# if {started} is 1:
# loop all players:
# loop {goldblock::%loop-player's uuid%::*}:
# remove 1 from {zombie}
# add 50 to {gold::%loop-player's uuid%}
# broadcast "%{zombie}%"
# if {zombie} = 0:
# wait 10 seconds
# add 1 to {wave}
# send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
# set {zombie} to ({wave} * 4)
# loop {zombie} times:
Ok there
oh yea
So what does not work
so
after loop zombie times I want it to spawn {zombie} zombies in a radius of 8-12 blocks on the same y level as {goldblock::%loop-player's uuid%::*}
Why the #? Just asking
The code didnt work and gave lots of errors, so I just completely blocked it out and continued on other parts of the game im creating
Oh ok
loop all blocks in radius 5 around {goldblock::%loop-player's uuid%}:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
spawn {zombie} zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop
Like that?
If I understand correctly this will spawn {zombie} zombies at loop block, so if {zombie} is 11 it will spawn 11 zombies at the loop block and then remove only 1 from zombie
Or am I wrong there
Yeah
I want it to be like a wave of zombies
Ill give context. It has like waves of zombies and then after a wave is done it waits 10 seconds and spawns a little more zombies then the last wave and they all pathfind to {goldblock::%loop-player's uuid%::*} (still gotta figure out how to do that)
Okay ill try that
Already did
if {started} is 1:
loop all players:
loop {goldblock::%loop-player's uuid%::*}:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
>>>>>>>>**wait 10 seconds**<<<<<<<<<<<<<
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
loop {zombie} times:```
it has a delay of 10 seconds between each wave
Does each player have more than 1 gold block?
no
Its currently not even made for multiplayer
id have to change a lot to make it work
It's just unwanted in this case
I see that yeah
Do you want me to send everything? like also everything i tried
Just the full code of this event
btw I tried your code and this is just not spawning any zombies:
if {started} is 1:
loop all players:
loop {goldblock::%loop-player's uuid%::*}:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
loop all blocks in radius 5 around {goldblock::%loop-player's uuid%}:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
spawn zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop```
its REALLY messy but this is the code with everything i tried to make it work:
# if {started} is 1:
# loop all players:
# loop {goldblock::%loop-player's uuid%::*}:
# remove 1 from {zombie}
# add 50 to {gold::%loop-player's uuid%}
# broadcast "%{zombie}%"
# if {zombie} = 0:
# wait 10 seconds
# add 1 to {wave}
# send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
# set {zombie} to ({wave} * 4)
# loop {zombie} times:
# set {_loc} to loop-value-2
# set {_loc1} to a random element out of blocks in radius 18 of {_loc}
# while true:
# if:
# distance between {_loc} and {_loc1} is less than 14
# y coord of {_loc1} is not y coord of {_loc}
# then:
# set {_loc1} to a random element out of blocks in radius 18 of {_loc}
# else:
# spawn zombie at {_loc1}
# while true:
# if:
# distance between {_loc} and {_loc1} is less than 14
# y coord of {_loc1} is y coord of {_loc}
# then:
# set {_loc1} to a random element out of blocks in radius 18 of {_loc}
# else:
# set {_loc1} to a random element out of blocks in radius 18 of {_loc}
# wait 5 second
# if:
# y coord of {_loc1} is y coord of {_loc}
# distance between {_loc} and {_loc1} is more than 14
# then:
# spawn zombie at {_loc1}```
on death of zombie:
if {started} is 1:
loop all players:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
loop all blocks in radius 5 around {goldblock::%loop-player's uuid%}:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
spawn zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop
Ok here better version
Also the code of course won't work
Guess why? Look at the condition if {zombie} = 0
What is this for?
Oh nevermind
I understand now
currently waiting the 10 seconds for this code
on death of zombie:
if {started} is 1:
loop all players:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
broadcast {zombie}
loop all blocks in radius 5 around {goldblock::%loop-player's uuid%}:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
broadcast "&cSpawned Zombie"
spawn zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop
Try this and tell what does it broadcast
I was already trying the same thing, but I was dumb I named it all a
ill check thjat
Btw that will make the player continue to next wave each time he kill ONE zombie
it broadcasted nothing
is {started} = 1?
the waves are working and the killing is working and the titles are working only the spawning isnt
thats from a different thing
that basically means the game has started
well how does it broadcast nothing?
on death of zombie:
if {started} is 1:
loop all players:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
broadcast "Zombies: %{zombie}%"
loop all blocks in radius 5 around {goldblock::%loop-player's uuid%}:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
broadcast "&cSpawned Zombie"
spawn zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop
What does this broadcast?
Does it spawn though?
Ok I see
ig the loop all blocks in radius 5 around {goldblock::%loop-player's uuid%}:
isnt working
on death of zombie:
if {started} is 1:
loop all players:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
broadcast "Zombies: %{zombie}%"
broadcast "%{goldblock::%loop-player's uuid%}%"
loop all blocks in radius 5 around {goldblock::%loop-player's uuid%}:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
broadcast "&cSpawned Zombie"
spawn zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop
We can check if it set or not
<none>
lemme check the code for that
hmm
something is going very wrong
the variable isnt set anywhere else in the code
1 sec
oh nvm thats because its loop-player
ohhh
its because its set as " add location of event-block to {goldblock::%player's uuid%::*}"
changed the code to this
Your probably not gonna like it and want me to changhe it but it broadcasts something now:
on death of zombie:
if {started} is 1:
loop all players:
loop {goldblock::%loop-player's uuid%::*}:
remove 1 from {zombie}
add 50 to {gold::%loop-player's uuid%}
broadcast "%{zombie}%"
if {zombie} = 0:
# wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
broadcast "Zombies: %{zombie}%"
broadcast "%loop-value-2%"
loop all blocks in radius 5 around loop-value-2:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
broadcast "&cSpawned Zombie"
spawn zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop```
That explain much
Use set {goldblock::%player's uuid%} to location of event-block
List variable isn't needed
Currently checking if this works
this code is probably way more optimized then the code I had before, but it actually works kinda worse
rn after the zombies are spawned it sets {zombie} to 0 although {zombie} is supposed to be the amount of zombies currently alive
got that to work using this
set {zmombie} to {zombie}
loop all blocks in radius 13 around {goldblock::%loop-player's uuid%}:
if y-coord of loop-block is equal to y-coord of {goldblock::%loop-player's uuid%}:
broadcast "&cSpawned Zombie"
spawn zombie at loop-block
remove 1 from {zombie}
if {zombie} is 0:
exit loop
set {zombie} to {zmombie}```
Time to use temp vars
it all works good now, except for that it spawns like this
set {_zombie} to {zombie}
...
remove 1 from {_zombie}
if {_zombie} is 0:
exit loop
every wave is just a line of zombies instead of a circle around the block
That's odd
Maybe change the condition to
if rounded y-coord of loop-block is equal to rounded y-coord of {goldblock::%loop-player's uuid%}:
Or maybe because the radius is too much
Try looping in lesser radius like 3?
And check if it go in circle shape
OK lets use vectors
so like the white in this picture
I used that once before
loop all players:
loop {placed::turrets::%loop-player's uuid%::*}:
set {_player} to loop-player
loop all mobs in world of {_player}:
if loop-entity-2 is arrow:
stop
if loop-entity-2 is small fireball:
stop
if loop-entity-2 is not {_player}:
set {_vector} to vector between loop-value-2 and loop-entity-2
shoot an arrow from loop-value-2 with speed 0.6 {_vector}```
Thats unrelated to this tho
You want it to be in circle shape don't you?
So the circle isn't filled
Only the edges of the circle are filled
Welp it won't be filled cause there's not MUCH zombies
For example it need 120 zombie to be filled but you're spawning only 20
testing out what it does at wave 50
at wave 50 it just spawns a circle
like a complete circle of zombies
set {_zombie} to {zombie}
loop (180 * 10) times:
set {_v} to spherical vector radius 10, yaw (loop-value*2*10), pitch 0
spawn zombie at {goldblock::%loop-player's uuid%} ~ {_v}
remove 1 from {_zombie}
if {_zombie} is 0:
exit loop
Try this
Fix the indentions though
indentions?
Nvm
tbh
I dont understand this code
and also have no idea where to place it
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
broadcast "Zombies: %{zombie}%"
broadcast "%{goldblock::%loop-player's uuid%}%"
set {zmombie} to {zombie}
loop all blocks in radius 13 around {goldblock::%loop-player's uuid%}:
if rounded y-coord of loop-block is equal to rounded y-coord of {goldblock::%loop-player's uuid%}:
broadcast "&cSpawned Zombie"
spawn zombie at loop-block
wait 1 tick
remove 1 from {zombie}
if {zombie} is 0:
exit loop
set {zombie} to {zmombie}```
where in this do I place the code?
and doesnt this just spawn 1800 zombies? or why do you loop it 180*10 times
It just generate circle of radius 10
As you see if it spawned the required amount of zombies it will stop
You could change the radius though
if {zombie} = 0:
wait 10 seconds
add 1 to {wave}
send title "&8» &c&lWave %{wave}%" to attacker for 3 seconds
set {zombie} to ({wave} * 4)
broadcast "Zombies: %{zombie}%"
broadcast "%{goldblock::%loop-player's uuid%}%"
set {_zombie} to {zombie}
loop (180 * 10) times:
set {_v} to spherical vector radius 10, yaw (loop-value*2*10), pitch 0
spawn zombie at {goldblock::%loop-player's uuid%} ~ {_v}
remove 1 from {_zombie}
if {_zombie} is 0:
exit loop
Like that
Can't understand this condition/effect: set {_v} to spherical vector radius 10, yaw (loop-value210), pitch 0
UHH
it just spawned a ton of zombies and {zombie} is at -1275
oh no
I messed upp
alright I got the old code back
I accidently deleted a lot of code
but yeah this really doesnt work
first I got 2 errors and then it spawned 1,2k zombies
What errors?
this one
and for some reason the exit loop was wrong
Ok lemme try
nvm i see what the problem was with exit loop
i was supposed to delete 4 spaces but only deleted 2
Lol ok
so thats mb
How many loops are there?
Change to loop-value-2
loop all players
loop all blocks
alright
OMG
IT WORKSSS
ima try wave 50
it spawns in like groups of zombies, but it works so im not complaning
complaining
tysm
Send picture?
alright 1 second
the single zombies you see are just lots of zombies in 1 spot
now its time to figure out how to make them pathfind
brb
There's an effect for that
back
cant seem to make it pathfind to the variable {goldblock::%loop-player's uuid%}
yea i have no idea how to make it pathfind
What did you try
lots of different things
most just trying to make {goldblock::%loop-player's uuid%} work
{goldblock::%loop-player's uuid%} is x: .., y: .., z:..., yaw: 0, pitch: 0 in 'world'
thats how its noted
any chance you know how to make this work?
Gotta use a while loop in a separated function and wait a delay of 2 seconds in the loop then set path target of the zombie to the location
use skbee, and as DSA said, have a loop
if you tell it to pathfind only once, it's gonna do that but then the zombie might decide to stop
is there a way to stop mobs from jumping?
currently have
while event-entity is alive:
push event-entity downwards at speed 0.5
wait 1 tick```
it works
if u have something better lmk
Probably the worst way to do it
Isn't on jump a thing
On jump
If entity is a zombie. Amsd "yay" cancer
Cancel
On jump is called for players
Ah
Use on entity jump
Ty
I know lol
on jump
^^