Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » All Skills Get Selected Instead of One
- Creator-H
- Scratcher
100+ posts
All Skills Get Selected Instead of One
(Here's the game): https://scratch-mit-edu.ezproxy.canberra.edu.au/projects/762330570/
My issue is found within the “Skills” sprite. I recently added a system which lets you pick what skill upgrade you would like, but it only works at times. Instead, it usually ends up with all 3 (and sometimes ones which weren't even options) being selected.
What I need is a way for the clone that got selected to basically say guys, i got chosen!!1! and make the others delete themselves. I thought I found a way to do such using variables, but it doesn't seem to be working well.
My issue is found within the “Skills” sprite. I recently added a system which lets you pick what skill upgrade you would like, but it only works at times. Instead, it usually ends up with all 3 (and sometimes ones which weren't even options) being selected.
What I need is a way for the clone that got selected to basically say guys, i got chosen!!1! and make the others delete themselves. I thought I found a way to do such using variables, but it doesn't seem to be working well.
I don't know what to do with my life
Try playing my new PVZ demo if it's up rn
7 YEAR ANNIVERSARY WHOOOO
Lists are built different
Use lists in all your games for stats and keeping track of cool thingies
No I swear if you don't use lists
- IGABMS
- Scratcher
100+ posts
All Skills Get Selected Instead of One
I'm not sure if I understand correctly, but basically a user can only have 3 equipped skills?
If so, you probably want to change this:
to this:
Basically this prevents a user from adding more than 1 sprite
If so, you probably want to change this:
when I receive [upgrade v]
set [isupgrading v] to []
go to x: (-193) y: (132)
repeat (3)
create clone of [myself v]
move (80) steps
end
to this:
when I receive [upgrade v]
if <(length of [Skills v] :: list) < [3]> then
set [isupgrading v] to []
go to x: (-193) y: (132)
repeat (3)
create clone of [myself v]
move (80) steps
end
else
say [3/3 slots used!]
end
Basically this prevents a user from adding more than 1 sprite
Last edited by IGABMS (Yesterday 00:11:35)
If you respond to something I write here, I probably won't see it, so let me know on my profile! Feel free to ask me questions about PHP, Python, Scratch, HTML, CSS, or JavaScript there, too!
- Creator-H
- Scratcher
100+ posts
All Skills Get Selected Instead of One
Sorry if my question was unclear I'm not sure if I understand correctly, but basically a user can only have 3 equipped skills?
If so, you probably want to change this:when I receive [upgrade v]
set [isupgrading v] to []
go to x: (-193) y: (132)
repeat (3)
create clone of [myself v]
move (80) steps
end
to this:when I receive [upgrade v]
if <(length of [Skills v] :: list) < [3]> then
set [isupgrading v] to []
go to x: (-193) y: (132)
repeat (3)
create clone of [myself v]
move (80) steps
end
else
say [3/3 slots used!]
end
Basically this prevents a user from adding more than 1 sprite
basically i'm saying that i only want the player to be able to select one of the three upgrade options whenever an upgrade is available. There doesn't have to be a limit.
I don't know what to do with my life
Try playing my new PVZ demo if it's up rn
7 YEAR ANNIVERSARY WHOOOO
Lists are built different
Use lists in all your games for stats and keeping track of cool thingies
No I swear if you don't use lists
- Creator-H
- Scratcher
100+ posts
All Skills Get Selected Instead of One
OH MY GOD I'M SO STUPID I SOLVED IT
For those asking how i just realized that the clones also received the cue to create more clones and that resulted in an exponential growth
For those asking how i just realized that the clones also received the cue to create more clones and that resulted in an exponential growth
Last edited by Creator-H (Today 01:53:32)
I don't know what to do with my life
Try playing my new PVZ demo if it's up rn
7 YEAR ANNIVERSARY WHOOOO
Lists are built different
Use lists in all your games for stats and keeping track of cool thingies
No I swear if you don't use lists
- Discussion Forums
- » Help with Scripts
- » All Skills Get Selected Instead of One