Index: branches/cleanup/src/ai/swarm_attack.cc
===================================================================
--- branches/cleanup/src/ai/swarm_attack.cc	(revision 10578)
+++ branches/cleanup/src/ai/swarm_attack.cc	(revision 10615)
@@ -30,37 +30,45 @@
 void SwarmAttack::process(float dt)
 {
-	std::map<WorldEntity*,AIModule*>::iterator it;
+  WorldEntity* taskRelObject = NULL;
+  if ( taskRelObjectName != "" )
+  {
+    taskRelObject = dynamic_cast<WorldEntity*>(WorldEntity::objectList().getBaseObject( taskRelObjectName ));
+          
+          
+    std::map<WorldEntity*,AIModule*>::iterator it;
+    Vector sideL=taskRelPos.cross(Vector(0,1,0)).getNormalized();
+    Vector sideR=sideL*-1;
+    Vector posL=Vector(0,0,0);
+    Vector posR=Vector(0,0,0);
+        
 
-	Vector sideL=taskRelPos.cross(Vector(0,1,0)).getNormalized();
-	Vector sideR=sideL*-1;
-	Vector posL=Vector(0,0,0);
-	Vector posR=Vector(0,0,0);
+        
+        //tell positions to swarm-members...
+    float radius;
+    Vector objectPos=taskRelObject->getAbsCoor();
 
-	//tell positions to swarm-members...
-	float radius;
-	Vector objectPos=taskRelObject->getAbsCoor();
+    for (it=members.begin(); it!= members.end(); it++ ){
+      radius=it->second->getNPCRadius();
+      posR=posR+sideR*radius*1.5;
+      it->second->setDestination(objectPos+taskRelPos+posR);
+      it->second->setDestinationMovement(Vector(0,0,0));
+      it->second->setTarget(taskRelObject);
+      it->second->process(dt);
+      posR=posR+sideR*radius*1.5;
 
-	for (it=members.begin(); it!= members.end(); it++ ){
-		radius=it->second->getNPCRadius();
-		posR=posR+sideR*radius*1.5;
-		it->second->setDestination(objectPos+taskRelPos+posR);
-		it->second->setDestinationMovement(Vector(0,0,0));
-		it->second->setTarget(taskRelObject);
-		it->second->process(dt);
-		posR=posR+sideR*radius*1.5;
+      it++;
+      if(it==members.end())break;
+      radius=it->second->getNPCRadius();
+      posL=posL+sideL*radius*1.5;
+      it->second->setDestination(objectPos+taskRelPos+posL);
+      it->second->setDestinationMovement(Vector(0,0,0));
+      it->second->setTarget(taskRelObject);
+      it->second->process(dt);
+      posL=posL+sideL*radius*1.5;
+    }
 
-		it++;
-		if(it==members.end())break;
-		radius=it->second->getNPCRadius();
-		posL=posL+sideL*radius*1.5;
-		it->second->setDestination(objectPos+taskRelPos+posL);
-		it->second->setDestinationMovement(Vector(0,0,0));
-		it->second->setTarget(taskRelObject);
-		it->second->process(dt);
-		posL=posL+sideL*radius*1.5;
-	}
-
-	//check time..
-	taskMaxTime-=dt;
-	if(taskMaxTime<0)taskComplete=true;
+        //check time..
+    taskMaxTime-=dt;
+    if(taskMaxTime<0)taskComplete=true;
+  }
 }
Index: branches/cleanup/src/ai/swarm_gorel.cc
===================================================================
--- branches/cleanup/src/ai/swarm_gorel.cc	(revision 10578)
+++ branches/cleanup/src/ai/swarm_gorel.cc	(revision 10615)
@@ -48,4 +48,8 @@
 	Vector correction=Vector(0,0,0);
 	Vector destination;
+        
+        WorldEntity* taskRelObject = NULL;
+        if ( taskRelObjectName != "" )
+          taskRelObject = dynamic_cast<WorldEntity*>(WorldEntity::objectList().getBaseObject( taskRelObjectName ));
 
 	if(taskRelObject!=NULL && taskMaxTime>0){
Index: branches/cleanup/src/ai/swarm_module.h
===================================================================
--- branches/cleanup/src/ai/swarm_module.h	(revision 10578)
+++ branches/cleanup/src/ai/swarm_module.h	(revision 10615)
@@ -24,5 +24,5 @@
 	inline void orderView(Vector taskView){this->taskView=taskView;}
 	inline void orderSpeed(float taskSpeed){this->taskSpeed=taskSpeed;}
-	inline void orderRelObject(WorldEntity* taskRelObject){this->taskRelObject=taskRelObject;}
+	inline void orderRelObject(WorldEntity* taskRelObject){if (taskRelObject) this->taskRelObjectName=taskRelObject->getName(); else taskRelObjectName = ""; }
 	inline void orderMaxTime(float taskMaxTime){this->taskMaxTime=taskMaxTime;}
 
@@ -44,5 +44,5 @@
 	Vector taskView;
 	float taskSpeed;
-	WorldEntity* taskRelObject;
+	std::string taskRelObjectName;
 	bool taskComplete;
 	float taskMaxTime;
Index: branches/cleanup/src/ai/swarm_wait.cc
===================================================================
--- branches/cleanup/src/ai/swarm_wait.cc	(revision 10578)
+++ branches/cleanup/src/ai/swarm_wait.cc	(revision 10615)
@@ -19,8 +19,9 @@
 void SwarmWait::process(float dt)
 {
-	if(taskRelObject!=NULL){
-		Vector distVect=taskRelObject->getAbsCoor()-getSwarmPosition();
-		float distance=distVect.len();
-		if(distance<attackDistance+100)taskComplete=true;		//### change wakeup distance here
+	if(taskRelObjectName!=""){
+          WorldEntity* taskRelObject = dynamic_cast<WorldEntity*>(WorldEntity::objectList().getBaseObject( taskRelObjectName ));
+          Vector distVect=taskRelObject->getAbsCoor()-getSwarmPosition();
+          float distance=distVect.len();
+          if(distance<attackDistance+100)taskComplete=true;		//### change wakeup distance here
 	}
 
