Index: code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw	(revision 11936)
+++ code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw	(revision 11974)
@@ -16,4 +16,5 @@
   include("templates/spaceshipEscort.oxt")
   include("templates/endurancetest_template.oxt")
+  include("templates/AAAAutonomousDroneTemplate.oxt")
 ?>
 
@@ -31,14 +32,7 @@
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
     <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+    <!-- <SpawnPoint team=2 position="0,0,0" lookat="0,0,0" spawnclass=AAAAutonomousDrone pawndesign=AAAAutonomousDroneTemplate />  -->
+    
 
-
-  <AAAAutonomousDrone id="dummy" position="0,0,0">
-    <attached>
-      <Model scale="10" mesh="drone.mesh"/>
-    </attached>
-    <collisionShapes>
-      <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
-    </collisionShapes>
-  </AAAAutonomousDrone>
     
   
Index: code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua	(revision 11936)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua	(revision 11974)
@@ -60,4 +60,10 @@
 
 
+function spawn_dummy()
+	orxPrint("Spawning dummy!")
+	spawnTest("dummy")
+end
+
+
 function kill_player_after_timeout(pawn)
 	orxPrint("Killing player after 5s")
@@ -86,8 +92,10 @@
 
 
+function spawn_dummy_after_timeout(seconds)
+	orxPrint("Spawning dummy after " .. tostring(seconds))
+	registerAfterTimeout(spawn_dummy, seconds)
+end
 
 
-move_dummy_after_timeout(5)
-kill_dummy_after_timeout(10)
 
 
@@ -96,4 +104,5 @@
 
 
-spawn("ModularSpaceShip", "sepp")
-setPosition("sepp", 500, 0, 0)
+spawn_dummy_after_timeout(5)
+
+
Index: code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt	(revision 11936)
+++ code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt	(revision 11974)
@@ -0,0 +1,10 @@
+<Template name=AAAAutonomousDroneTemplate>
+  <AAAAutonomousDrone>
+    <attached>
+      <Model scale="10" position="0,0,0" mesh="drone.mesh"/>
+    </attached>
+    <collisionShapes>
+      <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
+    </collisionShapes>
+  </AAAAutonomousDrone>
+</Template>
Index: code/branches/ScriptableController_FS18/src/orxonox/Level.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/Level.cc	(revision 11936)
+++ code/branches/ScriptableController_FS18/src/orxonox/Level.cc	(revision 11974)
@@ -58,4 +58,5 @@
         this->xmlfile_ = nullptr;
         this->controller_.reset(new ScriptableController());
+        this->controller_->level_ = this;
     }
 
Index: code/branches/ScriptableController_FS18/src/orxonox/Level.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/Level.h	(revision 11936)
+++ code/branches/ScriptableController_FS18/src/orxonox/Level.h	(revision 11974)
@@ -63,8 +63,9 @@
                 { return this->level_script_; }
 
+            void addObject(BaseObject* object);
 
         private:
             void registerVariables();
-            void addObject(BaseObject* object);
+            //void addObject(BaseObject* object);
             BaseObject* getObject(unsigned int index) const;
 
Index: code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller.cc	(revision 11936)
+++ code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller.cc	(revision 11974)
@@ -133,8 +133,16 @@
 Pawn *ScriptableController::getPawnByID(std::string id) const
 {
-    if(id == "player" || id == "Player" || id == "PLAYER")
+    if(id == "player" || id == "Player" || id == "PLAYER") {
         return orxonox_cast<Pawn*>(this->player_->getControllableEntity());
+        orxout(user_status) << "Pawn is player!?" << std::endl;
+    }
+
 
     auto pawn = this->pawns_.find(id);
+
+    if(pawn != this->pawns_.end()) {
+        orxout(user_status) << "Requested Pawn is available!" << std::endl;
+    }
+
     return pawn != this->pawns_.end() ? pawn->second : nullptr;
 }
Index: code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller.h	(revision 11936)
+++ code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller.h	(revision 11974)
@@ -12,4 +12,5 @@
 #include "worldentities/ControllableEntity.h"
 #include "tools/Timer.h"
+#include "Level.h"
 
 struct lua_State;
@@ -31,4 +32,5 @@
 {
 public:
+    Level* level_ = nullptr;
     /**
      * @brief Run a lua script
Index: code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc	(revision 11936)
+++ code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc	(revision 11974)
@@ -37,4 +37,6 @@
         LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::spawn)>::registerFunction<&ScriptableControllerAPI::spawn>(this, lua, "spawn");
 
+        LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::spawnTest)>::registerFunction<&ScriptableControllerAPI::spawnTest>(this, lua, "spawnTest");
+
 
 
@@ -185,6 +187,106 @@
         this->controller_->registerWorldEntity(id, orxonox_cast<WorldEntity*>(entity));
 
+
         orxout(user_error) << "Third and final hit!" << std::endl;
-    }
+
+    }
+
+
+
+
+
+    void ScriptableControllerAPI::spawnTest(std::string id)
+    {
+        
+        if(this->controller_->getWorldEntityByID(id) != nullptr)
+        {
+            orxout(user_warning) << "Script tried to spawn an object, but an object with the given ID exists already" << std::endl;
+            return;
+        }
+        
+
+        Identifier *identifier = ClassByString("AAAAutonomousDrone");
+        
+        
+        if(!identifier)
+        {
+            orxout(user_error) << "Script tried to spawn unknown object" << std::endl;
+            return;
+        }
+
+        if(!identifier->isLoadable())
+        {
+            orxout(user_error) << "Script tried to spawn unloadable object" << std::endl;
+            return;
+        }
+
+        
+
+        WorldEntity *entity;
+        Identifiable *obj = identifier->fabricate(this->controller_->getWorldEntityByID("Player")->getContext());
+
+        orxout(user_status) << "First hit!" << std::endl;
+
+        if(obj->isA(ClassIdentifier<WorldEntity>::getIdentifier()))
+        {
+            orxout(user_status) << "Is WorldEntity!" << std::endl;
+            entity = orxonox_cast<WorldEntity*>(obj);
+        }
+        else if(obj->isA(ClassIdentifier<PlayerInfo>::getIdentifier()))
+        {
+            // TODO This does not work yet because somehow the controllable entity is not set
+            // yet at this stage.
+    //        entity = orxonox_cast<PlayerInfo*>(obj)->getControllableEntity();
+
+            orxout(user_status) << "Is PlayerInfo!" << std::endl;
+
+            //use TEMPLATES in the map to define objects that are not present on the map yet
+            return;
+        }
+        else
+        {
+            orxout(user_warning) << "Script tried to spawn an object that is neither a WorldEntity, nor a PlayerInfo" << std::endl;
+            
+            return;
+        }
+
+
+        if(entity->isA(ClassIdentifier<MobileEntity>::getIdentifier())) {
+            orxout(user_status) << "Is MobileEntity!" << std::endl;
+            this->controller_->registerMobileEntity(id, orxonox_cast<MobileEntity*>(entity));
+        }
+
+        if(entity->isA(ClassIdentifier<Pawn>::getIdentifier())) {
+            orxout(user_status) << "Is Pawn!" << std::endl;
+            this->controller_->registerPawn(id, orxonox_cast<Pawn*>(entity));
+        }
+
+        this->controller_->registerWorldEntity(id, orxonox_cast<WorldEntity*>(entity));
+
+        if(this->controller_->getPawnByID(id) != nullptr) {
+            orxout(user_status) << "Pawn is indeed available!" << std::endl;
+        }
+
+        //for (Level* level : ObjectList<Level>())
+        //    level->loadedNewXMLName(this);
+
+
+
+
+
+        /////!!!!!!!!!!!!!!!
+
+        this->controller_->level_->addObject(orxonox_cast<Pawn*>(entity));
+
+
+
+
+        orxout(user_status) << "Final hit!" << std::endl;
+    }
+
+
+
+
+
 
     void ScriptableControllerAPI::setPosition(std::string id, double x, double y, double z)
Index: code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.h	(revision 11936)
+++ code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.h	(revision 11974)
@@ -152,4 +152,6 @@
     void spawn(std::string type, std::string id);
 
+    void spawnTest(std::string id);
+
     /**
      * @brief Set the position of an object
