Redstone Trouble

2 emeralds 4 replies 52 views | started 02/17/2018 9:18 am by DragonBlaze__
Wondering if anyone could help me with this, I’m making a map and I have some checkpoint buttons that are detected by a repeating command block hidden in the earth below. When the button is clicked the command block sets the player’s spawnpoint. The problem is the commands repeat until the button resets itself. I don’t really care about the checkpoint commands repeating, but I have a message I want to display whenever players click the button, but the message repeats too. So how can I make it so the message is only sent once and not repeated like the spawnpoint command?
Posted by avatar
Level 1 : New Explorer

4 replies

02/17/2018 9:26 am
Level 17 Journeyman Engineer
Why use a repeating command block in the first place? Just make it a default impulse one for the spawnpoint command and then add chain command blocks (chain, unconditional and always active) to perform the message.

That will ensure that this will only run once.
02/17/2018 9:34 am
Level 1 New Explorer
The thing is the most of the spawnpoint buttons are on platforms in the sky, and I’d rather not make the platforms bulky to accommodate for covering up unsightly command blocks, and I wasn’t sure if there was a way you could just make certain command blocks activate once.
02/17/2018 12:44 pm
Level 17 Journeyman Engineer
Use functions, they were meant for this. You'll have 1 command block which triggers the function which in its turn will perform all the commands.


A little more elaboration. For example:

spawnpoint @s[tag=!step1]
scoreboard players tag add @s step1

Add this to a function, then let your command block call this function. It won't matter how many times it'll be triggered because it will only run once thanks to the tag in the scoreboard.

Keep in mind you can't just use /function though. In the command block you'll need this:

/execute @p ~ ~ ~ function mystuff:spawnpoint1

This will make the player entity run the function which ensures that the whole thing works. Keep in mind that the example above assumes you've created data\functions\mystuff and added a file called spawnpoint1.mcfunction with the commands I mentioned earlier.
02/17/2018 12:16 pm
Level 1 New Network
You can achieve this by simply putting a commandblock at every checkpoint that sets a redstone block right next to the command block to set the spawn, within the chain of displaying the message you simply remove the redstone block again and voilà :)




© 2010 - 2018