1

Small issue with command blocks, need help!

Telemindred 4/5/15 1:28 pm
468
4/13/2015 1:54 pm
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
Posted by
Telemindred
Level 14 : Journeyman Mage
12

  Have something to say?

JoinSign in

8

Telemindred
04/13/2015 12:23 pm
Level 14 : Journeyman Mage
Thank you very much Hokage! I'll let you know if it works!
1
hokage3211
04/13/2015 1:54 pm
Level 53 : Grandmaster Nerd Programmer
You're welcome, hope it works for you!
1
hokage3211
04/13/2015 11:32 am
Level 53 : Grandmaster Nerd Programmer
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!
1
YTCereal
04/12/2015 1:44 pm
Level 22 : Expert Network
Telemindred

Just Use

/give @p[r=4] command_block

/effect @p[r=4] 1 10000 120
1
Telemindred
04/12/2015 1:25 pm
Level 14 : Journeyman Mage
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.
1
hokage3211
04/12/2015 11:06 am
Level 53 : Grandmaster Nerd Programmer
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.
1
cakeface
04/05/2015 1:33 pm
Level 39 : Artisan Cake
@p[r=5,name=<PlayerName>]

/\
|
|

I think this may help, but it probably won't!
1
Dr_Steve
04/05/2015 1:36 pm
Level 43 : Master Creeper
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]
1

Welcome