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.
Partwise confirmed for1.8.4The 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:
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:
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:
Target S1 -> Target P1 -> Target S1 and S2
Target S2 -> Target P1 -> Target S1 and S2
So it would replace the bow twice in theory.