1
Small issue with command blocks, need help!
I'm making an adventure map but I hit a stumbling block. I am trying to set up a system that finds a specific item being thrown and causes specific effects to occur. My problem is that if I want multiple players in this map, I need the command block to target specific players, but I don't know the names of these players.
Please help me out
Please help me out
8
Thank you very much Hokage! I'll let you know if it works!
You're welcome, hope it works for you!
Telemindred
Hokage, what I'm trying to do is this: There are six classes, each with it's own ability. My example will be knight. It's ability is extra damage and speed (ability name: berserk). In order to activate your ability, you throw an individual item given to the player (example: iron block). The payer throws the item and (using the test for command) is given the effects. My problem is giving the effects to the player who threw the item.
If I can get past this problem, many of my ideas will work. that is the issue. I apologize if I wasn't clear before.
I see, well in a testfor command, the item matches this:
/testfor @e[type=Item] {Item:{id:"minecraft:iron_block",tag:{display:{Name:"berserk"}}}}
the item then needs to be given some scoreboard score to 1, so we can execute things from only that item, I'll call it "Monitor" (make sure you add the scoreboard objective in the first place)
/scoreboard players set @e[type=Item] Monitor 1 {Item:{id:"minecraft:iron_block",tag:{display:{Name:"berserk"}}}}
(notice capitalization here, it has to be exactly the name of the item)
then /execute @e[type=Item,score_Monitor_min] ~ ~ ~ /effect @p minecraft:(insert effect name) (seconds) (level of effect above 1) true
Put that in as many effects you wish to give the nearest player.
Then you need to make sure this won't run forever, so you have to kill the item after all of that is run in order, so /kill @e[type=Item,score_Monitor_min].
This happens at the end because we want it to give all the effects and then stop.
I hope this helps!
Telemindred
Just Use
/give @p[r=4] command_block
/effect @p[r=4] 1 10000 120
Just Use
/give @p[r=4] command_block
/effect @p[r=4] 1 10000 120
this is a little vauge, if its a potion you are throwing you can actually just give the potion specific effects via a give command which you could look into, but if you mean just an item thrown on the ground, try something like giving a scoreboard score of 1 of some dummy objective to the specific item you want to give the effect
Hokage, what I'm trying to do is this: There are six classes, each with it's own ability. My example will be knight. It's ability is extra damage and speed (ability name: berserk). In order to activate your ability, you throw an individual item given to the player (example: iron block). The payer throws the item and (using the test for command) is given the effects. My problem is giving the effects to the player who threw the item.
If I can get past this problem, many of my ideas will work. that is the issue. I apologize if I wasn't clear before.
TelemindredI'm making an adventure map but I hit a stumbling block. I am trying to set up a system that finds a specific item being thrown and causes specific effects to occur. My problem is that if I want multiple players in this map, I need the command block to target specific players, but I don't know the names of these players.
Please help me out
this is a little vauge, if its a potion you are throwing you can actually just give the potion specific effects via a give command which you could look into, but if you mean just an item thrown on the ground, try something like giving a scoreboard score of 1 of some dummy objective to the specific item you want to give the effect (that will be explained soon), then something like this
/execute @e[type=item,score_(Insert objective name):1,score_(objective name)_min] ~ ~ ~ /effect @a[r=(range to give players effects around the item)] minecraft:(effect name) (seconds to give them the affect, max=1000000) (multiplier,level of effect=this number+1) true
I know it may look complicated, but I tried to make it open to your discretion on what to put in.
@p[r=5,name=<PlayerName>]
/\
|
|
I think this may help, but it probably won't!
/\
|
|
I think this may help, but it probably won't!
I would omit the "name=<playername>" because we don't know what the user name of the player in question using the map so it would just be @p[r=5]
