Index: /branches/script_engine/src/Makefile.am
===================================================================
--- /branches/script_engine/src/Makefile.am	(revision 8238)
+++ /branches/script_engine/src/Makefile.am	(revision 8239)
@@ -28,5 +28,6 @@
 		$(libORXlibs_a_LIBRARIES_) \
 		$(CURL_LIBS) \
-		@QT_LIBS@
+		@QT_LIBS@ \
+		-L../extern_libs @LUA_LIBS@
 
 orxonox_SOURCES = \
Index: /branches/script_engine/src/lib/BuildLibs.am
===================================================================
--- /branches/script_engine/src/lib/BuildLibs.am	(revision 8238)
+++ /branches/script_engine/src/lib/BuildLibs.am	(revision 8239)
@@ -6,4 +6,5 @@
                 $(LIB_PREFIX)/gui/gl_gui/libORXglgui.a \
                 $(LIB_PREFIX)/gui/libORXbasegui.a \
+                $(LIB_PREFIX)/script_engine/libORXscript.a \
                 $(LIB_PREFIX)/graphics/importer/libORXimporter.a \
                 $(LIB_PREFIX)/graphics/libORXgraphics.a \
@@ -22,4 +23,3 @@
                 $(LIB_PREFIX)/shell/libORXshell.a \
                 $(LIB_PREFIX)/math/libORXmath.a \
-                $(LIB_PREFIX)/libORXlibs.a \
-                $(LIB_PREFIX)/script_engine/libORXscript.a
+                $(LIB_PREFIX)/libORXlibs.a
Index: /branches/script_engine/src/lib/script_engine/script_manager.cc
===================================================================
--- /branches/script_engine/src/lib/script_engine/script_manager.cc	(revision 8238)
+++ /branches/script_engine/src/lib/script_engine/script_manager.cc	(revision 8239)
@@ -16,18 +16,20 @@
 
 
-ScriptManager::ScriptManager()
+ScriptManager::ScriptManager(const TiXmlElement* root)
 {
-  this->init();
+  this->setName("ScriptManager");
+
+  this->scripts = NULL;
+  this->triggers = NULL;
+
+  if (root != NULL)
+    this->loadParams(root);
 }
+
+
 
 ScriptManager::~ScriptManager()
 {
-  // delete all scripts since they are useless without the manager
-  if(getScripts())
-    for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ )
-  {
-    ClassList::removeFromClassList( (*it) );
-  }
-
+  this->flush();
 }
 
@@ -35,10 +37,9 @@
 void ScriptManager::loadParams(const TiXmlElement* root)
 {
-  this->reset();
   //BaseObject::loadParams(root);
   {
-  LoadParamXML(root, "Scripts", this, ScriptManager, createScripts);
+    LoadParamXML(root, "Scripts", this, ScriptManager, createScripts);
 
-  LoadParamXML(root, "ScriptTriggers", this, ScriptManager, createTriggers);
+    LoadParamXML(root, "ScriptTriggers", this, ScriptManager, createTriggers);
   } // make shure that the loading process is finished
 
@@ -46,30 +47,15 @@
   getTriggers();
   getScripts();
+}
 
 
-}
 
-void  ScriptManager::reset()
+void  ScriptManager::flush()
 {
   //Delete all scripts as they aren't deleted automatically
-  if(getScripts())
-    for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ )
-    {
-     ClassList::removeFromClassList( (*it) );
-    }
-
-  this->scripts = NULL;
-  this->triggers = NULL;
+  if(this->getScripts())
+    while(!scripts->empty())
+      delete scripts->front();
 }
-
-void ScriptManager::init()
-{
-  //this->setClassID("");
-  this->setName("ScriptManager");
-
-  this->scripts = NULL;
-  this->triggers = NULL;
-}
-
 
 void  ScriptManager::createScripts(const TiXmlElement* scripts)
@@ -98,11 +84,11 @@
 {
   if(getScripts())
-   for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ )
+    for(std::list<BaseObject*>::const_iterator it = scripts->begin(); it != scripts->end(); it++ )
     {
       if( (dynamic_cast<Script*>(*it))->getFileName().compare(file) == 0)
-     {
-       return dynamic_cast<Script*>(*it);
-     }
-   }
+      {
+        return dynamic_cast<Script*>(*it);
+      }
+    }
 
   return NULL;
Index: /branches/script_engine/src/lib/script_engine/script_manager.h
===================================================================
--- /branches/script_engine/src/lib/script_engine/script_manager.h	(revision 8238)
+++ /branches/script_engine/src/lib/script_engine/script_manager.h	(revision 8239)
@@ -14,8 +14,6 @@
 {
  public:
-   ScriptManager();
+   ScriptManager(const TiXmlElement* root = NULL);
    ~ScriptManager();
-
-  inline static ScriptManager* getInstance() { if (!ScriptManager::singletonRef)ScriptManager::singletonRef = new ScriptManager(); return ScriptManager::singletonRef; }
 
   /// LOADING
@@ -28,7 +26,5 @@
 
  private:
-
-   void  reset();                                   //!< Resets the script manager
-   void  init();
+   void  flush();                                   //!< Resets the script manager
    void  createScripts(const TiXmlElement* scripts);
    void  createTriggers(const TiXmlElement* triggers);
Index: /branches/script_engine/src/lib/script_engine/script_trigger.cc
===================================================================
--- /branches/script_engine/src/lib/script_engine/script_trigger.cc	(revision 8238)
+++ /branches/script_engine/src/lib/script_engine/script_trigger.cc	(revision 8239)
@@ -3,4 +3,5 @@
 #include "script.h"
 
+#include "state.h"
 
 ScriptTrigger::ScriptTrigger(const TiXmlElement* root)
@@ -112,8 +113,10 @@
 void ScriptTrigger::setScript(const std::string& file)
 {
-  ScriptManager* scriptManager = ScriptManager::getInstance();
-  script = scriptManager->getScriptByFile(file);
-  if(script != NULL)
-    scriptIsOk = true;
-
+  ScriptManager* scriptManager = State::getScriptManager();
+  if (scriptManager != NULL)
+  {
+    script = scriptManager->getScriptByFile(file);
+    if(script != NULL)
+      scriptIsOk = true;
+  }
 }
Index: /branches/script_engine/src/story_entities/game_world.cc
===================================================================
--- /branches/script_engine/src/story_entities/game_world.cc	(revision 8238)
+++ /branches/script_engine/src/story_entities/game_world.cc	(revision 8239)
@@ -181,4 +181,6 @@
   this->dataXML = (TiXmlElement*)root->Clone();
 
+  LoadParamXML(root, "ScriptManager", &this->scriptManager, ScriptManager, loadParams);
+
   delete XMLDoc;
   this->releaseLoadScreen();
@@ -213,4 +215,6 @@
   this->bPaused = false;
   this->bRunning = true;
+
+  State::setScripManager(&this->scriptManager);
 
   this->run();
Index: /branches/script_engine/src/story_entities/game_world.h
===================================================================
--- /branches/script_engine/src/story_entities/game_world.h	(revision 8238)
+++ /branches/script_engine/src/story_entities/game_world.h	(revision 8239)
@@ -11,8 +11,10 @@
 #include "game_world_data.h"
 #include "playable.h"
+#include "script_manager.h"
 
 namespace OrxShell { class Shell; };
 class WorldEntity;
 class GameRules;
+
 
 /** How many frames time values to keep
@@ -102,7 +104,7 @@
     GameRules*          gameRules;                    //!< Pointer to the data structure containig the game rules
 
-
   private:
     /* external modules interfaces */
+    ScriptManager       scriptManager;
     OrxShell::Shell*    shell;
 };
Index: /branches/script_engine/src/util/state.cc
===================================================================
--- /branches/script_engine/src/util/state.cc	(revision 8238)
+++ /branches/script_engine/src/util/state.cc	(revision 8239)
@@ -38,5 +38,5 @@
 
 ObjectManager* State::objectManager = NULL;
-
+ScriptManager* State::scriptManager = NULL;
 
 unsigned int State::resX = 1;
Index: /branches/script_engine/src/util/state.h
===================================================================
--- /branches/script_engine/src/util/state.h	(revision 8238)
+++ /branches/script_engine/src/util/state.h	(revision 8239)
@@ -18,4 +18,6 @@
 class ObjectManager;
 class GameRules;
+
+class ScriptManager;
 
 
@@ -92,4 +94,11 @@
 
 
+
+  ////////////////////
+  /// SCRIP_ENGINE ///
+  ////////////////////
+  static void setScripManager(ScriptManager* scriptManager) { State::scriptManager = scriptManager; };
+  static ScriptManager* getScriptManager() { return State::scriptManager; };
+
   ////////////
   /// Menu ///
@@ -116,4 +125,7 @@
 
   static SkyBox*                skyBox;            //!< The SkyBox used in the current world.
+
+  static  ScriptManager*        scriptManager;     //!< The ScriptManager.
+
   static unsigned int           resX;              //!< The X Resolution of the screen.
   static unsigned int           resY;              //!< The Y Resolution of the screen.
