- Home /
Flying AI enemy with many tasks
I have a 3D enemy that I created. I need a script to make that enemy fly, summon other 2 enemies, shoot on me and then fly up me, throw something on me and do all this again. The enemy should be hard to kill. It should go like that:
- Fly from the base;
- Stop somewhere;
- Land and summon enemy1;
- Wait few seconds;
- Take off;
- Go another plase;
- Land and summon enemy2;
- Wait few seconds;
- Take off;
- Fly to my plase while shoot on me;
- Stop shoot and drop someting on me;
- Fly back to the base;
- Wait until enemy1 die (if enemy1 died befor - wait few seconds);
- Do all this again;
The flying from and to the base should be faster then the other tasks. If it to hard to make I understand it.
Sorry for poor english.
Answer by poncho · Feb 21, 2011 at 08:51 PM
Dude, you have the right algorithm, just need to be creative in the moment of scripting, try to make exactly as you request, and after some time you will learn to make AI scripts
good luck
First: I know how to scrip, unity is not new for me. second: I don't know how to make it fly, go to a random plase and fly up to me. The other task I think I know how to do.
making something "fly" is just changing the position of the object on mid air, this means that is not Touching the floor, thats flying. the other thing, going from the original position to the player position can be done by vector3.Lerp method, that needs the origin position and destination, in this case the origin position is the enemy position and the destination is your player, also to make it attack you can calculate player position on what his position is and his movements are, just some basic physics and you are done, as i said, just a little thinking and you will give birth your own AI
you can google AI, or something, but mainly is, "what would you do in case of", just try to script it