Index: code/branches/script_trigger/src/orxonox/objects/DistanceTrigger.h
===================================================================
--- code/branches/script_trigger/src/orxonox/objects/DistanceTrigger.h	(revision 1693)
+++ code/branches/script_trigger/src/orxonox/objects/DistanceTrigger.h	(revision 1851)
@@ -52,6 +52,8 @@
       void setDistance(float dist);
       virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+      bool checkDistance();
+
+    protected:
       bool isTriggered(TriggerMode mode);
-      bool checkDistance();
 
     private:
Index: code/branches/script_trigger/src/orxonox/objects/Trigger.cc
===================================================================
--- code/branches/script_trigger/src/orxonox/objects/Trigger.cc	(revision 1693)
+++ code/branches/script_trigger/src/orxonox/objects/Trigger.cc	(revision 1851)
@@ -53,4 +53,7 @@
     bTriggered_ = false;
     bUpdating_ = false;
+    remainingActivations_ = -1;
+    bStayTriggered_ = false;
+    latestState_ = 0x0;
 
     debugBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
@@ -79,29 +82,26 @@
   {
 
-    bool newTriggered = this->isTriggered();
-
-
-    // check if new triggering event is really new
-    if(this->latestState_ % 2 != newTriggered)
-    {
-      // create new state
-      if(newTriggered)
+    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)
       {
-        latestState_ |= 0x1; // set trigger bit
-        latestState_ ^= 0x10; // toggle state bit
+        // create new state
+        if(newTriggered)
+        {
+          latestState_ |= 1; // set trigger bit
+          this->switchState();
+        }
+        else
+        {
+          latestState_ &= 0xFE; // set trigger bit
+          this->storeState();
+        }
       }
-      else
-      {
-        latestState_ &= 0x11111110; // set trigger bit
-      }
-
-      // put state change into queue
-      this->stateChanges_.push(std::pair<float,char>(timeSinceLastEvent_, latestState_));
-      // reset time since last event
-      timeSinceLastEvent_ = 0.0;
-
-      if(this->stateChanges_.size() == 1)
-        remainingTime_ = stateChanges_.front().first;
-    }
 
     if(remainingTime_ > 0.0)
@@ -118,5 +118,5 @@
       char newState = stateChanges_.front().second;
       bTriggered_ = newState % 2;
-      bActive_ = newState>>1 % 2;
+      bActive_ = newState & 2;
       this->stateChanges_.pop();
       if(stateChanges_.size() != 0)
@@ -144,4 +144,15 @@
   }
 
+  void Trigger::storeState()
+  {
+    // put state change into queue
+    this->stateChanges_.push(std::pair<float,char>(timeSinceLastEvent_, latestState_));
+    // reset time since last event
+    timeSinceLastEvent_ = 0.0;
+
+    if(this->stateChanges_.size() == 1)
+      remainingTime_ = stateChanges_.front().first;
+  }
+
   bool Trigger::isTriggered(TriggerMode mode)
   {
@@ -186,4 +197,6 @@
 
     XMLPortParamLoadOnly(Trigger, "delay", setDelay, xmlelement, mode);
+    XMLPortParamLoadOnly(Trigger, "stayTriggered", setStayTriggered, xmlelement, mode);
+    XMLPortParamLoadOnly(Trigger, "activations", setActivations, xmlelement, mode);
 
     this->init();
@@ -198,12 +211,14 @@
   bool Trigger::switchState()
   {
-    latestState_ ^= 0x10; // toggle state bit
-    // put state change into queue
-    this->stateChanges_.push(std::pair<float,char>(timeSinceLastEvent_, latestState_));
-    // reset time since last event
-    timeSinceLastEvent_ = 0.0;
-
-    if(this->stateChanges_.size() == 1)
-      remainingTime_ = stateChanges_.front().first;
+    if ( remainingActivations_ == -1 || this->latestState_ & 2 || remainingActivations_ > 0)
+    {
+      this->latestState_ ^= 2; // toggle state bit
+      // increase activation count
+      if (this->latestState_ & 2) remainingActivations_--;
+      this->storeState();
+
+      return true;
+    }
+    return false;
   }
 
@@ -214,5 +229,5 @@
     for(it = this->children_.begin(); it != this->children_.end(); it++)
     {
-      if(!((*it)->isTriggered()))
+      if(!((*it)->isActive()))
         return false;
     }
@@ -225,5 +240,5 @@
     for(it = this->children_.begin(); it != this->children_.end(); it++)
     {
-      if((*it)->isTriggered())
+      if((*it)->isActive())
         return true;
     }
@@ -237,7 +252,7 @@
     for(it = this->children_.begin(); it != this->children_.end(); it++)
     {
-      if(test && (*it)->isTriggered())
+      if(test && (*it)->isActive())
         return false;
-      if((*it)->isTriggered())
+      if((*it)->isActive())
         test = true;
     }
Index: code/branches/script_trigger/src/orxonox/objects/Trigger.h
===================================================================
--- code/branches/script_trigger/src/orxonox/objects/Trigger.h	(revision 1693)
+++ code/branches/script_trigger/src/orxonox/objects/Trigger.h	(revision 1851)
@@ -54,6 +54,5 @@
       ~Trigger();
 
-      inline bool isTriggered() { return this->isTriggered(this->mode_); }
-      virtual bool isTriggered(TriggerMode mode);
+      inline bool isActive() { return bActive_; }
       void addTrigger(Trigger* trig);
       void setVisibility(bool bVisible);
@@ -63,4 +62,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; }
+      inline void setActivations(int activations) { this->remainingActivations_ = activations; }
       void tick(float dt);
 
@@ -71,4 +72,9 @@
       bool checkXor();
       void setBillboardColour(ColourValue colour);
+      void storeState();
+
+    protected:
+      inline bool isTriggered() { return this->isTriggered(this->mode_); }
+      virtual bool isTriggered(TriggerMode mode);
 
     private:
@@ -84,4 +90,6 @@
       BillboardSet debugBillboard_;
       float delay_;
+      int remainingActivations_;
+      bool bStayTriggered_;
       char latestState_;
   };
