Index: code/branches/script_trigger/bin/levels/sample.oxw
===================================================================
--- code/branches/script_trigger/bin/levels/sample.oxw	(revision 1953)
+++ code/branches/script_trigger/bin/levels/sample.oxw	(revision 1954)
@@ -38,6 +38,8 @@
 <Model position="-200,1000,500" scale="10" mesh="hoover_turbine.mesh" yawpitchroll="-90,-90,0" /-->
 
-<DistanceTrigger position="100,0,0" scale="2" distance="80" activations="2" target="SpaceShip"/>
-
+<Trigger position="0,200,0" scale="2" delay="2" stayOn="1">
+  <DistanceTrigger position="100,0,0" scale="2" distance="80" stayOn="1.0" target="SpaceShip"/>
+  <DistanceTrigger position="150,0,0" scale="2" distance="80" stayOn="1.0" target="SpaceShip"/>
+</Trigger>
 
 <?lua
Index: code/branches/script_trigger/src/orxonox/objects/DistanceTrigger.cc
===================================================================
--- code/branches/script_trigger/src/orxonox/objects/DistanceTrigger.cc	(revision 1953)
+++ code/branches/script_trigger/src/orxonox/objects/DistanceTrigger.cc	(revision 1954)
@@ -94,5 +94,7 @@
         Vector3 distanceVec = it->getNode()->getWorldPosition() - this->getNode()->getWorldPosition();
         if (distanceVec.length() < this->distance_)
+        {
           return true;
+        }
       }
     }
Index: code/branches/script_trigger/src/orxonox/objects/Trigger.cc
===================================================================
--- code/branches/script_trigger/src/orxonox/objects/Trigger.cc	(revision 1953)
+++ code/branches/script_trigger/src/orxonox/objects/Trigger.cc	(revision 1954)
@@ -54,5 +54,5 @@
     bUpdating_ = false;
     remainingActivations_ = -1;
-    bStayTriggered_ = false;
+    bStayOn_ = false;
     latestState_ = 0x0;
 
@@ -79,29 +79,43 @@
   }
 
+  const Trigger* Trigger::getTrigger(unsigned int index) const
+  {
+    if (children_.size() <= index)
+      return NULL;
+
+    std::set<Trigger*>::iterator it;
+    it = children_.begin();
+
+    for ( unsigned int i = 0; i != index; i++ )
+    {
+      it++;
+    }
+    return *it;
+  }
+
   void Trigger::tick(float dt)
   {
 
     bool newTriggered;
-    if (latestState_ % 2 == 1 && this->bStayTriggered_)
-      newTriggered = true;
-    else
-      newTriggered = this->isTriggered();
-
-
-      // check if new triggering event is really new
-      if(this->latestState_ % 2 != newTriggered)
+    newTriggered = this->isTriggered();
+
+    // check if new triggering event is really new
+    if((this->latestState_ & 0x1) != newTriggered)
+    {
+      // create new state
+      if(newTriggered)
       {
-        // create new state
-        if(newTriggered)
-        {
-          latestState_ |= 1; // set trigger bit
+        latestState_ |= 1; // set trigger bit
+        this->switchState();
+      }
+      else
+      {
+        latestState_ &= 0xFE; // set trigger bit
+        if (this->bStayOn_)
+          this->storeState();
+        else
           this->switchState();
-        }
-        else
-        {
-          latestState_ &= 0xFE; // set trigger bit
-          this->storeState();
-        }
       }
+    }
 
     if(remainingTime_ > 0.0)
@@ -117,5 +131,5 @@
       // time ran out, change state to new one
       char newState = stateChanges_.front().second;
-      bTriggered_ = newState % 2;
+      bTriggered_ = (newState & 0x1);
       bActive_ = newState & 2;
       this->stateChanges_.pop();
@@ -192,4 +206,14 @@
   }
 
+  void Trigger::setMode(std::string modeName)
+  {
+    if (modeName == "and")
+      setMode(TM_EventTriggerAND);
+    else if (modeName == "or")
+      setMode(TM_EventTriggerOR);
+    else if (modeName == "xor")
+      setMode(TM_EventTriggerXOR);
+  }
+
   void Trigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
   {
@@ -197,6 +221,9 @@
 
     XMLPortParamLoadOnly(Trigger, "delay", setDelay, xmlelement, mode);
-    XMLPortParamLoadOnly(Trigger, "stayTriggered", setStayTriggered, xmlelement, mode);
+    XMLPortParamLoadOnly(Trigger, "stayOn", setStayOn, xmlelement, mode);
     XMLPortParamLoadOnly(Trigger, "activations", setActivations, xmlelement, mode);
+    //XMLPortParamLoadOnlyTemplate(Trigger, "mode", setMode, xmlelement, mode, std::string);
+
+    XMLPortObject(Trigger, Trigger, "", addTrigger, getTrigger, xmlelement, mode, false, true);
 
     this->init();
@@ -211,5 +238,5 @@
   bool Trigger::switchState()
   {
-    if ( remainingActivations_ == -1 || this->latestState_ & 2 || remainingActivations_ > 0)
+    if ( remainingActivations_ <= -1 || this->latestState_ & 2 || remainingActivations_ > 0)
     {
       this->latestState_ ^= 2; // toggle state bit
Index: code/branches/script_trigger/src/orxonox/objects/Trigger.h
===================================================================
--- code/branches/script_trigger/src/orxonox/objects/Trigger.h	(revision 1953)
+++ code/branches/script_trigger/src/orxonox/objects/Trigger.h	(revision 1954)
@@ -56,4 +56,5 @@
       inline bool isActive() { return bActive_; }
       void addTrigger(Trigger* trig);
+      const Trigger* getTrigger(unsigned int index) const;
       void setVisibility(bool bVisible);
       void setDelay(float delay);
@@ -62,5 +63,6 @@
       inline TriggerMode getMode() { return mode_; }
       inline void setMode(TriggerMode mode) { this->mode_ = mode; }
-      inline void setStayTriggered(float stayTriggered) { if (stayTriggered == 1.0) this->bStayTriggered_ = true; else this->bStayTriggered_ = false; }
+      void setMode(std::string modeName);
+      inline void setStayOn(int stayOn) { if (stayOn == 1) this->bStayOn_ = true; else this->bStayOn_ = false; }
       inline void setActivations(int activations) { this->remainingActivations_ = activations; }
       void tick(float dt);
@@ -91,5 +93,5 @@
       float delay_;
       int remainingActivations_;
-      bool bStayTriggered_;
+      bool bStayOn_;
       char latestState_;
   };
