Jump to content
  • 0

Mass Infighting


adamastor

Question

Hey guys.
One of the touches that I really like in Heretic is that contrary to Doom, when the player dies, the monsters start to infight with everything in their sight, even with monsters they wouldn't normally attack.
What I want to know is a way to implement that behaviour in Doom, in this case in Geezy, as I've seen it working in DOOM Retro, for example.
That's all. Any help will be greatly appreciatted.

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0
On 4/15/2021 at 2:21 PM, Adamast0r said:

What I want to know is a way to implement that behaviour in Doom

If you use a sourceport derived from ZDooM you can use Thing _Hate  and ACS to create infighting when the player dies. However, I don't know if ACS specials can be made to continue when the player dies.

Share this post


Link to post
  • 0
2 hours ago, ReX said:

If you use a sourceport derived from ZDooM you can use Thing _Hate  and ACS to create infighting when the player dies. However, I don't know if ACS specials can be made to continue when the player dies.

Thanks for the help, ReX.

I'll read up on it. I'm not very savvy in modding, and I've yet to try my hand at ACS, but I'll go for it.

Share this post


Link to post
  • 0

https://soulsphere.org/random/ultimate-monster-infighting.diff

 

Quote

The "Ultimate" monster infighting patch.

Monsters now hate other monsters as much as they hate you. If
there's a big monster they'll gang up on it to kill it. They also
hate barrels and will destroy them at all costs. Hilariy ensues.
===================================================================
--- p_enemy.c	(revision 2755)
+++ p_enemy.c	(working copy)
@@ -501,58 +501,78 @@
 ( mobj_t*	actor,
   boolean	allaround )
 {
-    int		c;
-    int		stop;
-    player_t*	player;
-    angle_t	an;
-    fixed_t	dist;
-
-    c = 0;
-    stop = (actor->lastlook-1)&3;
-	
-    for ( ; ; actor->lastlook = (actor->lastlook+1)&3 )
+    thinker_t *rover;
+    angle_t an;
+    fixed_t dist;
+    mobj_t *best;
+
+    best = NULL;
+
+    for (rover=thinkercap.next; rover != &thinkercap; rover=rover->next)
     {
-	if (!playeringame[actor->lastlook])
-	    continue;
-			
-	if (c++ == 2
-	    || actor->lastlook == stop)
-	{
-	    // done looking
-	    return false;	
-	}
-	
-	player = &players[actor->lastlook];
+        mobj_t *mo;
 
-	if (player->health <= 0)
+        if (rover->function.acp1 != (actionf_p1) P_MobjThinker)
+            continue;
+
+        mo = (mobj_t *) rover;
+
+        if (mo == actor)
+            continue;
+
+        if ((mo->flags & MF_SHOOTABLE) == 0)
+            continue;
+
+	if (mo->health <= 0)
 	    continue;		// dead
 
-	if (!P_CheckSight (actor, player->mo))
+	if (!P_CheckSight (actor, mo))
 	    continue;		// out of sight
-			
+
 	if (!allaround)
 	{
 	    an = R_PointToAngle2 (actor->x,
 				  actor->y, 
-				  player->mo->x,
-				  player->mo->y)
+				  mo->x,
+				  mo->y)
 		- actor->angle;
-	    
+
 	    if (an > ANG90 && an < ANG270)
 	    {
-		dist = P_AproxDistance (player->mo->x - actor->x,
-					player->mo->y - actor->y);
+		dist = P_AproxDistance (mo->x - actor->x,
+					mo->y - actor->y);
 		// if real close, react anyway
 		if (dist > MELEERANGE)
 		    continue;	// behind back
 	    }
 	}
-		
-	actor->target = player->mo;
-	return true;
+
+        // HATE BARRELS
+
+        if (mo->type == MT_BARREL)
+        {
+            best = mo;
+            break;
+        }
+
+        // Make monsters gang up on big monsters that have lots 
+        // of health
+
+        if (best == NULL || mo->health > best->health)
+        {
+            best = mo;
+        }
     }
 
-    return false;
+    if (best != NULL)
+    {
+        actor->target = best;
+        return true;
+    }
+    else
+    {
+        return false;
+    }
 }
 
 

 

 

Share this post


Link to post
  • 0

This is great @Diabolución. However, I wnated to find a way to make monster Doom monsters infight with each other until death after the player dies.

You know, as DOOM Retro does, for example.

Share this post


Link to post
  • 0
10 hours ago, Adamast0r said:

I'm not very savvy in modding, and I've yet to try my hand at ACS, but I'll go for it.

The logic for your ACS code is fairly straightforward for a "regular" event:

 

1. ACS checks to see if event has occurred.

2. If event has occurred, trigger the Thing_Hate special and set the enemies against each other.

 

The problem, in my mind, is that the player's death is not a "regular" event. Enemies typically become inert upon the player's death.

 

An alternative is to set up ACS to monitor the player's health and trigger the Thing_Hate special when the player's health gets below a certain level (I suspect that zero-health will probably not work, but you can set a low value). But the problem, again, is that once the player dies the enemies will revert to an inert state.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...