Boss ain't spawning on my game Zombie Survivors W.I.P

id: 750241

category: Help with Scripts

posts: 21

toad_duzz toad_duzz loading
heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
MineTurte MineTurte loading

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Oh god. You again (no offense lol). Luckily I have more time this time to look at it in detail. Hold on one second while I take a look at it!
toad_duzz toad_duzz loading

MineTurte wrote:

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Oh god. You again (no offense lol). Luckily I have more time this time to look at it in detail. Hold on one second while I take a look at it!







alright, take your time!
MineTurte MineTurte loading

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Okay I genuinely can't find out what's wrong and everything seems to be working fine but I'll just completely rewrite your code and hope it works better. One second
toad_duzz toad_duzz loading

MineTurte wrote:

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Okay I genuinely can't find out what's wrong and everything seems to be working fine but I'll just completely rewrite your code and hope it works better. One second


wait so does it look fine but it doesn't work or does it look fine and you verified that it works
also I changed something that was wrong I forgot to change earlier so you should probably refresh
MineTurte MineTurte loading

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Okay I genuinely can't find out what's wrong and everything seems to be working fine but I'll just completely rewrite your code and hope it works better. One second


wait so does it look fine but it doesn't work or does it look fine and you verified that it works
also I changed something that was wrong I forgot to change earlier so you should probably refresh
Did you just fix it because it looks exactly how I was about to make it lol
Malicondi Malicondi loading

toad_duzz wrote:

alright, take your time!
Alright, I was able to make the boss spawn naturally and I figured out the problem (it took around 3x as long as it should, I'll explain why). So, since you have all 3 different zombies resetting the timer to increase their difficulty, they get out of sync, and then only one zombie will increment at a time. For example, the electro zombie will increase difficulty by one, then the normal then the big zombie, and all of that would take ~60 seconds, much longer than it should.

The solution to this is to have one zombie controlling the reset timer, and broadcasting to all the other zombies to increase difficulty, and that one zombie will also spawn the boss.

Hope this helps! fun game btw :)
toad_duzz toad_duzz loading

Malicondi wrote:

toad_duzz wrote:

alright, take your time!
Alright, I was able to make the boss spawn naturally and I figured out the problem (it took around 3x as long as it should, I'll explain why). So, since you have all 3 different zombies resetting the timer to increase their difficulty, they get out of sync, and then only one zombie will increment at a time. For example, the electro zombie will increase difficulty by one, then the normal then the big zombie, and all of that would take ~60 seconds, much longer than it should.

The solution to this is to have one zombie controlling the reset timer, and broadcasting to all the other zombies to increase difficulty, and that one zombie will also spawn the boss.

Hope this helps! fun game btw :)

Oh my god, I was thinking about fixing that but I got lazy. It's there because I copy and pasted the zombies and just changed the code from there for different types without seeing a reason to clean it like that. Didn't realize it actually would become out of sync. Cheers to you for striking this one right in the eye, my friend.
Malicondi Malicondi loading

toad_duzz wrote:

Oh my god, I was thinking about fixing that but I got lazy. It's there because I copy and pasted the zombies and just changed the code from there for different types without seeing a reason to clean it like that. Didn't realize it actually would become out of sync. Cheers to you for striking this one right in the eye, my friend.
Also, if you're wondering why this is case, one thing you should know is scratch runs scripts in an order, so it might do the normal zombies first, then the electro etc. This is because scratch runs the scripts in order of the layers the sprites are on, so if the normal zombie sprite is at the front layer, then all it's scripts will run first.

Also not sure if this was intentional or not, but a little nitpick I had with your game is that dead zombies will still hurt you, and you can just change the damage script to have this block:
if <(costume [number v] ::looks) = (1)> then
damage scripts
end
so that that doesn't happen. Not necessary but it think it makes it better. :D
toad_duzz toad_duzz loading

MineTurte wrote:

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Okay I genuinely can't find out what's wrong and everything seems to be working fine but I'll just completely rewrite your code and hope it works better. One second


wait so does it look fine but it doesn't work or does it look fine and you verified that it works
also I changed something that was wrong I forgot to change earlier so you should probably refresh
Did you just fix it because it looks exactly how I was about to make it lol

and thanks for the help, I'll be relying on you for later bugs because you always seem to be active lol!
MineTurte MineTurte loading

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Okay I genuinely can't find out what's wrong and everything seems to be working fine but I'll just completely rewrite your code and hope it works better. One second


wait so does it look fine but it doesn't work or does it look fine and you verified that it works
also I changed something that was wrong I forgot to change earlier so you should probably refresh
Did you just fix it because it looks exactly how I was about to make it lol

and thanks for the help, I'll be relying on you for later bugs because you always seem to be active lol!
Heh trust me, I am.
toad_duzz toad_duzz loading

Malicondi wrote:

toad_duzz wrote:

Oh my god, I was thinking about fixing that but I got lazy. It's there because I copy and pasted the zombies and just changed the code from there for different types without seeing a reason to clean it like that. Didn't realize it actually would become out of sync. Cheers to you for striking this one right in the eye, my friend.
Also, if you're wondering why this is case, one thing you should know is scratch runs scripts in an order, so it might do the normal zombies first, then the electro etc. This is because scratch runs the scripts in order of the layers the sprites are on, so if the normal zombie sprite is at the front layer, then all it's scripts will run first.

Also not sure if this was intentional or not, but a little nitpick I had with your game is that dead zombies will still hurt you, and you can just change the damage script to have this block:
if <(costume [number v] ::looks) = (1)> then
damage scripts
end
so that that doesn't happen. Not necessary but it think it makes it better. :D


good to know also that was the intention to have the zombie blood be poisonous lol it adds difficulty
toad_duzz toad_duzz loading

Malicondi wrote:

toad_duzz wrote:

Oh my god, I was thinking about fixing that but I got lazy. It's there because I copy and pasted the zombies and just changed the code from there for different types without seeing a reason to clean it like that. Didn't realize it actually would become out of sync. Cheers to you for striking this one right in the eye, my friend.
Also, if you're wondering why this is case, one thing you should know is scratch runs scripts in an order, so it might do the normal zombies first, then the electro etc. This is because scratch runs the scripts in order of the layers the sprites are on, so if the normal zombie sprite is at the front layer, then all it's scripts will run first.

Also not sure if this was intentional or not, but a little nitpick I had with your game is that dead zombies will still hurt you, and you can just change the damage script to have this block:
if <(costume [number v] ::looks) = (1)> then
damage scripts
end
so that that doesn't happen. Not necessary but it think it makes it better. :D


okay so I attempted to add a menu screen after you die so you can just click play and play again
now the spawns are duplicated on the 2nd run and the character has became immortal.
Malicondi Malicondi loading

toad_duzz wrote:

okay so I attempted to add a menu screen after you die so you can just click play and play again
now the spawns are duplicated on the 2nd run and the character has became immortal.
Well, that escalated quickly-

To fix the immortal problem, put this script:
forever
set [timer v] to (timer)
if <(health) < (1)> then // no need for both, they mean the same.
broadcast [dead v]
end
into a “when I receive start” hat block.

For the duplicated spawns problem, this will take a bit, sorry I would recommend to either add a delete this clone when I receive start, like this:
when I receive [start v]
repeat (1)
delete this clone
end
... // rest of scripts
to every sprite that clones, to prevent the clones from also cloning, causing duplicate spawns, or you can make this block: (with a new broadcast)
when I receive [delete clones v]
delete this clone
and use it like this:
when I receive [dead v]
broadcast [delete clones v]
both of these scripts will solve the issue of the clones also making clones, hope this helps!
why do you have a broadcast named “baka” ;-;
toad_duzz toad_duzz loading

Malicondi wrote:

toad_duzz wrote:

okay so I attempted to add a menu screen after you die so you can just click play and play again
now the spawns are duplicated on the 2nd run and the character has became immortal.
Well, that escalated quickly-

To fix the immortal problem, put this script:
forever
set [timer v] to (timer)
if <(health) < (1)> then // no need for both, they mean the same.
broadcast [dead v]
end
into a “when I receive start” hat block.

For the duplicated spawns problem, this will take a bit, sorry I would recommend to either add a delete this clone when I receive start, like this:
when I receive [start v]
repeat (1)
delete this clone
end
... // rest of scripts
to every sprite that clones, to prevent the clones from also cloning, causing duplicate spawns, or you can make this block: (with a new broadcast)
when I receive [delete clones v]
delete this clone
and use it like this:
when I receive [dead v]
broadcast [delete clones v]
both of these scripts will solve the issue of the clones also making clones, hope this helps!
why do you have a broadcast named “baka” ;-;

bugs fixed! thanks
we dont talk about the “baka” broadcast
toad_duzz toad_duzz loading

Malicondi wrote:

toad_duzz wrote:

okay so I attempted to add a menu screen after you die so you can just click play and play again
now the spawns are duplicated on the 2nd run and the character has became immortal.
Well, that escalated quickly-

To fix the immortal problem, put this script:
forever
set [timer v] to (timer)
if <(health) < (1)> then // no need for both, they mean the same.
broadcast [dead v]
end
into a “when I receive start” hat block.

For the duplicated spawns problem, this will take a bit, sorry I would recommend to either add a delete this clone when I receive start, like this:
when I receive [start v]
repeat (1)
delete this clone
end
... // rest of scripts
to every sprite that clones, to prevent the clones from also cloning, causing duplicate spawns, or you can make this block: (with a new broadcast)
when I receive [delete clones v]
delete this clone
and use it like this:
when I receive [dead v]
broadcast [delete clones v]
both of these scripts will solve the issue of the clones also making clones, hope this helps!
why do you have a broadcast named “baka” ;-;


So I've actually wondered this for a while because I've tried it in previous projects and ran into this same issue and never understood why this doesn't work.
The code is used to open and close a menu but it ends up doing absolutely nothing.

when this sprite clicked
if <(costume #) = [1]> then
switch costume to [costume2]
broadcast [armor menu]

if <(costume #) = [2]> then
switch costume to [costume1]
broadcast [menu]
end

I know a longer way of doing it that works but I wanna know if there's a way around that
Edit: alr the second “if, then” block is not supposed to be inside the first one, I have no clue how to post these scratch blocks lol. also I realized how frequent I've been asking you stuff I need to chill it
Malicondi Malicondi loading

toad_duzz wrote:

also I realized how frequent I've been asking you stuff I need to chill it
Don't worry, we're happy to help, you don't have to feed bad about how often you're asking things.

Usually what I do for buttons is this:
when gf clicked
set [clicks v] to (0)

when this sprite clicked
set [clicks v] to ((1) - (clicks))
if <(clicks) = (1)> then
broadcast (armor menu v)
switch costume to (costume 2 v)
else
broadcast (menu v)
switch costume to (costume 1 v)
and when it's clicked once, it does the first action, and when clicked twice. it does the second, this works for any amount of clicks.
Also, the crosshair sprite is in the way of clicking, so either make it hide until the game starts, or make it so “if touching crosshair and mouse down” instead of when this sprite clicked.
toad_duzz toad_duzz loading

Malicondi wrote:

toad_duzz wrote:

also I realized how frequent I've been asking you stuff I need to chill it
Don't worry, we're happy to help, you don't have to feed bad about how often you're asking things.

Usually what I do for buttons is this:
when gf clicked
set [clicks v] to (0)

when this sprite clicked
set [clicks v] to ((1) - (clicks))
if <(clicks) = (1)> then
broadcast (armor menu v)
switch costume to (costume 2 v)
else
broadcast (menu v)
switch costume to (costume 1 v)
and when it's clicked once, it does the first action, and when clicked twice. it does the second, this works for any amount of clicks.
Also, the crosshair sprite is in the way of clicking, so either make it hide until the game starts, or make it so “if touching crosshair and mouse down” instead of when this sprite clicked.

this will come in handy! thanks
toad_duzz toad_duzz loading

Malicondi wrote:

toad_duzz wrote:

also I realized how frequent I've been asking you stuff I need to chill it
Don't worry, we're happy to help, you don't have to feed bad about how often you're asking things.

Usually what I do for buttons is this:
when gf clicked
set [clicks v] to (0)

when this sprite clicked
set [clicks v] to ((1) - (clicks))
if <(clicks) = (1)> then
broadcast (armor menu v)
switch costume to (costume 2 v)
else
broadcast (menu v)
switch costume to (costume 1 v)
and when it's clicked once, it does the first action, and when clicked twice. it does the second, this works for any amount of clicks.
Also, the crosshair sprite is in the way of clicking, so either make it hide until the game starts, or make it so “if touching crosshair and mouse down” instead of when this sprite clicked.

alr I added the armor system to the game finally. does it feel clean? any suggestions?

Edit: also a little nitpick with my game that I've had is whenever you go to the edge of the map and then shoot, the bullets are instantly broken by the “bullet breaker” sprite that is made to delete bullets after reaching the edge to prevent clones from piling up although I am not sure why because the sprite is so thin and the bullets are so small that it just doesn't add up to me how they are even touching the sprite in the first place. And its very annoying, especially when your cornered and you wasted half of your ammo for none of the bullets to shoot dang that was a long yap session i just had there

Edit: another thing, so when you start getting late late game and kill the boss a few times the clone limit comes into play and it comes to a point where you can no longer shoot your guns and then the zombies just stop spawning. Probably nothing I can do about it but it's pretty annoying. What could I implement to fix this?
toad_duzz toad_duzz loading

MineTurte wrote:

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Okay I genuinely can't find out what's wrong and everything seems to be working fine but I'll just completely rewrite your code and hope it works better. One second


wait so does it look fine but it doesn't work or does it look fine and you verified that it works
also I changed something that was wrong I forgot to change earlier so you should probably refresh
Did you just fix it because it looks exactly how I was about to make it lol

and thanks for the help, I'll be relying on you for later bugs because you always seem to be active lol!
Heh trust me, I am.

and if your online could you check out any of the bugs I mentioned? would be nice
MineTurte MineTurte loading

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

MineTurte wrote:

toad_duzz wrote:

heres the game

We're looking at the “boss zombie” sprite. Its coded to spawn when it receives the broadcast “bossfight”

In the “normal zombie”, “electro zombie”, and “tank zombie” sprites, at the end of the spawning scripts it should be broadcasting “bossfight” approximately 130 seconds into the game after picking up the first gun but it never seems to be doing so and instead just continuing to spawn the zombies instead of spawning the boss. Not sure what's causing this, would be nice to have somebody look into this and find the solution.
Pretty sure the issue comes along somewhere with the use of the timer block used frequently in the spawning scripts, there's definitely a better way to code that.

Please don't mind my messy code. If you couldn't tell, I'm a rookie.
(thanks for the help!)
Okay I genuinely can't find out what's wrong and everything seems to be working fine but I'll just completely rewrite your code and hope it works better. One second


wait so does it look fine but it doesn't work or does it look fine and you verified that it works
also I changed something that was wrong I forgot to change earlier so you should probably refresh
Did you just fix it because it looks exactly how I was about to make it lol

and thanks for the help, I'll be relying on you for later bugs because you always seem to be active lol!
Heh trust me, I am.

and if your online could you check out any of the bugs I mentioned? would be nice
Yeah I can. Hold on while I read everything lol.


Update: Everything appears to be working pretty good. I suggest though rounding the HP so it's not a messy decimal that can sometimes get really long.