Index: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10924)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10925)
@@ -110,4 +110,7 @@
         }
 
+        if (!this || !this->getControllableEntity())
+            return;
+
         if (this->ticks_ == 1)
         {
@@ -143,8 +146,5 @@
             this->lookAtTarget(dt);
         }
-        if (this->bShooting_)
-        {
-            this->doFire();
-        }
+        
 
         if (!this || !this->getControllableEntity())
@@ -159,38 +159,36 @@
         if (timeout_ <= 0)
             this->bFiredRocket_ = false;
-        if (!this || !this->getControllableEntity())
-            return;
+        
 
         if (!this || !this->getControllableEntity())
             return;
         if (this->timeout_ > 0 && this->bFiredRocket_)
-            {
-                this->timeout_ -= dt;
-            }
-            if (this->bStartedDodging_)
-            {
-                this->timeDodged_ += dt;
-            }
-            maneuverCounter_ += dt;
+        {
+            this->timeout_ -= dt;
+        }
+        if (this->bStartedDodging_)
+        {
+            this->timeDodged_ += dt;
+        }
+        maneuverCounter_ += dt;
+
         if (!this || !this->getControllableEntity())
             return;
         //maneuver every 0.25 sec -> 
         int step =  4;
-        if (this->hasTarget() && ActionpointController::sTicks_ % 100 == step * (this->actionpointControllerId_))
-        {
-            
-        }
         if (ActionpointController::sTicks_ % 100 == step * this->actionpointControllerId_ + 1)
         {
+            //orxout (internal_error) << "Team " << this->getControllableEntity()->getTeam() << (this->hasTarget() ? ", got " : ", don't have") << " target" << endl;
             this->action();
         }
-        if (!this || !this->getControllableEntity())
-            return;
-
-        
-        if (this->hasTarget() &&  ActionpointController::sTicks_ % ActionpointController::nextActionpointControllerId_ == (this->actionpointControllerId_))
+
+
+        if (!this || !this->getControllableEntity())
+            return;
+
+        if (this->hasTarget() &&  ActionpointController::sTicks_ % (ActionpointController::nextActionpointControllerId_ + 1) == (this->actionpointControllerId_))
         {
             if (maneuverCounter_ > 6.0f)
-                maneuverCounter_ = 0;
+                this->maneuverCounter_ = 0;
             if (this->bStartedDodging_ &&  this->timeDodged_ > 4.0f)
             {
@@ -199,12 +197,20 @@
             }
             if (!this || !this->getControllableEntity())
-            return;
+                return;
             this->maneuver();
             if (!this || !this->getControllableEntity())
-            return;
+                return;
             this->bShooting_ = this->canFire();
-        }
-        if (!this || !this->getControllableEntity())
-            return;
+
+            if (!this || !this->getControllableEntity())
+                return;
+
+            if (this->bShooting_)
+            {
+                this->doFire();
+            }
+            this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp;
+            this->previousHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth();
+        }
         
 
@@ -227,6 +233,5 @@
             return;
 
-        this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp;
-        this->previousHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth();
+
         if (!this || !this->getControllableEntity())
             return;
@@ -514,4 +519,7 @@
         }
         this->setAction (p.action);
+        if (!this || !this->getControllableEntity())
+            return;
+
         switch (this->action_)
         {
@@ -654,4 +662,7 @@
     void ActionpointController::moveBackToTop()
     {
+        if (!this || !this->getControllableEntity())
+            return;
+
         Point temp = loopActionpoints_.back();
         loopActionpoints_.pop_back();
