AI for FPS/TPS game

i want a script (Enemy Artificial Intelligence) for my TPS game !
When i am behing the wall the enemy dont see me
when they see me…they shoot at me after a time interval…say 1-2 seconds !
when they see me …after that i hide…they try to throw grenades at that location
and comes to that locations and search for me
also when i make noise like running,shooting without silencer…they know about my location so they run towards me…

Ya know, what you just typed looks like pseudocode to me…:wink:

For example, for the first part, shoot a ray to check if the enemy can see you. Check if it hits something, if it does, register the hit time and check it when 1-2 seconds elapses. After the elapsed time, shoot another ray, if you are visible, the enemy will shoot you, if you are not visible, the enemy will throw a grenade. You could randomize or prioritize whether the enemy will throw a grenade or pursue you, etc…

Create an outline of what you want the AI to do. Break down each part. Then figure out how to do each part.