Animation + Attack when in range

Hey, I just wanted to ask someone more experienced than me if he/she could help me with a script here. Anyway, I got a very basic learning of scripting at the moment but I’m trying to learn it, I want an enemy who is following paths in my game to attack me when he’s a certain range away from me and it will apply damage on me. I also want the enemy to play an animation when he’s attacking - For this I should use Vector3.Distance if I’m correct and and when the player is in range it will play an animation ( Animation.Play or Animation.Crossfade ) - To apply damage on me it should be OnCollisionEnter because I’m using a rigidbody, when the zombie plays an animation and collide with me it will substract health from me.

Now I wonder if someone could put this togheter to a script to me… I know it’s a lot to ask but I’ve been trying for a while now and I don’t get anywhere. I’m very grateful if someone could do this for me.

Well, thanks if someone take their time to help me.

svettgunner, Having someone write the script for you isn’t going to help you, you’re just going to run into more problems down the road when you come to the next problem.

You’ve done a great job of outlining what you need your script to do, and now you need to take the time to learn the basics of scripting (this is a very easy problem) to learn how to put it together. If you are having trouble with traditional tutorials, I recommend 3DBuzz’s Unity Fundamental tutorial: http://www.3dbuzz.com/vbforum/sv_videonav.php?fid=1ec1a7be9c0d4cf9e7a31525250a30ff

For the exact script you are wondering about, you can find it about halfway through this tutorial: http://unity3d.com/support/resources/tutorials/3d-platform-game
However, I would recommend that you start with a much more basic tutorial first.