Scratch is fun (dev log thing)

Yeah, that actually sounds good.

I could organize enemies into different broadcasts that would make clones of one sprite that change into a specific costume and have specific AI organized by blocks, that actually DOES sound nice and all

By the way, do you have any ideas for how the stat system should work? I want the game to be able to read certain items in a list and be able to add on certain stats accordingly for when something is equipped.

For example, if you have “amulet” in the equips list and when it is in that list the mana gain variable is uppered by a certain amount. I’m not exactly sure how to code that so health would be appreciated. I’m just missing something really obvious, i’m sure of it.

I feel like you’d find a lot more help on the Scratch forums. But here is what I like to do.

Create some lists that just save information about certain items. For example “Item: Name” which stores the name for every item, “Item: Stat” which stores which stat the item affects, “Item: Power” which stores how much that stat is affected, and possibly some other lists that determine rarity, crafting requirements, etc. If the first item in “Item: Name” is “Amulet,” the first item in “Item: Stat” would determine the amulet’s stat and “Item: Power” would determine the amulet’s power, etc.

Then, whenever an item in the inventory is changed, you can run a script that sets all of your stats depending on the items in your inventory. You can use the “item # of (item) in [list]” block to find the index of the equipped item (index meaning its placement in “Item: Name” list.)

Here’s an example of what I’m talking about.

1 Like

Thank You I’m doing scratch for music class, and it is pain.

image

I figured this out, I play tested and I think it’s working

That works. The problem is you’ll need one of those scripts for each item you add. Plus, it checks every item every frame. If you’ll only have ~10 items, that won’t be much of an issue.

1 Like

Only 5 items can be in the equips at a time and only equips give stats, so it shouldn’t be an issue (?)

And making a new script for every new item is barely a time investment

Oh I see what you mean, it’s always going to be checking for if whatnot items are equipped for every item

Is that going to cause a lot of lag? Is there a solution that I can understand?

Approx. how many items do you think will be in your game? If you think you’ll have more than 20 items, I recommend looking for a more efficient way of doing that. I recommend doing something like I said above, where the item information is saved in lists. Whenever you change your equipment or close the inventory UI, a script will activate that looks through your equipped menu and changes your stats accordingly. You can put all of the code under a custom block called “Allocate Stats” or something like that and call that block whenever the equip menu is changed. If the solution I mentioned doesn’t work, you can ask the scratch forums.

1 Like

Should I make it so whenever something is equipped or taken out of equips, it checks everything?

That would probably be easier. If it only runs that check when messing with your equipped menu, people won’t notice if it goes to 20 fps or something like that for 1 frame. Especially considering they won’t be actively doing something like fighting/platforming (idk what you do in your game) when messing with their inventory. It’s better than checking everything every frame and constantly having low fps.

1 Like

Aagh nothing i’m doing rn works, how should I make it so that it’s similar to this

image

But it only activates once something is added to equips and this script doesn’t activate again if the message is done again because that would break it? I’m just really bad at this stuff

I already shared my answer. If you have trouble just start a thread on the scratch forums. You already have a scratch forums account if you have a scratch account since they’re on the same website.

1 Like

Woah, I took the time to understand this and it’s actually really neat.

First it sets all of your statistics to zero, albeit temporarily. This makes it so it can actually add up all the stats from your equips.

It sets inventory search to zero. The amount of times equal to the amount of equips you have, it puts inventory search up one.

Now the script is focusing on the first item in your equips, since inventory search is at 1. It grabs the name of this item, and then searches for what number on the Item: Name list this name is. Now it has the “ID Number” of the item it has selected, and sets the variable “Index” to it.

It then grabs the items of the other two lists that correspond to that “ID Number”, using Index, in a block. This block is what changes the corresponding stat by the corresponding amount.

The game then sets inventory search to 2, therefore finding the name of the second item in your equips, seeing what number that name is in the Item: Name list, setting that number to index, finding the corresponding stats and changing them and so on.

Makes one really respect the people who have to remove lag from games actually

1 Like

DUDE IT WORKED you’re an actual legend tysm. :flushed:

1 Like

Update:

Item descriptions, names, and effects whilst in the equips list are now all functional thanks to Ultra :poggers2:.

The first item that does something is called “Amulet”, so type it into the inventory (in the editor, press the “See Inside” button) and transfer it over to your equip menu. (The game only updates the stats of your equips when you delete or transfer items)

Btw you can only add things into lists in the editor.

1 Like

Oh :skull:

Wait anyone can go into the editor right?

Just added the Erroneous Visage and the Starry Marble

Yeah, but they won’t do that if they’re playing. You can use the “ask (message) and wait” block in the “Sensing” category to get the player to type in an item.