4

I'm making a game that requires for a lightning bolt to be spawned above everyone's heads every 3 seconds (so that they can be tracked). However, if a player is standing directly below another player when the lightning strikes, the lightning deals damage to the player above. Is there any NBT tag I could use to negate lightning damage? If not, can you think of any other possible workarounds?

6

When summoning a LightningBolt with /summon, NBT input is ignored, so there is no NBT data you can provide.

As an alternative, 1.9 introduces a new block called the End Gateway, which produces beams of light similar to beacons. Unlike beacons, there is no need for a specific structure and the beam will go through all blocks (both upwards and downwards).

You could potentially setblock an end gateway at Y0 via /execute to produce the same sort of effect without damaging the player. The Age long tag for end gateways will create a magenta beam of light so long as the value is below 200, so you can use that to specify the duration the beam should last for.

/execute @p ~ ~ ~ /setblock ~ 0 ~ minecraft:end_gateway 0 replace {Age:160l}

Note that end gateway blocks will not teleport entities if the ExitPortal compound is not defined, but its beam will still become yellow if an entity enters it while Age is 200 or higher. If you wanted yellow beams instead of magenta, you could create the end gateway as well as summon an entity that will despawn after a set amount of time.

For example, the following creates an end gateway with an AreaEffectCloud entity inside it that will despawn after 100 ticks (5 seconds):

/execute @p ~ ~ ~ /setblock ~ 0 ~ minecraft:end_gateway 0 replace {Age:200l}
/execute @p ~ ~ ~ /summon AreaEffectCloud ~ 0 ~ {Duration:100}
| improve this answer | |
-2

Connect this to a three second clock attach it to a command block

/execute @a ~ ~3 ~ summon LightningBolt ~ ~ ~

The command summons a lightning bolt a block above a players head

| improve this answer | |
  • 1
    That is exactly the command that the OP cannot use. – Skylinerw Jun 16 '16 at 6:02
  • @Skylinerw sorry i edited it a bit don't know if it helps – i am link Jun 30 '16 at 2:39
-3

/execute @e[type=!player,type=!item,type=!item_frame] ~ ~3 ~ summon LightningBolt ~ ~ ~

| improve this answer | |
  • 3
    Just like in the other down-voted answer, simply summoning a lightning bolt is not enough. Also you're excluding players, which is not asked. – dly Jun 10 '19 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.