Index: /code/branches/campaignHS15/data/levels/AITest.oxw
===================================================================
--- /code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10882)
+++ /code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10883)
@@ -35,5 +35,5 @@
     
 <!-- HERE STARTS DEMO FOR THE "WAYPOINTS" -->
-      
+      <!-- 
     <Model mesh="cube.mesh" scale=8 position="  0,2000,-600" />
     <Model mesh="cube.mesh" scale=8 position="  0,2000,-800" />
@@ -57,5 +57,5 @@
       </controller>
     </SpaceShip> 
-   
+    -->
 <!-- HERE ENDS DEMO FOR THE "WAYPOINTS" -->
 
@@ -128,5 +128,5 @@
 <!-- HERE STARTS DEMO FOR FIGHTING -->
     <!-- 
-    <SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
+    <SpaceShip position="-4000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
       <templates>
         <Template link=spaceshipassff />
@@ -140,5 +140,5 @@
       </controller>
     </SpaceShip>
-    <SpaceShip position="-2000, 1900, -1000" lookat="0,0,0" team=0>
+    <SpaceShip position="-4000, 1900, -1000" lookat="0,0,0" team=0>
       <templates>
         <Template link=spaceshipassff />
@@ -149,14 +149,14 @@
       </controller>
     </SpaceShip>
-    <SpaceShip position="-2000, 2100, -1000" lookat="0,0,0" team=0>
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=0>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="-2000, 2400, -1000" lookat="0,0,0" team=0>
+    <SpaceShip position="-4000, 2100, -1000" lookat="0,0,0" team=0>
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=0>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-4000, 2400, -1000" lookat="0,0,0" team=0>
       <templates>
         <Template link=spaceshipassff />
@@ -210,5 +210,5 @@
 <!-- HERE ENDS DEMO FOR FIGHTING -->
 <!-- HERE STARTS DEMO FOR FORMATIONS -->
-    <!-- 
+    
     <Model mesh="cube.mesh" scale=8 position="   0,2000,    0" />
     <Model mesh="cube.mesh" scale=8 position="   0,2000,-2000" />
@@ -259,5 +259,5 @@
       </controller>
     </SpaceShip> 
-    -->
+   
 <!-- HERE ENDS DEMO FOR FORMATIONS -->
     <!-- 
Index: /code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10882)
+++ /code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10883)
@@ -41,4 +41,5 @@
     ActionpointController::ActionpointController(Context* context) : FightingController(context)
     {
+        this->actionCounter_ = 0;
         this->bInLoop_ = false;
         this->bLoop_ = false;
@@ -419,5 +420,5 @@
             return;
         // orxout (internal_error) << "Size of actions is " << this->parsedActionpoints_.size() << endl;
-        if (this->actionCounter_ % 5 == 0)
+        if (this->actionCounter_ % 2 == 0)
             this->startAttackingEnemiesThatAreClose();
         //No action -> pop one from stack
Index: /code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	(revision 10882)
+++ /code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	(revision 10883)
@@ -39,5 +39,4 @@
     {
         RegisterObject(DivisionController);
-        this->actionCounter_ = 0;
         this->setFormationMode(FormationMode::DIAMOND);
         this->target_ = 0;
Index: /code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10882)
+++ /code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc	(revision 10883)
@@ -38,5 +38,5 @@
     FightingController::FightingController( Context* context ): FlyingController( context )
     {
-    	this->attackRange_ = 2500;
+    	this->attackRange_ = 2000;
         this->stopLookingAtTarget();
 
@@ -129,6 +129,10 @@
         
         //too far? well, come closer then
-        if ( diffLength > this->attackRange_ )
-        {
+        if (diffLength > this->attackRange_)
+        {
+            this->spread_ = 300;
+            this->formationMode_ = FormationMode::WALL;
+            this->bKeepFormation_ = true;
+            
             this->setTargetPosition( this->positionOfTarget_ );
         }
@@ -136,4 +140,6 @@
         else if ( diffLength < 500 )
         {   
+            this->bKeepFormation_ = false;
+
             //at this point, just look and shoot
             if ( diffLength < 250 )
@@ -150,4 +156,5 @@
         else if ( !bTargetIsLookingAtThis )
         {
+            this->bKeepFormation_ = false;
             this->setTargetPosition( this->positionOfTarget_ );
         }
@@ -155,4 +162,5 @@
         else 
         {   
+            this->bKeepFormation_ = false;
             if (maneuverCounter_ == 0)
             {
Index: /code/branches/campaignHS15/src/orxonox/controllers/FightingController.h
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	(revision 10882)
+++ /code/branches/campaignHS15/src/orxonox/controllers/FightingController.h	(revision 10883)
@@ -49,4 +49,5 @@
             ControllableEntity* getTarget()
                 { return this->target_; }
+            bool bKeepFormation_;
            
         protected:
Index: /code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10882)
+++ /code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10883)
@@ -124,74 +124,84 @@
         else if (myDivisionLeader_)
         {
-            switch (myDivisionLeader_->getAction())
-            {
-                case Action::FIGHT:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                case Action::FIGHTALL:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                case Action::ATTACK:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                default:
-                {
-                    //formation flight is executed in tick
-                    ControllableEntity* myEntity = this->getControllableEntity();
-            Vector3 myPosition = myEntity->getWorldPosition();
-            if (!this->myDivisionLeader_)
-            {
-                return;
-            }
-            ControllableEntity* leaderEntity = this->myDivisionLeader_->getControllableEntity();
-            Quaternion orient = leaderEntity->getWorldOrientation();
-            Vector3 leaderPosition = leaderEntity->getWorldPosition();
-
-            Vector3 targetRelativePosition = getFormationPosition();
-            if (!this->myDivisionLeader_)
-            {
-                return;
-            }
-            Vector3 targetAbsolutePosition = 
-                (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
-                 + (orient* (targetRelativePosition)));
-            //let ship finish rotating. also don't call copyOrientation to often as it is a slow function.
-            if (this->actionCounter_ % 9 == 0 && !this->bHasTargetOrientation_)
-                this->setAction (Action::FLY, targetAbsolutePosition, orient);
+            if (this->myDivisionLeader_->bKeepFormation_ || !(this->myDivisionLeader_->getAction() == Action::FIGHT 
+                || this->myDivisionLeader_->getAction() == Action::FIGHTALL
+                || this->myDivisionLeader_->getAction() == Action::ATTACK))
+            {
+                ControllableEntity* myEntity = this->getControllableEntity();
+                Vector3 myPosition = myEntity->getWorldPosition();
+                if (!this->myDivisionLeader_)
+                {
+                    return;
+                }
+                ControllableEntity* leaderEntity = this->myDivisionLeader_->getControllableEntity();
+                Quaternion orient = leaderEntity->getWorldOrientation();
+                Vector3 leaderPosition = leaderEntity->getWorldPosition();
+
+                Vector3 targetRelativePosition = getFormationPosition();
+                if (!this->myDivisionLeader_)
+                {
+                    return;
+                }
+                Vector3 targetAbsolutePosition = 
+                    (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
+                     + (orient* (targetRelativePosition)));
+                //let ship finish rotating. also don't call copyOrientation to often as it is a slow function.
+                if (this->actionCounter_ % 9 == 0 && !this->bHasTargetOrientation_)
+                    this->setAction (Action::FLY, targetAbsolutePosition, orient);
+                else
+                    this->setAction (Action::FLY, targetAbsolutePosition);
+
+                if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
+                {
+                    this->boostControl();
+                }
+                else
+                {
+                   this->getControllableEntity()->boost(false);
+                }
+            }
             else
-                this->setAction (Action::FLY, targetAbsolutePosition);
-
-            if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
-            {
-                this->boostControl();
-            }
-            else
-            {
-               this->getControllableEntity()->boost(false);
-            }
-                }
-            }
-            if (this->hasTarget())
-            {
-                //----choose where to go----
-                this->maneuver();
-                //----fire if you can----
-                this->bShooting_ = this->canFire();                
-            }
+            {
+                switch (myDivisionLeader_->getAction())
+                {
+                    case Action::FIGHT:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->chooseTarget();
+                        }
+                        break;
+                    }
+                    case Action::FIGHTALL:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->chooseTarget();
+                        }
+                        break;
+                    }
+                    case Action::ATTACK:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->chooseTarget();
+                        }
+                        break;
+                    }
+                    default:
+                    {
+                        //formation flight is executed in tick 
+                    }
+                }
+                if (this->hasTarget())
+                {
+                    //----choose where to go----
+                    this->maneuver();
+                    //----fire if you can----
+                    this->bShooting_ = this->canFire();                
+                }
+            }
+            
+            
         }
         this->actionCounter_ += this->actionCounter_ < 100000 ? 1 : -this->actionCounter_ ;
@@ -263,4 +273,5 @@
     {
         this->setFormationMode( this->myDivisionLeader_->getFormationMode() );
+        this->spread_ = this->myDivisionLeader_->getSpread();
         Vector3* targetRelativePosition;
         switch (this->formationMode_){
Index: /code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10882)
+++ /code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10883)
@@ -105,72 +105,81 @@
         else if (this->myLeader_)
         {
-            switch (this->myLeader_->getAction())
-            {
-                case Action::FIGHT:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->setTarget(this->myLeader_->getTarget());
-                    }
-                    break;
-                }
-                case Action::FIGHTALL:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->setTarget(this->myLeader_->getTarget());
-                    }
-                    break;
-                }
-                case Action::ATTACK:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->setTarget(this->myLeader_->getTarget());
-                    }
-                    break;
-                }
-                default:
-                {
+            if (this->myLeader_->bKeepFormation_ || !(this->myLeader_->getAction() == Action::FIGHT || this->myLeader_->getAction() == Action::FIGHTALL
+                || this->myLeader_->getAction() == Action::ATTACK))
+            {
+                ControllableEntity* myEntity = this->getControllableEntity();
+                Vector3 myPosition = myEntity->getWorldPosition();
+                if (!this->myLeader_)
+                {
+                    return;
+                }
+                ControllableEntity* leaderEntity = this->myLeader_->getControllableEntity();
+                Quaternion orient = leaderEntity->getWorldOrientation();
+                Vector3 leaderPosition = leaderEntity->getWorldPosition();
+                Vector3 targetRelativePosition = getFormationPosition();
+                if (!this->myLeader_)
+                {
+                    return;
+                }
+                Vector3 targetAbsolutePosition = 
+                    (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
+                     + (orient* (targetRelativePosition)));
+                //let ship finish rotating. also don't call copyOrientation to often as it is a slow function.
+                if (this->actionCounter_ % 9 == 0 && !this->bHasTargetOrientation_)
+                    this->setAction (Action::FLY, targetAbsolutePosition, orient);
+                else
+                    this->setAction (Action::FLY, targetAbsolutePosition);
+                if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
+                {
+                    this->boostControl();
+                }
+                else
+                {
+                   this->getControllableEntity()->boost(false);
+                }
+            }
+            else
+            {
+                switch (this->myLeader_->getAction())
+                {
+                    case Action::FIGHT:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->setTarget(this->myLeader_->getTarget());
+                        }
+                        break;
+                    }
+                    case Action::FIGHTALL:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->setTarget(this->myLeader_->getTarget());
+                        }
+                        break;
+                    }
+                    case Action::ATTACK:
+                    {
+                        if (!this->hasTarget())
+                        {
+                            this->setTarget(this->myLeader_->getTarget());
+                        }
+                        break;
+                    }
+                    default:
+                    {
                     
-            ControllableEntity* myEntity = this->getControllableEntity();
-            Vector3 myPosition = myEntity->getWorldPosition();
-            if (!this->myLeader_)
-            {
-                return;
-            }
-            ControllableEntity* leaderEntity = this->myLeader_->getControllableEntity();
-            Quaternion orient = leaderEntity->getWorldOrientation();
-            Vector3 leaderPosition = leaderEntity->getWorldPosition();
-            Vector3 targetRelativePosition = getFormationPosition();
-            if (!this->myLeader_)
-            {
-                return;
-            }
-            Vector3 targetAbsolutePosition = 
-                (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
-                 + (orient* (targetRelativePosition)));
-            //let ship finish rotating. also don't call copyOrientation to often as it is a slow function.
-            if (this->actionCounter_ % 9 == 0 && !this->bHasTargetOrientation_)
-                this->setAction (Action::FLY, targetAbsolutePosition, orient);
-            else
-                this->setAction (Action::FLY, targetAbsolutePosition);
-            if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
-            {
-                this->boostControl();
-            }
-            else
-            {
-               this->getControllableEntity()->boost(false);
-            }
-                }
-            }
-            if (this->hasTarget())
-            {
-                //----choose where to go----
-                this->maneuver();
-                //----fire if you can----
-                this->bShooting_ = this->canFire();                
-            }
+                    }
+                }
+                if (this->hasTarget())
+                {
+                    //----choose where to go----
+                    this->maneuver();
+                    //----fire if you can----
+                    this->bShooting_ = this->canFire();                
+                }
+            }
+            
+            
         }
         this->actionCounter_ += this->actionCounter_ < 100000 ? 1 : -this->actionCounter_ ;
@@ -182,5 +191,5 @@
         this->setFormationMode( this->myLeader_->getFormationMode() );
         Vector3* targetRelativePosition;
-
+        this->spread_ = this->myLeader_->getSpread();
         if (this->myLeader_->getIdentifier()->getName() == "DivisionController")
         {
