How do I make a continuous item granter?

Hi,
Can anyone tell me, if it’s in the game, how to make a continuous item granter? I want to make a game that involves sleeping, and while you sleep you gain energy until you wake up.
Thank you!

1 Like

Use a relay that relays from the sleep channel to a channel named ‘trigger’ for the triggering player. Set a trigger to trigger when receiving on ‘trigger’, activate on the sleep channel, deactivate on the wake up channel, and transmit on ‘trigger’ at a certain interval (maybe 0.1 or 0.5 seconds?). Set an item granter to give the player energy whenever it receives on ‘trigger’.

1 Like

Sorry, I don’t understand :c

Can you explain it in more detail or add images?

Thank you.

Use 2 wire repeaters wire them to each other then connected 1 to the item granter but it won’t work until it’s triggered when do you want it to start?

Yeah, just give me a few minutes.

How does an item granter work? When an action the player does broadcasts on a channel (or runs through a wire), the item granter grants the item to the player. So, the question can be simplified to become “How do I repeatedly broadcast a message on a channel every few seconds?”


Method 1: Repeater

You could use the repeater device, where when a player starts sleeping (by pressing a button or doing some other action), the device that receives the action broadcasts a message that says “beginsleep” (this is the channel name, I called it this but you can call it whatever you want).

For the settings of the repeater, the time between each broadcast is up to your choosing. Want the player to gain energy every second? Set that option to “1”.

Now, what happens when the player stops sleeping? I’m going to assume that the player presses a button to stop sleeping, and in that case, when the player presses that button, it should broadcast a message called “stopsteep” (again, the channel name can be whatever you want). Now, make it so that the repeater deactivates when receiving that channel, because after the player has stopped sleeping there is no reason for them to keep gaining energy. When the repeater runs, make it broadcast on a channel called “gainenergy”, and when an item granter device receives that message, it should grant the player energy.

(by the way, the repeater should run “forever”).


Method 2: Triggerloop

Alright, the name for this method might sound confusing, hopefully it’s not. This method is basically more memory-efficient (if you don’t know what that means, it basically just means that it uses less memory than the other method).

If you’ve read the other method, basically, we’re making the repeater device but with triggers that only take up 40 memory this time. If you haven’t, we’re basically using a trigger that triggers itself (by channel, so it sends a message and then receives that message, causing it to send the message again, and repeat…) to loop and continuously give the player energy.

When the player goes to bed (I’m assuming using a button yet again), let the button broadcast a message on a channel called “beginsleep”. Then, place down a trigger. Since the trigger shouldn’t be interacted with in-game, make it invisible and turn the setting that allows it to be triggered by being stepped on off.

Now, make it so that the trigger sends a message on channel “Loop” and “gainenergy” when triggered and triggers when receiving on these channels: “beginsleep”, “Loop”. If you don’t know how to make a trigger be triggered when receiving on multiple channels, it’s by separating each channel with a comma when you enter them. Here’s how it would look in-game:

When triggered, broadcast message on channels: Loop, gainenergy
Trigger when receiving on: beginsleep, Loop

Okay, but won’t this make it loop super fast? Well, if you give the trigger a delay of 1, it’ll broadcast its messages, wait a second, and then do it again, effectively making it trigger every 1 second. Make the rate that the player should gain energy at the delay of the trigger.

Alright, so now, when the player stops sleeping, broadcast a message on the channel “stopsleep” and make the trigger deactivate when receiving on that channel beacuse it shouldn’t keep looping even after the player has stopped sleeping. Anyways, place down an item granter, make it receive on “gainenergy” (so it’ll grant energy everytime the trigger loops), and you’re basically done!


Yeah, so I don’t know if you’re a beginner at Gimkit Creative, but I tried to make this make as much sense as possible and be as beginner-friendly as possible.


(Code is inactive)

The top button is the button to sleep, the bottom button is to wake up.

Top button wires:
To the relay: [Button clicked → Trigger relay]
To the trigger: [Button clicked → Activate trigger]

Bottom button wires:
To the trigger: [Button clicked → Deactivate trigger]

Relay wires:
To the trigger: [Relay trigger → Trigger]

Trigger wires:
To the item granter: [Triggered → Grant item]
To the repeater: [Triggered → Repeat pulse]

Wire repeater wires:
To the trigger: [Pulse received → Trigger]

I kept the buttons, trigger, and wire repeater settings the same.

After I wrote most of this, I realized that the relay should be replaced by a wire repeater or trigger. If you use a trigger, keep it at default settings and set the wires as such:
From the top button: [Button clicked → Trigger]
To the other trigger: [Triggered → Trigger]

Edit: I didn’t see mysz’s post, their solutions work too!
Edit 2: For some reason this doesn’t work, I don’t know why.
Edit 3: I figured it out, you just need to make sure the original wire repeater has a non-zero delay.

How did you make the person start sleeping? How often do you get energy while sleeping, and how much energy do you get? How did you make the person wake up?