Discuss Scratch

Cozyness
Scratcher
2 posts

How to stop clones from getting cloned

I have look on many forums and tried many scripts including making detection variables, but the clones just keep cloning themselves, and I'm not sure what to do. Please help!
huboojoe
Scratcher
100+ posts

How to stop clones from getting cloned

Cozyness wrote:

I have look on many forums and tried many scripts including making detection variables, but the clones just keep cloning themselves, and I'm not sure what to do. Please help!
you can use the cloneID method, first, sets the cloneID to 0, because there are no clones created yet
set [cloneID v] to [0]
then, when it start cloning, the cloneID will increase for each clone made
when I start as a clone
change [cloneID v] by (1)
so when it reaches a specific amount of clones of your choice, the whole script stops
if <(cloneID) = [max clones amount]> then
stop [this script v]
end

Or maybe you can just repeat


repeat (3)
create clone of [myself v]
end
| which means it'll stop after making 3 clones

Last edited by huboojoe (Dec. 10, 2022 19:55:20)

YetAnotherDeveloper
Scratcher
13 posts

How to stop clones from getting cloned

If you want to make clones inside the original sprite, put this in the NON CLONE sprite BEFORE it makes any clones (otherwise, you can make the clones in another sprite):

when green flag clicked
set [clone? v] to [0]

And put this in your code, too. Make sure this variable only is changed here, nowhere else:
when I start as a clone
set [clone? v] to [1]

Now make a new custom block to make clones with:
define clone myself
if <(clone) = (0)> then
create clone of [myself v]
end

And always use that block when making clones, instead of the usual. If you don't make clones often, you can just use the code INSIDE of the custom block when you make clones, instead of making a whole new block to check if it's a clone.

Last edited by YetAnotherDeveloper (Dec. 10, 2022 23:16:34)

YetAnotherDeveloper
Scratcher
13 posts

How to stop clones from getting cloned

Cozyness wrote:

I have look on many forums and tried many scripts including making detection variables, but the clones just keep cloning themselves, and I'm not sure what to do. Please help!

The method I use is as simple as I could make it. Hope it helps!
09878901234321
Scratcher
500+ posts

How to stop clones from getting cloned

Cozyness wrote:

I have look on many forums and tried many scripts including making detection variables, but the clones just keep cloning themselves, and I'm not sure what to do. Please help!
If you create the clone from another sprite, you only make one clone of the sprite you’re cloning.
So, in another sprite you should put this block:
create clone of [sprite to be cloned v]
davi-pecri
New Scratcher
1 post

How to stop clones from getting cloned

YetAnotherDeveloper wrote:

If you want to make clones inside the original sprite, put this in the NON CLONE sprite BEFORE it makes any clones (otherwise, you can make the clones in another sprite):

when green flag clicked
set [clone? v] to [0]

And put this in your code, too. Make sure this variable only is changed here, nowhere else:
when I start as a clone
set [clone? v] to [1]

Now make a new custom block to make clones with:
define clone myself
if <(clone) = (0)> then
create clone of [myself v]
end

And always use that block when making clones, instead of the usual. If you don't make clones often, you can just use the code INSIDE of the custom block when you make clones, instead of making a whole new block to check if it's a clone.

how do the custom?
DidntMeanToDoThat
Scratcher
500+ posts

How to stop clones from getting cloned

YetAnotherDeveloper wrote:

If you want to make clones inside the original sprite, put this in the NON CLONE sprite BEFORE it makes any clones (otherwise, you can make the clones in another sprite):

when green flag clicked
set [clone? v] to [0]

And put this in your code, too. Make sure this variable only is changed here, nowhere else:
when I start as a clone
set [clone? v] to [1]

Now make a new custom block to make clones with:
define clone myself
if <(clone) = (0)> then
create clone of [myself v]
end

And always use that block when making clones, instead of the usual. If you don't make clones often, you can just use the code INSIDE of the custom block when you make clones, instead of making a whole new block to check if it's a clone.
Just want to make sure you know, you have to make sure the “clone?” variable is local. Also, I think the name “Is clone?” is better, but that's just my opinion.
DidntMeanToDoThat
Scratcher
500+ posts

How to stop clones from getting cloned

Oops sry, this is quite an old topic. Saw it at the top of Help with Scripts and forgot to check.
Scratchtheguy1
Scratcher
500+ posts

How to stop clones from getting cloned

This block deletes all clones:
delete this clone

Powered by DjangoBB