1

I'm wondering what script would be need to do to give a player who presses a button a set amount of resources every time an amount of time has passed. Base on how much time has passed the player would get more.

Example: Player joins Minecraft on day 1 on a multiplayer server and builds a quarry. Admin approves of the building and sets up a command block in the build that the player can press to get stone. The Player pushes the button on day 2 and gets a stack of 1 stack (64 blocks of) stone. The player skips a day; on day 4 presses the button and gets 2 stacks of stone.

The command script for the command block needs to be compatible with 1.7.10 and if vanilla commands don't work I will be using Lord of the Rings mod which has additional commands. link > http://lotrminecraftmod.wikia.com/wiki/Commands

  • Have you tried anything yet so far? – Vemonus Jan 9 '17 at 3:18
  • I have done daylight sensors but those can be grifed – Shiza Riku Jan 9 '17 at 3:20
  • 1
    1.7 may not have the commands required to to this, but you can get the time of day into a scoreboard with the stats /command and /time. I would research and familiarise yourself the commands in the game at this point, but you may have to write a custom mod to do this (and you're already using mods by the looks of it) – SB32 Jan 9 '17 at 3:37
2

Use a daylight sensor. By using redstone to check the output of the lamp, you can trigger an output line each dawn and evening. Use a T-flip-flop to reduce those 2 pulses to one long pulse every dawn. Connect that to a command block which summons an item into a hopper which points into a chest.

When the player presses the button, another hopper will take the items out of the chest. Run a comparator out of that hopper into a redstone clock. Set up the clock correctly so each item that passes through the hopper will turn the clock on and off once. Connect the clock to a commend block, set up to give whatever item to the player, or to summon it on the ground, or whatever other action.

The result: The number of dawns that have passed since the button was last pressed will be counted. When the button is pressed, the command block will run once for each dawn that passed. The recording of how many dawns have passed will be set to 0, ready for the next button press.

I saw in a comment that you had trouble with people griefing the daylight sensor. If that is a problem, just move the entire command block setup somewhere that no one can reach. For example, very high up, or a million blocks away. Even though there are no barrier blocks in 1.7, you can still use bedrock to stop players getting in. If they are able to reach the daylight sensor still, then add a command block which executes every tick and places a daylight sensor if there isn't one already there. The result: The daylight sensor cannot be permanently broken and no other parts can be reached.

EDIT: The command to place a new daylight sensor only if it has been removed should be:

setblock x y z minecraft:daylight_sensor 0 replace minecraft:air

Of course, replace x y z with the correct coordinates of where the daylight sensor should go. Also, that command will need to be executed every tick. If you need instructions, read this article http://minecraft.gamepedia.com/Clock_circuit and scroll to the section "Setblock clock". Good luck!

  • Thank you for responding. That is essentially what I had setup (the naming conventions I do not know). I like that last part the replacing of the sensor I will try that. – Shiza Riku Jan 13 '17 at 1:30
  • Don't forget that you'll need the pre-1.9 command block style clock. You know, using a command block containing a setblock command. You probably already know how to do that. If not, read minecraft.gamepedia.com/Clock_circuit and scroll down to the section about the "Setblock clock" for instructions. – user176681 Jan 13 '17 at 9:12
  • /setblock cannot replace specific blocks. You need to use /fill instead (described in the wiki link under "Fill clock" in the "Setblock clock" section). – Skylinerw Jan 13 '17 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.