diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt
index 283f149de2..0f07b4d2e8 100644
--- a/apps/openmw/mwscript/docs/vmformat.txt
+++ b/apps/openmw/mwscript/docs/vmformat.txt
@@ -315,5 +315,6 @@ op 0x20001f8: Drop
 op 0x20001f9: Drop, explicit reference
 op 0x20001fa: DropSoulGem
 op 0x20001fb: DropSoulGem, explicit reference
+op 0x20001fc: OnDeath
 
-opcodes 0x20001fa-0x3ffffff unused
+opcodes 0x20001fd-0x3ffffff unused
diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp
index 530d44c9dd..c5fc9436be 100644
--- a/apps/openmw/mwscript/statsextensions.cpp
+++ b/apps/openmw/mwscript/statsextensions.cpp
@@ -1025,6 +1025,27 @@ namespace MWScript
                 }
         };
 
+        class OpOnDeath : public Interpreter::Opcode0
+        {
+            public:
+
+                virtual void execute (Interpreter::Runtime& runtime)
+                {
+                    MWScript::InterpreterContext& context
+                        = static_cast<MWScript::InterpreterContext&> (runtime.getContext());
+
+                    MWWorld::Ptr ptr = context.getReference();
+
+                    Interpreter::Type_Integer value =
+                        MWWorld::Class::get (ptr).getCreatureStats (ptr).hasDied();
+
+                    if (value)
+                        MWWorld::Class::get (ptr).getCreatureStats (ptr).clearHasDied();
+
+                    runtime.push (value);
+                }
+        };
+
         const int numberOfAttributes = 8;
 
         const int opcodeGetAttribute = 0x2000027;
@@ -1114,6 +1135,8 @@ namespace MWScript
         const int opcodeLowerRank = 0x20001ea;
         const int opcodeLowerRankExplicit = 0x20001eb;
 
+        const int opcodeOnDeath = 0x20001fc;
+
         void registerExtensions (Compiler::Extensions& extensions)
         {
             static const char *attributes[numberOfAttributes] =
@@ -1227,6 +1250,8 @@ namespace MWScript
             extensions.registerInstruction ("pcclearexpelled", "/S", opcodePcClearExpelled, opcodePcClearExpelledExplicit);
             extensions.registerInstruction ("raiserank", "", opcodeRaiseRank, opcodeRaiseRankExplicit);
             extensions.registerInstruction ("lowerrank", "", opcodeLowerRank, opcodeLowerRankExplicit);
+
+            extensions.registerFunction ("ondeath", 'l', "", opcodeOnDeath);
         }
 
         void installOpcodes (Interpreter::Interpreter& interpreter)
@@ -1341,6 +1366,8 @@ namespace MWScript
             interpreter.installSegment5 (opcodeRaiseRankExplicit, new OpRaiseRank<ExplicitRef>);
             interpreter.installSegment5 (opcodeLowerRank, new OpLowerRank<ImplicitRef>);
             interpreter.installSegment5 (opcodeLowerRankExplicit, new OpLowerRank<ExplicitRef>);
+
+            interpreter.installSegment5 (opcodeOnDeath, new OpOnDeath);
         }
     }
 }