Discuss Scratch

Dokter_Bawbby
Scratcher
15 posts

Health Scripts For Clones

I Need Help With A Game I Making Called Conagher's Survival and there will be enemies but i dont know how to make a clone with there own individual health variable? Please Help
drmcw
Scratcher
1000+ posts

Health Scripts For Clones

Ensure that the variable for the clones health is set “for this sprite only” when created.
adri326
Scratcher
100+ posts

Health Scripts For Clones

as drmcw said, make an variable with “for this sprite only”, and before cloning, set the var to the health you want to put in the clone, then clone it or set the var in the clone after having clonee it, the var will be limited to the clone, and afterr having cloned it, only the clone script can change its value (or “when i receive”, that will be executed for every clone.
Dokter_Bawbby
Scratcher
15 posts

Health Scripts For Clones

So Like This?

when I start as a clone
set [healthvar] to [?]

Something Along That?
adri326
Scratcher
100+ posts

Health Scripts For Clones

Yes, if the healthvar was created with the “only for this sprite” option.
foulan
Scratcher
6 posts

Health Scripts For Clones

adri326 wrote:

Yes, if the healthvar was created with the “only for this sprite” option.

Wow, Thanks for the advice! i mixed the “only for this sprite” with a “for all sprites” var to make the perfect game!
DRAGN-FIRZ
Scratcher
30 posts

Health Scripts For Clones

Does not work!!!
deck26
Scratcher
1000+ posts

Health Scripts For Clones

DRAGN-FIRZ wrote:

Does not work!!!
It will if done properly. Please create your own topic and share your project.
supermonkeycat157
Scratcher
100+ posts

Health Scripts For Clones

Make the health variable for this sprite only then make this:
when I start as a clone
set [clone health v] to (starting health)
repeat until <(clone health) = (0)>
. . .
if <I am hit> then
change [clone health v] by (-1)
end
end
. . .
delete this clone

Last edited by supermonkeycat157 (Jan. 13, 2018 23:12:35)

lwell72
Scratcher
100+ posts

Health Scripts For Clones

All you have to do is make the health variable for THIS SPRITE ONLY and there will be different health for each clone.
ConSyn17
New Scratcher
3 posts

Health Scripts For Clones

There are projects that can assist you in making self-creating variables- I don't know what they're called but you can search them. That might help.
Reign_Sky
Scratcher
100+ posts

Health Scripts For Clones

DRAGN-FIRZ wrote:

Does not work!!!
The script will work but it is terribly inefficient; I would use lists instead if you want to change attack pattern for the starting hp. If you want to keep the attack pattern the same no matter what starting hp, then super monkey cat's suggestion is really good. The only thing i would change is the repeat until clone hp = 0, i would add or clone hp < 0. This accommodates for an increase in damage. And if you want to change the starting health, change the variable starting hp before you spawn em.

Last edited by Reign_Sky (March 21, 2018 10:00:45)

AMarioFan0098
Scratcher
9 posts

Health Scripts For Clones

I Used This Method:

First I set the Variable Health to This Sprite Only Then I did this Script.

When Green Flag Clicked
Forever
Wait 0.1 Seconds
Create Clone
End Of Script

When I Start As Clone
Set Health To (Your Clones Health)
Forever
If Touching Any Then
Change Health By -1
If Health = 0, Or If Health < 0 Then
Hide
End Of Script

I Don't Know How To Use Scratch Blocks. Sorry But Hope This Helps.

Asteroids Engine. This Is The Game That Sorta Uses The Script.

Last edited by AMarioFan0098 (Dec. 14, 2018 02:06:23)

existify
Scratcher
14 posts

Health Scripts For Clones

.

Last edited by existify (March 7, 2020 09:09:14)

existify
Scratcher
14 posts

Health Scripts For Clones

this script works and its easy and simple too easy if you ask me
first add costumes they represent health

when I start as a clone 
switch costume to [ first costume]
forever
if <touching stuff> then
next costume
wait (0.1) secs
end
if <<(costume #) < [end of costumes]> or <(costume #) = [end of costumes]>> then
delete this clone
end
end

Last edited by existify (March 7, 2020 09:13:24)

TopGG
Scratcher
500+ posts

Health Scripts For Clones

I'm trying to make a game similar to Wizard's Tower, but I can't seem to get the HP system working… Here's my current setup.
when green flag clicked
forever
if <(Difficulty) = [0]> then
wait (5) secs
repeat (5)
create clone of [ myself]
wait (2.3) secs
end
wait (10) secs
change [ difficulty] by (1)
end
if <(Difficulty) = [1]> then
wait (5) secs
repeat (7)
create clone of [ myself]
wait (2) secs
end
wait (10) secs
change [ difficulty] by (1)
end
end
when I start as a clone
switch costume to [ fullhp]
set y to (9999999999)
set x to (pick random (-230) to (230))
show
point towards [ cannon]
Darkstar177
Scratcher
100+ posts

Health Scripts For Clones

TopGG wrote:

I'm trying to make a game similar to Wizard's Tower, but I can't seem to get the HP system working… Here's my current setup.
when green flag clicked
forever
if <(Difficulty) = [0]> then
wait (5) secs
repeat (5)
create clone of [ myself]
wait (2.3) secs
end
wait (10) secs
change [ difficulty] by (1)
end
if <(Difficulty) = [1]> then
wait (5) secs
repeat (7)
create clone of [ myself]
wait (2) secs
end
wait (10) secs
change [ difficulty] by (1)
end
end
when I start as a clone
switch costume to [ fullhp]
set y to (9999999999)
set x to (pick random (-230) to (230))
show
point towards [ cannon]
Do not necropost, make a new topic.
TopGG
Scratcher
500+ posts

Health Scripts For Clones

then continuing off that second script…

repeat until <<touching [ cannon] ?> or <touching [ bullet] ?>>
move (1) steps
end
if <touching [ cannon] ?> then
change [ playerhp] by (-10)
delete this clone
end
if <touching [ bullet] ?> then
repeat until <(costume #) = [4]>
if <(costume #) = [1]> then
switch costume to [ halfhp]
end
if <(costume #) = [2]> then
switch costume to [ quarterhp]
end
if <(costume #) = [3]> then
switch costume to [ dead]
end
if <(costume #) = [4]> then
delete this clone
end
end
end
TopGG
Scratcher
500+ posts

Health Scripts For Clones

Darkstar177 wrote:

TopGG wrote:

I'm trying to make a game similar to Wizard's Tower, but I can't seem to get the HP system working… Here's my current setup.
when green flag clicked
forever
if <(Difficulty) = [0]> then
wait (5) secs
repeat (5)
create clone of [ myself]
wait (2.3) secs
end
wait (10) secs
change [ difficulty] by (1)
end
if <(Difficulty) = [1]> then
wait (5) secs
repeat (7)
create clone of [ myself]
wait (2) secs
end
wait (10) secs
change [ difficulty] by (1)
end
end
when I start as a clone
switch costume to [ fullhp]
set y to (9999999999)
set x to (pick random (-230) to (230))
show
point towards [ cannon]
Do not necropost, make a new topic.

Please don't advertise on a completely unrelated topic. Also, I hate platformers.
TopGG
Scratcher
500+ posts

Health Scripts For Clones

: P It didn't even show the advertisement…. *sigh*

Powered by DjangoBB