Commmand Block Discussion

  1. ‹ Older
  2. 7 years ago

    You can name them and tag them in the same way but if the same command triggers it will name them all the same whether they are clouds or armour stands. And you dont want to test on each players name separately. You have to look to the scoreboard.

  3. Thanks @pand1024 that is interesting.

    It wont help me for just keeping a chunk open for a short time as i dont want to have to put a load of stuff down that i then have to remove. It will be useful if i want to add command room further out from spawn. Of course the alternative is to save the back coords which is essentially a saveable warp.

    @NutjobBob essentially this works out how far the border is by moving an entity recording and improving the approximation as you go. I am not sure whether that will force chunks on the way to be created which would be an issue for me with limited map storage. I dont think you need to use chests to store the save though - I think you can use the scoreboard and deduct amounts in the same way to go back. (If you tp the player will they see what is on the way or die in lava etc?) Quite a challenge to say the least. I also have a memory @CraftyMyner said there were over 200 blocks in the warp system though that includes vote credit charging and tests for team to see if a charge applies.

  4. Just properly tried using commands for the first time!
    I found some interesting things you might find useful:

    Firstly the method in the video I showed is no longer possible because you don't seem to be able to teleport entities outside of the worldborder any more. I'm pretty sure you can still find coordinates using something similar to this by testing if a series of relative tp commands succeed/fail, since they will fail if they try to tp an entity outside the worldborder.

    Secondly you can tp a mob around unloaded and ungenerated chunks just fine. I only tested this by tping it out once and then back. There might be a limit on how many times you can tp it around unloaded chunks before the game can't find it any more. Strangely, I checked using MCedit and found that this doesn't load or generate the chunk (so no memory problems!).

    No idea if this is remotely useful or not, but I had fun playing with it!

  5. Hi there @NutjobBob

    I can find the coordinates ok now but you raise some very interesting stuff and I will probably adjust my method. What I had found was that by setting the volume values test appropriately you can check whether the border has been passed. This would have to be adjusted if you change the world border.

    Slightly puzzled as I actually found you can tp entities outside the world border or at least a world border you have set yourself.

    It may be that you cant set it beyond the default of 60million he refers to. He also refers to an operation you cant do only when you are outside the border to test whether you are outside the border. I cant find this - only ones that always work or always don't.

    If you are referring to the default border and it wont let you past, then actually my thinking is this will make it much easier as you can just try reducing steps until you can't move anymore recording as you go along. No need for backwards and forwards. The fact that you found from MCEdit that it doesn't create chunks getting there means I can use it without worrying about file size. (Phew)

    As far as loading the chunks is concerned I did find a video that shows there are various levels of loading. I think there is a bare minimum load state as I found I could tp to the entity for a similar time window as for the back command referred to earlier.

  6. Nice, good to hear you're making progress!

    @Tez1010 It may be that you cant set it beyond the default of 60million he refers to.

    Yes sorry I meant you can't tp a mob outside the default +/- 30million border because the game won't let you tp to values that exceed +/- 30million. Even when using relative coordinates. I guess a border you set yourself works differently. I did also think this might make finding the coordinates of a player much easier.

    @Tez1010 He also refers to an operation you cant do only when you are outside the border to test whether you are outside the border. I cant find this - only ones that always work or always don't.

    I think this got fixed a while back, I couldn't get it to work either. Seems like any command you try to run using coordinates beyond +/- 30million fails now.

    The fact that tping back and forth through unloaded chunks won't load them if you use a mob is really strange to me, but convenient for file sizes. Just bear in mind that if you use a player I'm pretty sure they will cause the chunks to generate (haven't tested it though).

    Regarding the types of loaded chunks, not sure what you mean. Are you talking about the difference between entity-processing (or fully loaded) and non-entity processing (lazy chunks)? If it is I don't think that's something you need to worry about because commands like spreadplayers will load the chunk to be entity-processing. If you can tp to the entity it's in a entity-processing chunk.

    If you're interested you can easily tell if a chunk is entity-processing or not by setting up two command blocks with /say in them. Attach one to a redstone clock, and attach the other to a detector rail with a minecart on a looped track. If the chunk is entity-processing both command blocks will work, if not only the redstone clock one will.

    @Tez1010 I could tp to the entity for a similar time window as for the back command referred to earlier.

    This time window is actually linked to the autosave. When the game autosaves every 45 seconds it also tries to unload all the chunks it can. This runs like a clock, so you'll actually find the period of time you're able to tp to the entity is variable depending on when in the clock cycle the chunk was last loaded.
    If you want a visualisation of this Wout came up with an autosave detector a while back:
    https://www.youtube.com/watch?v=oGzQzqtCNY0
    It works because any artificially loaded chunk (e.g. with hoppers) will be unloaded for one tick as the game autosaves before the chunk loaded loads it again.

    I need a rest after typing all that...

  7. Edited 7 years ago by Tez1010

    Yes the video i saw showed all that with the hopper and the minecart. Tping an entity to a chunk does seem to have some interesting properties - you can tp the selected entitiy out again and you can tp to it albeit briefly but you cant run /execute at the entity. It is not a lazy chunk - as the mc edit shows it doesnt exist as such. A pre creation state maybe, which is 'unloaded' when other chunks are unloaded. Or is it just that if you leave the entity there long enough it will create the chunk and thus it is just being unloaded.

    Im sure you are right that if you use the player it will create the chunk in the file even when just passing through.

  8. This is all very weird. I was able to tp an entity to an unloaded chunk (whether generated or not) and the @e selector seemed to be able to find it indefinitely. I could wait as long as I wanted to bring it back as long as the chunk it was in didn't get loaded loaded during that time. I also didn't have any problems running /execute at the entity for as long as I wanted.
    Even stranger if I tpd myself to the entity it was there, but if I reloaded the world and then did the same it wasn't there (or anywhere in fact).

    I also realised that getting the coordinates of a player as a scoreboard value isn't at all helpful for what you want, because you can't use scoreboard values as variables.

  9. Not sure about the execute and entity selection. I may have made a mistake there, needs further investigation I think.

    The vanishing may be something to do with the persistent setting. Just an idea.

    Getting coordinates on the scoreboard is definitely useful as you can effectively reverse the process. Haven't implemented it yet but pretty confident it will work.

  10. If anyone else is reading please feel free to add your comments and queries about commands and command blocks.

  11. I realised just after I posted this that you could use the scoreboard value like that, had a blonde moment.

    @Tez1010 What I had found was that by setting the volume values test appropriately you can check whether the border has been passed.

    I don't understand what you mean by this, would you mind elaborating a bit for stupid me.

    I think the entity vanishing might actually be because the chunks it is in aren't loaded when I exit the game, so they don't get saved at any point after the entity is teleported there.

  12. Edited 7 years ago by Tez1010

    @e(x=0,y=0,z=0,dx=m,dy=n,dz=p) will tell you if an entity is in a box m by n by p with the north west corner at (0,0,0) I called this test the volume values test which was not a great name for it, sorry.

    If you set (x, y, z) at the most negative point on your world, and dx, dy and dz to the size of the world in the respective directions then you can use this to check if the entity is inside the world border.

  13. Edited 7 years ago by PlesleronTepryos

    I need help to make a lever that can only be activated by a certain player. I'm aware of data tags that make a chest openable when holding an item:

    /blockdata [x] [y] [z] {Lock:"Item Name"}

    But how do i make it player specific, not a particular item.

  14. @Tez1010 Me again. I though that might have been what you meant, but couldn't figure out the syntax of spaces and commas. Got there now.

    Regarding tping entities yet again: whether or not you can target the entitiy indefinitely in unloaded chunks seems to depend on the status of where you tp it from. So if you tp it from a chunk that then becomes unloaded the game looses it. But if you tp it from spawn chunks which never get unloaded (unless the server restarts) you can target it to your hearts content.

    The reason why I'm still harping on about this is that you can use it to make a very simple /back command, if the world border is something less than 15million.
    When someone dies summon a marker entity inside the spawn chunks, and then execute /teleport (not tp) for the player, using relative coordinates and adding the diameter of the world border to either the x or z coordinate. You then have a marker a known number of blocks away from the players death location, that never despawns and can be targeted until the server closes. You can then just execute another /teleport command at the marker entity, reverse the relative coordinates and hey presto the player is back where they died. No need to mess around with finding coordinates.
    I did this on SP, not sure if it works on MP - I don't quite understand if you could create a different marker entity for each player that died or not.

    @PlesleronTepryos I don't think that you can. From what I can tell the best you can do test if a specific player is in a certain radius.

  15. Thanks for your thoughts on this. I have done some further investigation.

    I now summon the marker entity by the command block in spawn. It seems if I then tp or teleport that entity to a specific place whether using relative coordinates or not it will stay available. If I tp it to the player that has died it doesn't stay available even though I summon it in spawn. Tp or teleport doesn't seem to make any difference to persistence if you use coordinates. This is true whether entered by command block or directly.

    -----------------------------------------------------------------------
    This is what I think you were suggesting and if I do it

    /execute @a[score_HasDied_min=1] ~ ~ ~ /teleport @e[name=Back,tag=AddID] ~ ~ ~

    it doesn't stay available, although it does take you to the right place. I have tried adding in an offset but that makes no difference.

    ---------------------------------------------
    if I do
    execute @a[score_HasDied_min=1] ~ ~ ~ tp @e[name=Back,tag=AddID] @a[score_HasDied_min=1]

    brings the marker out successfully but it doesn't stay available so I may as well not bother with the execute at the beginning.
    ------------------------------------------------------------
    and if I do

    execute @a[score_HasDied_min=1] ~ ~ ~ tp @e[name=Back,tag=AddID] x y z

    it would stay but I don't know x y z.
    -----------------------------------------------------

    Any further thoughts. My next idea is to just keep teleporting the marker to itself and see if that keeps it available, though I have run out of time to 'work' on it today.

  16. Edited 7 years ago by NutjobBob

    That wasn't quite what I was suggesting. The key part I added was to have the marker entity teleported from spawn to a chunk that can never be loaded, at a coordinates relative to the players death.

    Teleporting entities and then targeting them seems to work as follows:
    Case 1. If origin is loaded and destination is loaded; entity can be targeted until destination unloads
    Case 2. If origin is loaded and destination is unloaded; entity can be targeted until origin unloads UNLESS destination becomes loaded before origin unloads. Then entity can be targeted until destination unloads.

    With the way you have it you're getting the first case whether or not you summon the marker in spawn, so you lose the entity eventually.

    What I did was to run
    /execute @a[score_HasDied_min=1] ~ ~ ~ /teleport @e[name=Back,tag=AddID] ~+210000 ~ ~
    on an entity in spawn

    Which forces the second case, and since the spawn chunks don't unload you can target it indefinitely. The value of 210,000 comes from the world boarder, which I set at 200,000. That way the chunk the marker is in can never be loaded by players, which would prevent you targeting it once that chunk unloads again.

    Then you can just do
    /execute @e[name=Back,tag=AddID] ~ ~ ~ /teleport @a[score_HasDied_min=1] ~-210000 ~ ~

  17. Edited 7 years ago by Retrochewy

    (/give @a minecraft:diamond_block 64) should do the trick! :D

  18. Edited 7 years ago by Tez1010

    That did the trick @NutjobBob! I added a clean up mechanism too by setting them a duration on the scoreboard and deleting when it gets to zero. As they were in unloaded chunks i had to do this.

    The scoreboard is how you differentiate them too. I assign players an id when they join. When the marker is created it is given the same id.

    So now i have a fully functioning and neat back command that works for more that one player, overwrites the previous death if you dont go back and allows you to go back for 5 minutes.

  19. @PlesleronTepryos
    NJB - "I don't think that you can. From what I can tell the best you can do test if a specific player is in a certain radius."

    In addition you could tp away anyone with the incorrect name.

  20. Edited 7 years ago by Tez1010

    @PlesleronTepryos

    lever at x y z redstone connected to:

    impulse /testfor @a[r=5,name=!Name] set radius as small as you can

    chain conditional /setblock x y z minecraft:air

    chain conditional /setblock xy z minecraft:lever d
    where d is the correct data for the lever in the off position

    will only work if only Name is there.

    for others it will reset the lever.

    you will get a slight pulse but there are ways round that

    Addendum to this - i tried it with just one fill block and taking the air out and this was not reliable. You need the air to make sure the pulse is over i think

  21. @Tez1010 Nice! Glad I could help. This behaviour seems kinda glitchy so I wouldn't count on working forever. I think it relates to this bug:

    https://bugs.mojang.com/browse/MC-108469

    Which causes this really weird bug:
    https://bugs.mojang.com/browse/MC-44514
    that seems to let you put a player in an unloaded chunk

or Sign Up to reply!