Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Refillable Chests with Random Item

How would I go about doing this?

I know that refillable chests can PROBABLY be done through Switches, but I'm still very new to the game and that sort of step would require a lot of thought for me. I would want them to refill with an item after... let's say the character sleeps at an Inn in any town?

On top of them being refillable, I was wondering if I could make them have a random item in them as well. Let say... you get 1 item out of a list of 10? To make things random (Or to make it seem like a search, if the character is looking through debris) it'll look something like.
1. Nothing
2. Nothing
3. Arrows x10
4. Hand Axe
5. Long Sword

The list will remain the same, but each time the player "sleeps", the switches get reset and the chest fills up with this "random" item again.

Thank you for the help. I will be most patient with a response.
 
Yes this is possible without scripts.

ok firstly for the random item part:

-in your event create a new variablein the event command list and make it a random variable range from 1 -5 (ill just call this variable = "Chest")
-make another event command: conditional branch = variable "chest" if 1
then : Write your text "You receive nothing"
-make another event command: conditional branch = variable "chest" if 2
then : Write your text "You receive nothing"
-make another event command: conditional branch = variable "chest" if 3
then : Write your text "You receive ten arrow"
-make another event command: conditional branch = variable "chest" if 3
then : Write your text "You receive Hand Axe"
-make another event command: conditional branch = variable "chest" if 3
then : Write your text "You receive Long Sword"
After the end of each conditional branch turn ON control switch "Blah Chest Empty"

Make another event page with the condition of operation "Blah Chest Empty" = ON


Sweet

now when you enter the inn or whatever just make it so you turn "Blah Chest Empty" = OFF

sorry im just in a uni class and typed this real quick and if you have any more quires or just dont understand just write in topic???!?!?!?!
 
Will I have to have it reset every single switch separately (which would result in a ton more work) Or will it reset them all at once?

I tried playing around with it, and I couldn't get it to work. I made it with 3 "random items" and it wouldn't give me any of the items.

Sorry, just pretty new to this and not in practice.

EDIT: Perhaps a demo?
 
Alright, I'm still having some trouble, but that's because I just need practice.

What I wasn't understanding, which I sorta get now, is that the Conditional Branches were all connected. Before, I was making them all separate. It took me a little while to notice this.

Thanks again for taking the time to help me out! I'll probably have more script questions soon.

((For my survival game to be complete, I needed a way to do random chests that refill after sleeping. This will be so that characters can loot from places. What I'm going to be looking for next, will be some sort of food system. Where either if the player has no food, he slowly dies or instantly dies, or you cannot rest unless you have food. Another thing that would make this more realistic, would be if the food would spoil over time, which I could measure by the number of steps a character makes. For example: Apple spoils after 500 steps. Just a thought, but it's what I'm going to be after once I master these random chests


EDIT: Also, with the first demo, what was with the Move Route for the chests? I didn't get that at all.
 
The move route was simply to add a realistic effect. You see, the charset of the chests have 4 rows, closed, partly open, mostly open, and open; or turn down, turn left, turn right, and turn up. You can use the same move route with doors and other things to produce realistic effects.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top