1

Weird command question.

EquallyEpic's Avatar EquallyEpic2/26/17 12:31 pm
3/4/2017 2:51 am
Myyoyo's Avatar Myyoyo
Hey guys and gals, I was wondering if there's a way for an item to carry an internal command?
Example:
Right-clicking with a custom bone will for example do "/teleport @p x y z" without having a command block testing for it?

Random question I know, but having an item carry a command instead of a command block works better since it's the player closest to the bone or whatever that gets teleported instead of the player closest to the command block testing for it, why does it matter?

I wanna make a survival world that's controlled by command blocks and items that I can share here, and I want the people downloading it be able to play it on either single or multiplayer without forcing them to get plugins, mods or whatever to get it to work.

That means that they can just download it and even throw it into a vanilla non-spigot/bukkit server and play it with just their friends or if they wanna throw it into a public server knowing that they don't have to do anything at all and it'll just work.

I have a spawn area for that world and everything, also with some nice features that'll be helpful in a survival, I don't wanna spoil anything in case this even works, otherwhis I'll have to do a like test for scoreboard thing if that's even a thing to teleport the right player.
Posted by EquallyEpic's Avatar
EquallyEpic
Level 2 : Apprentice Crafter
1

Create an account or sign in to comment.

15

1
03/04/2017 2:51 am
Level 65 : High Grandmaster Wolf Whisperer
Myyoyo
Myyoyo's Avatar
Skript plugin
on rightclick with bone named "name"
teleport the player to x y z
1
03/04/2017 1:23 am
Level 1 : New Miner
Nickiosaurus
Nickiosaurus's Avatar
Testing for right click on any items, that can't be used or placed, like this custom bone, is impossible without the use of some other program. Personally the carrot on a stick is my favorite as it pretty much has no practical use. Many map creators will give it a custom texture in their map so it doesn't appear as a carrot on a stick.

EquallyEpicNot even like a "scoreboard" thing? or do you know of a more reliable multiplayer teleport with command blocks or something?


The carrot on a stick is so great. Here's how to do it:
Click to reveal
Personally I call mine reset, as it's use is mainly parkour level reset for myself.
Create scoreboard objective.
/scoreboard objectives add Reset stat.useItem.minecraft.carrot_on_a_stick
(Repeating Command Block)
/testfor @a[score_Reset_min=1]
(Conditional Chain Command Block)
/tp @a[score_Reset_min=1] x y z
(Conditional Chain Command Block)
/scoreboard players set @a[score_Reset_min=1] Reset 0
And that's it!

You can create a scoreboard objective for people with a bone currently held in their hand. Here's how:

Command Block Setup
Click to reveal
*HoldingBone is of type dummy
(Repeating Command Block)
/scoreboard players set @a HoldingBone 1 {SelectedItem:{id:"minecraft:bone"}}

You can than use a selecter to find people holding the bones instead of a tag.
(Conditional Chained Command Block)
/tp @a[score_HoldingBone_min=1] x y z

Reset their score after TP
(Conditional Chained Command Block)
/scoreboard players set @a[score_HoldingBone_min=1] HoldingBone 0

Hope this helps, not sure exactly what everybody needed, little hard for me to read to be honest, but have used both these methods before.
1
03/02/2017 4:15 am
Level 2 : Apprentice Crafter
EquallyEpic
EquallyEpic's Avatar
That would be awesome Pyro, I hope you can figure that out
1
02/28/2017 10:35 am
Level 34 : Artisan Nerd
PyroCreative
PyroCreative's Avatar
I have a solution

Put this is a repeating command block:-
/testfor @p[r=8000] {SelectedItem:{id:"minecraft:bone"}}
Put this in a conditional chain block:-
/tp @p ~ ~ ~2 [or x y z]
OR /tp @p @r [not sure if this one works]
1
02/28/2017 9:59 am
Level 2 : Apprentice Crafter
EquallyEpic
EquallyEpic's Avatar
Ooh, so that's why it didn't work xD That beeing said though, there's NBT tags you can assign to items actually, so if there's a way to look for that NBT tag and teleports you while ducking with it, that would be awesome.

Example code:
/give @p minecraft:web 1 0 {tag:(tp)}
1
02/28/2017 10:10 am
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
Scoreboard tags are stored as NBT tags, but not every NBT tag is a scoreboard tag.

NBT tags are just data for entities and tile entities, they can't just make you tp automatically. You need to set up a command block system for that.

Try doing some more simple stuff first to gain experience with how to make command block systems. Because you don't seem to understand what is and what isn't possible.
1
02/27/2017 4:34 pm
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
EquallyEpic
Okay, so i figured out how to give myself an item with the tag, now I just have to figure out how to teleport whoever holds that item...

/tp @a[tag=TAGHERE] x y z didn't work for some reason, yeah I changed the values, but shouldn't there be something like isHolding or something like that somewhere?


I don't think you understand what tags are. Tags don't do anything except store a string on an entity. They're used to tag someone so you can target them later. You can't give items with tags.
1
02/26/2017 4:50 pm
Level 2 : Apprentice Crafter
EquallyEpic
EquallyEpic's Avatar
Pepijn
Don't use testfor commands, you don't need them most of the time. The basics of this is to assign a tag to whoever is holding the item and crouching, then use /tp @a[tag=TAGHERE] x y z to for example teleport them. In practice it's not that simple because you need to reset properly (which is a bit tricky in this situation).


Okay, so i figured out how to give myself an item with the tag, now I just have to figure out how to teleport whoever holds that item...

/tp @a[tag=TAGHERE] x y z didn't work for some reason, yeah I changed the values, but shouldn't there be something like isHolding or something like that somewhere?
1
02/26/2017 4:38 pm
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
EquallyEpicPepijn, Okay, couching while holding works too, that is if it doesn't teleport whatever player that's the closest to the testfor command block


Don't use testfor commands, you don't need them most of the time. The basics of this is to assign a tag to whoever is holding the item and crouching, then use /tp @a[tag=TAGHERE] x y z to for example teleport them. In practice it's not that simple because you need to reset properly (which is a bit tricky in this situation).
1
02/26/2017 4:33 pm
Level 2 : Apprentice Crafter
EquallyEpic
EquallyEpic's Avatar
Pepijn, Okay, crouching while holding works too, that is if it doesn't teleport whatever player that's the closest to the testfor command block

CHorse, I know, though you can have the scoreboard as an ID holder aswell, just have the scoreboard assign a "login ID" of sort, so let's say 1 person joins, then you can assign that player for example 1 "death" and the next one with 2 "death" and then have the command blocks look for their "death ID" I know that the "death counter" isn't a constant, but it was the only thing I could think of right now.
1
02/26/2017 3:08 pm
Level 39 : Artisan Fish
CHorse
CHorse's Avatar
Ye do realize that scoreboard only keeps track of variables right? The only way is to /testfor or /execute at everyone who has a bone in a designated slot, and then /testfor or /execute them right-clicking with it and then teleporting them there. And for that ye will need to set up a few scoreboard objectives.
1
02/26/2017 3:07 pm
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
There's, in my opinion, no nice way to do rightclick detection. So I always try to avoid it. I sometimes use crouching while holding a certain item as a trigger.
1
02/26/2017 2:29 pm
Level 2 : Apprentice Crafter
EquallyEpic
EquallyEpic's Avatar
Not even like a "scoreboard" thing? or do you know of a more reliable multiplayer teleport with command blocks or something?
1
02/28/2017 10:39 am
Level 34 : Artisan Nerd
PyroCreative
PyroCreative's Avatar
Wait till i try to make a one command machine
1
02/26/2017 12:41 pm
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
Nope, sorry.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome