Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Clones seem to not hold a stable population
- Firedrake969
-
1000+ posts
Clones seem to not hold a stable population
in http://scratch.mit.edu.ezproxyberklee.flo.org/projects/11527914/#player for every NPC/human that dies, besides the player, a zombie is supposed to spring up. Variables count the two numbers, but I can't figure out why more zombies come up than humans die after a while.
- Centrifugal
-
500+ posts
Clones seem to not hold a stable population
http://scratch.mit.edu.ezproxyberklee.flo.org/projects/11527914/#player for every NPC/human that dies, besides the player, a zombie is supposed to spring up. Variables count the two numbers, but I can't figure out why more zombies come up than humans die after a while.Hmmm… does it have anything to do with the if touching NPC create clone? If a zombie touches an NPC for to long it might create two clones while only deleting one NPC. Maybe you could try adding in a wait .1 seconds block and see if that helps. in
- Firedrake969
-
1000+ posts
Clones seem to not hold a stable population
I added it on one, then it glitched more, so I added it on both.
- ProdigyZeta7
-
1000+ posts
Clones seem to not hold a stable population
Make sure no clones are receiving broadcasts they aren't supposed to. Use this:
when I receive [broadcast v]
if (i am a clone) = 0 //only the parent sprite can receive this broadcast
...
/if
Last edited by ProdigyZeta7 (July 22, 2013 00:02:07)
- Firedrake969
-
1000+ posts
Clones seem to not hold a stable population
There are no broadcasts.
- Firedrake969
-
1000+ posts
Clones seem to not hold a stable population
Ok, so changed so when the humans touch a zombie, they change humans by -1, zombies by 1, and clone a zombie and delete themself. Still, oddly, doesn't work.
- ErnieParke
-
1000+ posts
Clones seem to not hold a stable population
http://scratch.mit.edu.ezproxyberklee.flo.org/projects/11527914/#player for every NPC/human that dies, besides the player, a zombie is supposed to spring up. Variables count the two numbers, but I can't figure out why more zombies come up than humans die after a while.Well, part of it is that you're not keeping proper count of both sides. You start of with 24 NPC's and 1 zombie, but you set (Humans:) to 25, and (Zombies:) to 0. Not accurate. As for anything more then a person off, I'm not sure. I haven't seen any of that yet. in

Oh, and by the way, you might want to avoid using . It's a good block, but it's glitching out terribly for you. Why? I don't know.
With regards,
ErnieParke
Last edited by ErnieParke (July 23, 2013 20:11:07)
- mitchboy
-
1000+ posts
Clones seem to not hold a stable population
Fixed. Well, part of it is that you're not keeping proper count of both sides. You start of with 24 NPC's and 1 zombie, but you set (Humans:) to 25, and (Zombies:) to 0. Not accurate. As for anything more then a person off, I'm not sure. I haven't seen any of that yet.
Oh, and by the way, you might want to avoid using [if on edge, bounce]. It's a good block, but it's glitching out terribly for you. Why? I don't know.
Perhaps add a "wait until < not < touching []? > >" block to it.
- Firedrake969
-
1000+ posts
Clones seem to not hold a stable population
wait until not touching what? And where at?Fixed. Well, part of it is that you're not keeping proper count of both sides. You start of with 24 NPC's and 1 zombie, but you set (Humans:) to 25, and (Zombies:) to 0. Not accurate. As for anything more then a person off, I'm not sure. I haven't seen any of that yet.
Oh, and by the way, you might want to avoid using [if on edge, bounce]. It's a good block, but it's glitching out terribly for you. Why? I don't know.
Perhaps add a "wait until < not < touching []? > >" block to it.
If I don't use the if on edge, bounce block, the zombies and humans swarm to the sides.
Updated but still glitching.
- ErnieParke
-
1000+ posts
Clones seem to not hold a stable population
You still haven't updated the zombie side of things.wait until not touching what? And where at?Fixed. Well, part of it is that you're not keeping proper count of both sides. You start of with 24 NPC's and 1 zombie, but you set (Humans:) to 25, and (Zombies:) to 0. Not accurate. As for anything more then a person off, I'm not sure. I haven't seen any of that yet.
Oh, and by the way, you might want to avoid using [if on edge, bounce]. It's a good block, but it's glitching out terribly for you. Why? I don't know.
Perhaps add a "wait until < not < touching []? > >" block to it.
If I don't use the if on edge, bounce block, the zombies and humans swarm to the sides.
Updated but still glitching.

Anyway, I found the glitch, and it's not with Scratch. The glitch comes when a person becomes a zombie *before* you set (humans:) to 24. Then you have 23 NPC's and 2 zombies, but your counter says 24 NPC's and 1 zombie (though it means 2). Now do you see where your glitch is coming from? Just shift that [set to (24)] block, and you should be good.
With regards,
ErnieParke
Last edited by ErnieParke (July 25, 2013 00:40:21)
- mitchboy
-
1000+ posts
Clones seem to not hold a stable population
"wait until < not < touching [insert NPC sprite name here]? > >“ on the zombie sprite(s). I think that sometimes when a zombie touches an NPC, it creates 2 zombies instead of 1. Put this after the ”if < touching [NPCSpritename]? >" so it only creates one each time.wait until not touching what? And where at? Perhaps add a "wait until < not < touching []? > >" block to it.
Last edited by mitchboy (July 25, 2013 15:10:31)
- Firedrake969
-
1000+ posts
Clones seem to not hold a stable population
Ok, it works better, but now when a human becomes a zombie, the zombies doesn't go to where the human was. Any ideas?
- ErnieParke
-
1000+ posts
Clones seem to not hold a stable population
I was thinking that you could create a list to store the NPC's last positions. Now, when a person becomes a zombie, they'll add their x position and y position to the list, and when a zombie comes a live, it'll read the x position and y position in the list. The zombie will know where to go then, and it'll also remove the x&y position from the list so that other zombies that spawned at the same time won't go to the same place. You could even extend this to add the direction of the NPC before zombification, but that's if you want. Ok, it works better, but now when a human becomes a zombie, the zombies doesn't go to where the human was. Any ideas?
With regards,
ErnieParke
- Firedrake969
-
1000+ posts
Clones seem to not hold a stable population
Can you remix, so I can see? I think I got it, but it still is weird.
- ErnieParke
-
1000+ posts
Clones seem to not hold a stable population
You're on the right track, but not there. Anyway, I decided to remix: Can you remix, so I can see? I think I got it, but it still is weird.Zombie Survival
By the way, you know I made one of these too a long while ago? It even has the same name, but it was made back in 1.4.
With regards,
ErnieParke
- Discussion Forums
- » Help with Scripts
-
» Clones seem to not hold a stable population