#Store Generation Script
1 messages · Page 1 of 1 (latest)
What help do you need
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
I don't really know how to explain what im trying to do but heres the code https://paste.mod.gg/tatoifofpbou/0
A tool for sharing your source code with the world!
Explaining what you're trying to do is the first and most essential step to making this work
without a good description of the desired behavior, nobody can help you.
What is a "store" exactly? What parts of it need to be generated? What are the properties you want for the generated things?
You need to start by writing a simple explanation, in english, explaining how you want it to work, before you start trying to code anything.
I want it to pretty much be for the layout of a grocery store (ex: Walmart, meijer) but I want tit to generate shelves in sections, with prefabes, like 5 food prefabs and etc. The items are just going to be on those prefabs and they will be randomly generated in a random layout.
ok and what are the properties of the items? Do they have different sizes? Do the shelves have well defined lengths? What kind of spacing is needed between them?
What about how they are generated? Should it be completely random? Or should it be in sections, with duplicates and related items near each other?
Should the shelves be totally full?
If the sizes matter you need to think about it in a purely mathematical way at first. Like. if a shelf is 10 units wide and you have random elements with sizes between 1 and 5 units, how do you generate things that fit? One option is basically to look at the remaining space on the shelf and select a random element from the elements that are smaller than or equal to the remaining size.
E.g. if you have 3 units of space left on the shelf, you can only select things with size 3 or less.
They should be in sections that are defined in the inspector, so I can have like 5 food shelves and 3 electronic shelves together in their own sections, they don't need to be in any specific order. The items on the shelves won't be randomly generated. The shelves are just one mesh and while gnerating it looks for the scale of them and tries to put them together.
ok so the shelves themselves are like predefined? Like... an "electronics shelf" has a preset set of items?
so it's the arrangement of these preset shelves that is random?
yes, the shelves should have a specific tag of what section theyre in. The arrangement in the sections should be random, yes.
I would make each "shelf" e.g. collection of items into a prefab. Then you can just select a random "shelf" of items from a list and populate each empty in-game shelf with those prefabs.
Each in-game shelf should have the items randomly generated, just the store layout
I'm confused you said:
The items on the shelves won't be randomly generated
But then you said:
Each in-game shelf should have the items randomly generated, just the store layout
So I'm not sure if the items on the shelf are random or not
either way, if they are, you just need to pick random items from the category that the shelf you're generating is
I meant shouldn't, that was a typo
Then you just need to pick random shelf prefabs and place them in each shelf spot
yeah
(To be clear they are asking questions to help you make it, no one here is making you the script)
Yeah, i already fixed the one I had