Index: /trunk/src/ai/ai_team.cc
===================================================================
--- /trunk/src/ai/ai_team.cc	(revision 10514)
+++ /trunk/src/ai/ai_team.cc	(revision 10515)
@@ -54,8 +54,15 @@
 
 				Vector targetPos=target->getAbsCoor();
+				float distanceToPlayer=(targetPos-position).len();
+
 				int zNorm=(position.z>targetPos.z)?1:-1;
 
-				if((position.z-targetPos.z)*zNorm>60){	//go to start position
-					//std::cout << "Go Start Position\n";
+				if(distanceToPlayer<attackDistance+60){	//### change wakeup distance here
+					std::cout << "AI Sleeps \n";
+					changeSwarmModule(it, new SwarmWait);
+					maxTime=1000;	//sleep 2 seconds..
+				}else{
+				/*if((position.z-targetPos.z)*zNorm>60){	//go to start position
+					std::cout << "Go Start Position\n";
 					changeSwarmModule(it, new SwarmGoRel);
 					zNorm=1-(rand()%2)*2;	//1 or -1
@@ -63,21 +70,22 @@
 					speed=60;
 				}else if(position.x > targetPos.x+attackDistance+40){	//go to attack position
-					//std::cout << "Go Attack Position\n";
+					std::cout << "Go Attack Position\n";
 					changeSwarmModule(it, new SwarmGoRel);
-					newPosition=Vector(attackDistance+30,0,0);
+					newPosition=Vector(attackDistance+30,0,0)
 					speed=60;
-				}else if(position.x > targetPos.x+attackDistance+20){	//go to attack mode
-					//std::cout << "Go Attack Mode\n";
+				}else if(position.x > targetPos.x+attackDistance+20){	//go to attack mode;
+					std::cout << "Go Attack Mode \n";*/
+					std::cout << "AI Attacks \n";
 					changeSwarmModule(it, new SwarmAttack);
 					newPosition=Vector(attackDistance,0,0);
 					speed=60;
-					maxTime=(rand()%11)+4;//4-14 Sekunden
-				}else{												//go to fallback point
-					//std::cout << "Go  Fallback Point\n";
+					maxTime=(1000);//rand()%11)+4;//4-14 Sekunden
+				/*}else{												//go to fallback point
+					std::cout << "Go  Fallback Point\n";
 					changeSwarmModule(it, new SwarmGoRel);
 					newPosition=Vector(80,0,zNorm*90);
-					speed=80;
+					speed=80;*/
 				}
-			}else{
+			//}else{
 
 			}
Index: /trunk/src/ai/attack_module.cc
===================================================================
--- /trunk/src/ai/attack_module.cc	(revision 10514)
+++ /trunk/src/ai/attack_module.cc	(revision 10515)
@@ -54,4 +54,6 @@
 void AttackModule::process(float dt)
 {
+	//PRINTF(0)("attack process\n");
+
 	if(npc == NULL)return;
 
@@ -116,5 +118,5 @@
 	Vector vectorToDestination=destination-myPosition;
 
-	Vector correction=		playerCollision*50*3 *6/myRadius
+	Vector correction=		playerCollision*40*3 *6/myRadius
 								+	npcCollision*50*3 *6/myRadius
 								+	destinationMovement*2//-movement
@@ -147,5 +149,5 @@
 
 	view = target->getAbsCoor()+randomView-myPosition;
-	view = view.cross( Vector(0,1,0) ).getNormalized();
+	view = view.cross( Vector(0,-1,0) ).getNormalized();
 
 	npc->setAbsDirSoft( Quaternion( view, Vector(0,1,0)),8/myRadius);
@@ -156,5 +158,5 @@
 		if(fireTimeout<=0){
 			fireTimeout=(rand()%21)/10+1;
-			std::cout << "Fiiiiirrreee!\n";
+			//std::cout << "Fiiiiirrreee!\n";
 			NPC* npc2 = static_cast<NPC*>(npc);
 			npc2->fire();
Index: /trunk/src/ai/movement_module.cc
===================================================================
--- /trunk/src/ai/movement_module.cc	(revision 10514)
+++ /trunk/src/ai/movement_module.cc	(revision 10515)
@@ -140,5 +140,5 @@
 
 	//rotate NPC
-	view = movement.cross( Vector(0,1,0) ).getNormalized();
+	view = movement.cross( Vector(0,-1,0) ).getNormalized();
 	npc->setAbsDirSoft( Quaternion( view, Vector(0,1,0)),10/myRadius);
 
Index: /trunk/src/ai/swarm_wait.cc
===================================================================
--- /trunk/src/ai/swarm_wait.cc	(revision 10514)
+++ /trunk/src/ai/swarm_wait.cc	(revision 10515)
@@ -19,4 +19,10 @@
 void SwarmWait::process(float dt)
 {
+	if(taskRelObject!=NULL){
+		Vector distVect=taskRelObject->getAbsCoor()-getSwarmPosition();
+		float distance=distVect.len();
+		if(distance<attackDistance+60)taskComplete=true;		//### change wakeup distance here
+	}
+
 	taskMaxTime-=dt;
 	if(taskMaxTime<=0)taskComplete=true;
Index: /trunk/src/story_entities/game_world.cc
===================================================================
--- /trunk/src/story_entities/game_world.cc	(revision 10514)
+++ /trunk/src/story_entities/game_world.cc	(revision 10515)
@@ -331,4 +331,9 @@
     /* network synchronisation */
     this->synchronize ();
+
+	 /* perform ai check*/
+	 this->checkAI();
+
+	 this->update ();
     /* process time */
     this->tick ();
@@ -344,7 +349,4 @@
     /* collision reaction */
     this->collisionReaction ();
-
-    /* perform ai check*/
-    this->checkAI();
 
     /* check the game rules */
Index: /trunk/src/world_entities/particles/particle_system.cc
===================================================================
--- /trunk/src/world_entities/particles/particle_system.cc	(revision 10514)
+++ /trunk/src/world_entities/particles/particle_system.cc	(revision 10515)
@@ -135,5 +135,9 @@
     {
       if (emitter->isA(ParticleEmitter::staticClassID()))
+      {
+        // init the emitertter with the coordinates of the system
+        dynamic_cast<ParticleEmitter*>(emitter)->setAbsCoor(this->getAbsCoor());
         this->addEmitter(dynamic_cast<ParticleEmitter*>(emitter));
+      }
       else
       {
