mojira.dev
MC-80060

Skeletons with Bows don't shoot if they used to use a sword

I was working on a little command block device to make Skeletons better in combat. It basically had skeletons switch to a sword if the player got within 5 blocks range. Everything seemed to be fine at first, until I found the Skeleton does not switch it's AI back to archer mode if it switches from sword back to bow after having been using a sword

I attatched my world file so you can try it. Just spawn a skeleton, go into survival and go into range of it. Once it switches to sword, run away and see how it keeps chasing you even after it gets a bow.

Attachments

Comments 1

Partwise confirmed for

  • 1.8.4

The Skeleton shoots actually, but for whatever reason, it comes really close to you to shoot (so close that your mechanic will switch its weapon back to the sword)

Invalid

You made a mistake with one command:

execute @e[type=Skeleton,score_AttackMode=1] ~ ~ ~ execute @p[rm=6] ~ ~ ~ entitydata @e[type=Skeleton,score_AttackMode=2,rm=6] {Equipment:[{id:"minecraft:bow"}]}

This gets also activated if the score of AttackMode is 0, you need *score_AttackMode_min=1* to do this operation only for entities with the score of exactly 1.

And I think you might consider the execute command one the player as first command instead:

/execute @a ~ ~ ~ entitydata @e[type=Skeleton,score_AttackMode=2,rm=6] {Equipment:[{id:"minecraft:bow"}]}

Sketch:
S1 S2 P1

S1 = Skeleton 1
S2 = Skeleton 2
P1 = Player 1

Now imagine using your code.
This is a assumed order in which the game runs the commands:

  1. Target S1 -> Target P1 -> Target S1 and S2

  2. Target S2 -> Target P1 -> Target S1 and S2

So it would replace the bow twice in theory.

Daniel Bradley

(Unassigned)

Unconfirmed

Minecraft 1.8.4

Retrieved