Index: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc	(revision 11317)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc	(revision 11318)
@@ -1,4 +1,3 @@
 #include "Waypoint.h"
-
 #include <OgreSceneNode.h>
 #include <BulletDynamics/Dynamics/btRigidBody.h>
@@ -6,4 +5,6 @@
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+#include "WaypointGroup.h"
+#include "core/EventIncludes.h"
 
 
@@ -26,7 +27,7 @@
         distancetrigger = new DistanceTrigger(this->getContext());   
         distancetrigger->setDistance(100);
-        distanceTrigger_->addTarget("Pawn");
-         this->addEventSource(distanceTrigger_, "explode");
-
+        distancetrigger->addTarget("Pawn");
+        distancetrigger->setStayActive(false);
+        this->addEventSource(distancetrigger, "activate");
         this->attach(distancetrigger);
     }
@@ -37,13 +38,20 @@
 
 
+    void Waypoint::activate(){
+        orxout() << "activate function" << endl; 
+        ///++order;
+        waypointgroup->activateNext();
+    }
+
+
      //WorldEntity::setDirection
      //WorldEntity::getPosition()
      //setOrientation()
+ 
 
-
-    void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
-        SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
-        
-        XMLPortParam(Waypoint, "order", setOrder, getOrder, xmlelement, mode);
+    void Waypoint::XMLEventPort(Element& xmlelement, XMLPort::Mode mode){
+        SUPER(Waypoint, XMLEventPort, xmlelement, mode); // From the SpaceShip.cc file
+        //XMLPortParam(Waypoint, "order", setOrder, getOrder, xmlelement, mode);
+        XMLPortEventState(Waypoint, BaseObject, "activate", activate, xmlelement, mode);
 
     }
Index: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h	(revision 11317)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h	(revision 11318)
@@ -5,4 +5,5 @@
 
 #include "OrxonoxPrereqs.h"
+#include "Waypointprereqs.h"
 #include "worldentities/StaticEntity.h"
 #include "graphics/Model.h"
@@ -14,4 +15,6 @@
 #include "util/OgreForwardRefs.h"
 #include "tools/interfaces/Tickable.h"
+#include "WaypointGroup.h"
+
 
 namespace orxonox
@@ -37,5 +40,5 @@
 
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
 
             inline void enable_waypoint(){
@@ -51,4 +54,10 @@
             }
 
+            inline void setWaypointGroup(WaypointGroup* waypointgroup_){
+                this->waypointgroup = waypointgroup_;
+            }
+
+            void activate();
+
             
             bool waypoint_actived;
@@ -59,6 +68,7 @@
             Model* model;
             DistanceTrigger* distancetrigger;
-            int order;
-            
+            unsigned int order = 0;
+            WaypointGroup* waypointgroup;
+
             // network callbacks
     };
Index: code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc	(revision 11317)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc	(revision 11318)
@@ -17,4 +17,5 @@
         RegisterObject(WaypointGroup);
         activeWaypoint = nullptr;
+        current = 0;
 
         //model = new Model(this->getContext());
@@ -25,8 +26,8 @@
         //model->setPosition(Vector3(0.0,0.0,0.0));        // this is wrong, it has to be triggered
         //waypoint_active = false;
-        //distancetrigger = new DistanceTrigger(this->getContext());   
+        //distancetrigger = new DistanceTrigger(this->getContext());
         //distancetrigger->setDistance(100);
         //this->attach(distancetrigger);
-        
+
     }
 
@@ -40,5 +41,5 @@
      //setOrientation()
 
-  
+
 
 
@@ -57,31 +58,41 @@
     void WaypointGroup::setWaypoint(Waypoint* object)
     {
+        object->setWaypointGroup(this);
         this->waypoints_.insert(object);
     }
 
+    void WaypointGroup::activateNext(){
+        if (std::next(waypoints_.begin(), current) != std::next(waypoints_.end(), 0)){
+          activeWaypoint = *std::next(waypoints_.begin(), current);
+          ++current;
+        }
+    }
 
     Waypoint* WaypointGroup::getActive(){
           if (activeWaypoint == nullptr){
             orxout() << "Null Pointer" << endl;
-            activateNext();
+            activeWaypoint = getFirst();
 
-          } 
-          //else if (activeWaypoint->)           
+          }
           return activeWaypoint;
     }
 
-    Waypoint* WaypointGroup::activateNext(){
-        for (Waypoint* object : this->waypoints_){
-            if(!(object->waypoint_actived)){
-                object->enable_waypoint();
-                activeWaypoint = object;
-                break;
-            }
-        }
-        return activeWaypoint;
+//    Waypoint* WaypointGroup::activateNext(){
+//        for (Waypoint* object : this->waypoints_){
+//            if(!(object->waypoint_actived)){
+//                //object->enable_waypoint();
+//                activeWaypoint = object;
+//                break;
+//            }
+//        }
+//        return activeWaypoint;
+//    }
+
+    Waypoint* WaypointGroup::getFirst(){
+        std::set<Waypoint*>::iterator it = waypoints_.begin();
+        return *it;
     }
 
 
-    
 
     void WaypointGroup::XMLPort(Element& xmlelement, XMLPort::Mode mode){
Index: code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h	(revision 11317)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h	(revision 11318)
@@ -5,4 +5,5 @@
 
 #include "OrxonoxPrereqs.h"
+#include "Waypointprereqs.h"
 #include "worldentities/StaticEntity.h"
 #include "graphics/Model.h"
@@ -31,5 +32,5 @@
 
     class _OrxonoxExport WaypointGroup : public StaticEntity {
-        
+
         public:
 
@@ -46,19 +47,23 @@
 
         Waypoint* getActive();
-          
 
-        Waypoint* activateNext();
 
-           
+        void activateNext();
 
-            
+        Waypoint* getFirst();
+
+
+
+
 
 
         private:
-    
+
             //virtual bool isCollisionTypeLegal(CollisionType type) const override;
-         
+
         std::set<Waypoint*> waypoints_;
         Waypoint* activeWaypoint;
+        unsigned int current = 1;
+        //std::set<Waypoint*>::iterator it;
 
             // network callbacks
Index: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc	(revision 11317)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc	(revision 11318)
@@ -61,5 +61,5 @@
 
         if (getWaypointgroup() == nullptr){
-                  orxout() << "Second" << endl;
+                //orxout() << "Second" << endl;
 
             return;
@@ -67,15 +67,13 @@
 
         waypoints_ = getWaypointgroup();
-
         waypoint = waypoints_->getActive();
-
         Vector3 waypoint_position = waypoint->getWorldPosition();
 
 
         //orxout() << "dsfsf" << waypoint_position.x << endl;
-    //    orxout() << "waypoint " << waypoint_position.x <<  "waypoint " << waypoint_position.y << "waypoint " << waypoint_position.z << endl;
-      //  orxout() << "model " << this->model->getWorldPosition().x <<  "model " << this->model->getWorldPosition().y << "model " << this->model->getWorldPosition().z << endl;
-      //  orxout() << "this " << this->getWorldPosition().x <<  "this " << this->getWorldPosition().y << "this " << this->getWorldPosition().z << endl;
-       // orxout() << "trial " << trial.x <<  "trial " << trial.y << "trial " << trial.z << endl;
+        //orxout() << "waypoint " << waypoint_position.x <<  "waypoint " << waypoint_position.y << "waypoint " << waypoint_position.z << endl;
+        //orxout() << "model " << this->model->getWorldPosition().x <<  "model " << this->model->getWorldPosition().y << "model " << this->model->getWorldPosition().z << endl;
+        //orxout() << "this " << this->getWorldPosition().x <<  "this " << this->getWorldPosition().y << "this " << this->getWorldPosition().z << endl;
+        //orxout() << "trial " << trial.x <<  "trial " << trial.y << "trial " << trial.z << endl;
 
 
@@ -88,7 +86,5 @@
     void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
         SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
-
         //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3)
-
         //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
 
Index: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointprereqs.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointprereqs.h	(revision 11318)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointprereqs.h	(revision 11318)
@@ -0,0 +1,55 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+@file
+@brief
+    Shared library macros, enums, constants and forward declarations for the Waypoint module
+*/
+
+#ifndef _WaypointPrereqs_H__
+#define _WaypointPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class Waypoint;
+    class WaypointGroup;
+    class Waypointarrow;
+
+    
+}
+
+#endif /* _WaypointPrereqs_H__ */
