Index: /code/branches/ai/src/orxonox/controllers/AIController.cc
===================================================================
--- /code/branches/ai/src/orxonox/controllers/AIController.cc	(revision 6694)
+++ /code/branches/ai/src/orxonox/controllers/AIController.cc	(revision 6695)
@@ -50,4 +50,6 @@
     {
         if (this->state_ == MASTER) freeAllSlaves();
+        if (this->state_ == SLAVE) unregisterSlave();
+        this->slaves.clear();
     }
 
@@ -60,10 +62,9 @@
         {
 
+            //this->state_ = MASTER;
             // search master
-            random = rnd(maxrand);
-            if (random < 50 && (!this->target_))
+            //random = rnd(maxrand);
+            //if (random < 101 && (!this->target_))
                 this->searchNewMaster();
-
-
 
         }
@@ -78,4 +79,5 @@
             // command slaves
             this->commandSlaves();
+
             // search enemy
             random = rnd(maxrand);
@@ -130,12 +132,12 @@
                 this->aimAtTarget();
 
-            /*if (this->bHasTargetPosition_)
+            if (this->bHasTargetPosition_)
                 this->moveToTargetPosition();
-*/
+
             if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0f))
                 this->getControllableEntity()->fire(0);
         }
 
-        if (this->state_==SLAVE)
+        if (this->state_ == SLAVE)
         {
 
Index: /code/branches/ai/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- /code/branches/ai/src/orxonox/controllers/ArtificialController.cc	(revision 6694)
+++ /code/branches/ai/src/orxonox/controllers/ArtificialController.cc	(revision 6695)
@@ -44,4 +44,6 @@
 
         this->target_ = 0;
+        this->myMaster_ = 0;
+        //this->slaveNumber_ = -1;
 	this->team_ = -1;//new
 	this->state_ = FREE;//new
@@ -95,6 +97,14 @@
     }
 
+    void ArtificialController::unregisterSlave() {
+        if(myMaster_)
+        {
+            myMaster_->slaves.remove(this);
+        }
+    }
+
     void ArtificialController::searchNewMaster()
     {
+
         if (!this->getControllableEntity())
             return;
@@ -106,47 +116,62 @@
         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
         {
-            //same team? no: continue
+
+            //same team?
             if (!ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
                 continue;
 
-            //has it an ArtificialController and is it a master? no: continue
+            //has it an ArtificialController and is it a master?
+            if (!it->getController())
+                continue;
 
             ArtificialController *controller = static_cast<ArtificialController*>(it->getController());
-            if (controller && controller->getState() != MASTER)
+            if (!controller || controller->getState() != MASTER)
                 continue;
 
             //is pawn oneself? && is pawn in range?
-            if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity() /*&& it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) < 1000 */)
+            if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity()) //&& it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) < 1000 
             {
-                //this->target_ = (*it);
-                //this->targetPosition_ = it->getPosition();
                 this->state_ = SLAVE;
-
+                this->myMaster_ = controller;
+                controller->slaves.push_back(this);
+                break;
             }
         }//for
 
         //hasn't encountered any masters in range? -> become a master
-        if (state_!=SLAVE) state_=MASTER; // keep in mind: what happens when two masters encounter eache other? -> has to be evaluated in the for loop of within master mode in AIcontroller...
+        if (state_!=SLAVE) state_ = MASTER; // keep in mind: what happens when two masters encounter eache other? -> has to be evaluated in the for loop within master mode in AIcontroller...
+
     }
 
     void ArtificialController::commandSlaves() {
 
+        for(std::list<ArtificialController*>::iterator it = slaves.begin(); it != slaves.end(); it++)
+        {
+            (*it)->setTargetPosition(this->getControllableEntity()->getPosition());
+        }
+/*
         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
         {
+
+            if (!it->getController())
+                continue;
+
             ArtificialController *controller = static_cast<ArtificialController*>(it->getController());
-            if (controller && controller->getState() != MASTER)
-                continue;
-
+            if (!controller || controller->getState() != SLAVE)
+                continue;
+            //controller->setTargetPosition(this->getControllableEntity()->getPosition());
             controller->targetPosition_ = this->getControllableEntity()->getPosition();
-        }
-
+            controller->bHasTargetPosition_ = true;
+        }
+*/
     }
 
     void ArtificialController::freeAllSlaves()
     {
+
         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
         {
             ArtificialController *controller = static_cast<ArtificialController*>(it->getController());
-            if (controller && controller->getState() != MASTER)
+            if (controller && controller->getState() != SLAVE)
                 continue;
 
Index: /code/branches/ai/src/orxonox/controllers/ArtificialController.h
===================================================================
--- /code/branches/ai/src/orxonox/controllers/ArtificialController.h	(revision 6694)
+++ /code/branches/ai/src/orxonox/controllers/ArtificialController.h	(revision 6695)
@@ -61,7 +61,11 @@
             enum State {SLAVE, MASTER, FREE};
             int getState();
+            std::list<ArtificialController*> slaves;
+            void unregisterSlave();
             void searchNewMaster();
             void commandSlaves();
             void freeAllSlaves();
+
+            ArtificialController *myMaster_;
 
             void setTargetPosition(const Vector3& target);
