Playing an animation when AI gets to a point.

I’m really bad with scripting, so if any of you guys know some really good scripting tutorials about javascript (suitable for 12 year olds) that would be great!

well, i was wondering how to play a animation when a object with a AI script gets to a certain point,
for example:

If the object runs, it will play a running animation,
If the object attacks, it will play a attacking animation,

Just wondering how to make animations play at these points, thanks!

You could just set up triggers and when the NPC hits the trigger (Off screen) play the animation and so on for others works well for us

There’s certain ways, like if you’re AI script calls a function that will make it run do animation.Play();
If it calls a function for attacking do the same thing

thanks for your replies!

sorry julz11 tutorials were not build on keeping age in mind, they were build for beginners and for experts. so you need to learn beginners tutorials. and unity uses unityscript little bit same as java script but you cannot say it “java script”. as far as i know there are few books to learning unityscript and unity

  1. Unity Game Development Essentials
  2. Packtpub.Unity.3D.Game.Development.by.Example.Beginners.

you can learn both they give you simple definition of every thing you learn…
and you said you are 12 years old i will suggest you to concentrate on your studies, unity is there for you any time you want but at this age it will be little tuff for you

yeah, i guess. thanks for your reply