1

I want a certain iron bar block , or rather a lot of iron bar blocks , To damage a player if he walks into it. Electric fence effect. I've tried without success:

/kill @e[x=X,y=Y,z=Z,r=1] 

(last resort)

And I thought of summoning a no A.I ,invulnerable ,and invisible mob to sit in the area but i thought that the mob would just despawn and i need it there 24/7.

If possible i would like it to play an effect in the same area that the player was harmed (smoke) . This is all for an adventure map.

1 Answer 1

1

If you want every player at every point in your map that is standing inside an iron_bar to die instantly, you should be able to do this:

/execute @a ~ ~ ~ detect ~ ~ ~ iron_bars * /kill @a[c=1]

(add this command as well if you want them to die if only their head is inside iron bars:

/execute @a ~ ~ ~ detect ~ ~1 ~ iron_bars * /kill @a[c=1]

)


If you want it to be in specific places, you could do things like

/kill @a[x=X,y=Y,z=Z,dx=DX,dy=DY,dz=DZ]

use the delta values to define a cuboid area. you'd have to repeat this command for every area you want to define.

the other possibility to do this would be to summon an entity in those places and execute off of those.
you mentioned this above already, and let me make a few things clear: many entities (mobs) can be give the {PersistenceRequired:1} tag to make sure they don't despawn, except a player kills them.
The best way to mark an area are "area_effect_clouds", which don't render in spectator mode and can't be interacted with by the player (no killing, no pushing, nothing). the only downside (which you can work around however) is the fact that they do despawn on their own if a certain criteria (their Age tag is greater than their Duration tag) is met. this can be worked around by either setting the Duration to a very high number ({Duration: 2147483647} will make the AEC last for over 3 years realtime) or resetting the age tag using /entitydata @e[type=area_effect_cloud,<more selector parameters> {Age:0} occasionally.

Now that we have that out of the way, you are then able to execute off of those entities like so

/execute @e[type=area_effect_cloud] ~ ~ ~ /kill @a[r=1]

or even execute particles off of them

/execute @e[type=area_effect_cloud] ~ ~ ~ /particles <...>
1
  • Absolutely Perfect Thanks. A little time consuming but its working fine.
    – Reflexive
    Jan 2, 2017 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .