diff --git a/src/dehacked.c b/src/dehacked.c
index 856788f483c7155d708303fa50ffa2bace866e63..a826723069e4956567879cb7ee9eac252d6f859a 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -2421,6 +2421,7 @@ static actionpointer_t actionpointers[] =
 	{{A_SnapperThinker},         "A_SNAPPERTHINKER"},
 	{{A_SaloonDoorSpawn},        "A_SALOONDOORSPAWN"},
 	{{A_MinecartSparkThink},     "A_MINECARTSPARKTHINK"},
+	{{A_ModuloToState},          "A_MODULOTOSTATE"},
 	{{NULL},                     "NONE"},
 
 	// This NULL entry must be the last in the list
@@ -7133,7 +7134,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
 	"S_CRUMBLE2",
 
 	// Spark
-	"S_SPRK",
+	"S_SPRK1",
+	"S_SPRK2",
+	"S_SPRK3",
 
 	// Robot Explosion
 	"S_XPLD_FLICKY",
diff --git a/src/info.c b/src/info.c
index 7a225ee8c955ac877632bb839a352eca5a61931b..9aed563c7a4316ae707c4ddbb82194372977f6f8 100644
--- a/src/info.c
+++ b/src/info.c
@@ -3833,7 +3833,9 @@ state_t states[NUMSTATES] =
 	{SPR_NULL, 0, 105, {A_Scream}, 0, 0, S_NULL}, // S_CRUMBLE2
 
 	// Spark
-	{SPR_SPRK, FF_TRANS20|FF_ANIMATE|0, 18, {NULL}, 8, 2, S_NULL},  // S_SPRK
+	{SPR_NULL, 0, 1, {A_ModuloToState}, 2, S_SPRK2, S_SPRK3},  // S_SPRK1
+	{SPR_SPRK, FF_TRANS20|FF_ANIMATE|0, 18, {NULL}, 8, 2, S_NULL},  // S_SPRK2
+	{SPR_SPRK, FF_TRANS20|FF_ANIMATE|9, 18, {NULL}, 8, 2, S_NULL},  // S_SPRK3
 
 	// Robot Explosion
 	{SPR_BOM1, 0, 0, {A_FlickySpawn}, 0, 0, S_XPLD1}, // S_XPLD_FLICKY
@@ -5603,7 +5605,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_None,       // deathsound
 		10*FRACUNIT,    // speed
@@ -6440,7 +6442,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		38*FRACUNIT,    // speed
@@ -6467,7 +6469,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		38*FRACUNIT,    // speed
@@ -6575,7 +6577,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		38*FRACUNIT,    // speed
@@ -6602,7 +6604,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		38*FRACUNIT,    // speed
@@ -6629,7 +6631,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_None,       // deathsound
 		0,              // speed
@@ -6710,7 +6712,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncitem,     // deathsound
 		1,              // speed
@@ -6737,7 +6739,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		EMERALD1,       // speed
@@ -6763,7 +6765,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		EMERALD2,       // speed
@@ -6789,7 +6791,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		EMERALD3,       // speed
@@ -6815,7 +6817,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		EMERALD4,       // speed
@@ -6841,7 +6843,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		EMERALD5,       // speed
@@ -6867,7 +6869,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		EMERALD6,       // speed
@@ -6893,7 +6895,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		EMERALD7,       // speed
@@ -6920,7 +6922,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		8,              // speed
@@ -6974,7 +6976,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_cgot,       // deathsound
 		60*FRACUNIT,    // speed
@@ -17165,8 +17167,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
-		S_SPRK,        // xdeathstate
+		S_SPRK1,        // deathstate
+		S_SPRK1,        // xdeathstate
 		sfx_None,       // deathsound
 		60*FRACUNIT,    // speed
 		16*FRACUNIT,    // radius
@@ -17192,7 +17194,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17220,7 +17222,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17247,7 +17249,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17274,7 +17276,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17301,7 +17303,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17328,7 +17330,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17355,7 +17357,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17382,7 +17384,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17572,7 +17574,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17599,7 +17601,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17626,7 +17628,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -17653,7 +17655,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_itemup,     // deathsound
 		60*FRACUNIT,    // speed
@@ -18543,7 +18545,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_s3k33,      // painsound
 		S_RING,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncchip,     // deathsound
 		1,              // speed
@@ -18570,7 +18572,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncchip,     // deathsound
 		38*FRACUNIT,    // speed
@@ -18597,7 +18599,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_s3k33,      // painsound
 		S_RING,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncitem,     // deathsound
 		1,              // speed
@@ -18624,7 +18626,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncspec,     // deathsound
 		20*TICRATE,     // speed
@@ -18651,7 +18653,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncspec,     // deathsound
 		96*20,          // speed
@@ -18678,7 +18680,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncspec,     // deathsound
 		20*TICRATE,     // speed
@@ -18705,7 +18707,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncspec,     // deathsound
 		30*TICRATE,     // speed
@@ -18732,7 +18734,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
-		S_SPRK,        // deathstate
+		S_SPRK1,        // deathstate
 		S_NULL,         // xdeathstate
 		sfx_ncspec,     // deathsound
 		15*TICRATE,     // speed
@@ -19615,7 +19617,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 
 	{           // MT_SPARK
 		-1,             // doomednum
-		S_SPRK,        // spawnstate
+		S_SPRK1,        // spawnstate
 		1000,           // spawnhealth
 		S_NULL,         // seestate
 		sfx_None,       // seesound
diff --git a/src/info.h b/src/info.h
index 1c60ea24cad77860bc0bccb40d71f58efe6b4758..bb27ac3e3b299681495fbd4f8bfad07324be61e9 100644
--- a/src/info.h
+++ b/src/info.h
@@ -265,6 +265,7 @@ void A_SnapperSpawn();
 void A_SnapperThinker();
 void A_SaloonDoorSpawn();
 void A_MinecartSparkThink();
+void A_ModuloToState();
 
 // ratio of states to sprites to mobj types is roughly 6 : 1 : 1
 #define NUMMOBJFREESLOTS 512
@@ -3890,7 +3891,9 @@ typedef enum state
 	S_CRUMBLE2,
 
 	// Spark
-	S_SPRK,
+	S_SPRK1,
+	S_SPRK2,
+	S_SPRK3,
 
 	// Robot Explosion
 	S_XPLD_FLICKY,
diff --git a/src/p_enemy.c b/src/p_enemy.c
index d7bc7a583336dfec348d35b6ff07e9dbeb0c5ef0..4f046fe06e2b032043b6b2f20ec5af32f53e2807 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -37,6 +37,8 @@ boolean LUA_CallAction(const char *action, mobj_t *actor);
 player_t *stplyr;
 INT32 var1;
 INT32 var2;
+INT32 modulothing;
+
 //
 // P_NewChaseDir related LUT.
 //
@@ -293,6 +295,7 @@ void A_SnapperSpawn(mobj_t *actor);
 void A_SnapperThinker(mobj_t *actor);
 void A_SaloonDoorSpawn(mobj_t *actor);
 void A_MinecartSparkThink(mobj_t *actor);
+void A_ModuloToState(mobj_t *actor);
 
 //for p_enemy.c
 
@@ -13677,4 +13680,25 @@ void A_MinecartSparkThink(mobj_t *actor)
 		P_SetScale(trail, trail->scale/4);
 		trail->destscale = trail->scale;
 	}
+}
+
+// Function: A_ModuloToState
+//
+// Description: Modulo operation to state
+//
+// var1 = Modulo
+// var2 = State
+//
+void A_ModuloToState(mobj_t *actor)
+{
+	INT32 locvar1 = var1;
+	INT32 locvar2 = var2;
+#ifdef HAVE_BLUA
+	if (LUA_CallAction("A_ModuloToState", actor))
+		return;
+#endif
+
+	if ((modulothing % locvar1 == 0))
+		P_SetMobjState(actor, (locvar2));
+	modulothing++;
 }
\ No newline at end of file
diff --git a/src/p_mobj.h b/src/p_mobj.h
index 77791f928165ac188ca5d6e3c952dbc39791dc56..a9d5244b044ad58840238d753e2e70184e2fc585 100644
--- a/src/p_mobj.h
+++ b/src/p_mobj.h
@@ -464,6 +464,8 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale);
 void P_XYMovement(mobj_t *mo);
 void P_EmeraldManager(void);
 
+extern INT32 modulothing;
+
 #define MAXHUNTEMERALDS 64
 extern mapthing_t *huntemeralds[MAXHUNTEMERALDS];
 extern INT32 numhuntemeralds;
diff --git a/src/p_saveg.c b/src/p_saveg.c
index 24b68b97120ec81dec179beef0babe26ab473fb4..996143c0102e1cc7f7ad3523678d78ebe815b0b9 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -3999,6 +3999,7 @@ static void P_NetArchiveMisc(void)
 	WRITEINT32(save_p, sstimer);
 	WRITEUINT32(save_p, bluescore);
 	WRITEUINT32(save_p, redscore);
+	WRITEINT32(save_p, modulothing);
 
 	WRITEINT16(save_p, autobalance);
 	WRITEINT16(save_p, teamscramble);
@@ -4077,6 +4078,7 @@ static inline boolean P_NetUnArchiveMisc(void)
 	sstimer = READINT32(save_p);
 	bluescore = READUINT32(save_p);
 	redscore = READUINT32(save_p);
+	modulothing = READUINT32(save_p);
 
 	autobalance = READINT16(save_p);
 	teamscramble = READINT16(save_p);
diff --git a/src/p_setup.c b/src/p_setup.c
index c2872a836f32f30f78379f71bf77d6c79989dd25..f3468383c56d2306c29f31dba8c2adb5e6b57d75 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -2610,6 +2610,7 @@ boolean P_SetupLevel(boolean skipprecip)
 	boolean loadedbm = false;
 	sector_t *ss;
 	boolean chase;
+	modulothing = 0;
 
 	levelloading = true;