x


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.

more ▼

asked Jun 26 '11 at 06:15 PM

svettgunnar gravatar image

svettgunnar
16 14 18 20

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jun 26 '11 at 06:27 PM

Thom Denick gravatar image

Thom Denick
1.9k 13 20 38

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x383
x248
x156
x106
x2

asked: Jun 26 '11 at 06:15 PM

Seen: 1434 times

Last Updated: Jul 19 '11 at 01:05 AM