Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Self Resurecting Enemies with Dehacked

Recommended Posts

How would I go about doing this?
Everytime a monster resurrects itself after death it becomes un-shootable (basically a ghost monster that cannot clip through walls)

Here is the dehacked file (The Zombieman is the only one that can resurrect itself as of right now until I figure out a workaround).

Share this post

Link to post

Hey, there's some good shit in the wad! Good to see a mate, because I've been doing similar things, I mean, messing with DEHACKED and resources. :)

As the workaround, I recommend to do something with VileChase action, which resurrects enemies properly if they're in the state of finished animation (on a frame with duration -1). You'll have to nullify state 266 (standard archvile's healing state) and then you can use the action on whichever monster or thing you'd like, without side effects. Maybe you could make the zombieman spawn a dummy thing (replacing his ammo clip) which will resurrect him a bit later and then destroy itself. Only maybe, I'm not sure if it could work this way.

Share this post

Link to post

Probably the 'Fall' codepointer is putting the monster in a dead state, that is not reset just by going to the spawn frame. AV resurrection does modify the monsters properties through the VileChase codepointer.

I don't know if simply removing Fall from the Trooper's death states will cause any problems. At the very least I think it prevents him dropping a clip. Even then, he still probably isn't going to have any hitpoints.

Share this post

Link to post
plums said:

I don't know if simply removing Fall from the Trooper's death states will cause any problems. At the very least I think it prevents him dropping a clip. Even then, he still probably isn't going to have any hitpoints.

Correct. He will also stay blocking. He *may* drop a clip anyway in some ports.

Share this post

Link to post

A_Fall doesn't drop items in vanilla, it merely makes the mobj non-solid:

void A_Fall (mobj_t *actor)
    // actor is on ground, it can be walked over
    actor->flags &= ~MF_SOLID;

    // So change this if corpse objects
    // are meant to be obstacles.

The interesting stuff happens in P_KillMobj, which is called by P_DamageMobj if damage inflicted is enough to kill:
// KillMobj
( mobj_t*	source,
  mobj_t*	target )
    mobjtype_t	item;
    mobj_t*	mo;
    target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY);

    if (target->type != MT_SKULL)
	target->flags &= ~MF_NOGRAVITY;

    target->flags |= MF_CORPSE|MF_DROPOFF;
    target->height >>= 2;

    if (source && source->player)
	// count for intermission
	if (target->flags & MF_COUNTKILL)

	if (target->player)
    else if (!netgame && (target->flags & MF_COUNTKILL) )
	// count all monster deaths,
	// even those caused by other monsters
    if (target->player)
	// count environment kills against you
	if (!source)	
	target->flags &= ~MF_SOLID;
	target->player->playerstate = PST_DEAD;
	P_DropWeapon (target->player);

	if (target->player == &players[consoleplayer]
	    && automapactive)
	    // don't die in auto map,
	    // switch view prior to dying
	    AM_Stop ();

    if (target->health < -target->info->spawnhealth 
	&& target->info->xdeathstate)
	P_SetMobjState (target, target->info->xdeathstate);
	P_SetMobjState (target, target->info->deathstate);
    target->tics -= P_Random()&3;

    if (target->tics < 1)
	target->tics = 1;
    //	I_StartSound (&actor->r, actor->info->deathsound);

    // Drop stuff.
    // This determines the kind of object spawned
    // during the death frame of a thing.
    switch (target->type)
      case MT_WOLFSS:
      case MT_POSSESSED:
	item = MT_CLIP;
      case MT_SHOTGUY:
	item = MT_SHOTGUN;
      case MT_CHAINGUY:
	item = MT_CHAINGUN;

    mo = P_SpawnMobj (target->x,target->y,ONFLOORZ, item);
    mo->flags |= MF_DROPPED;	// special versions of items
So to summarize: as soon as the monster is killed, the following happens:
  • It becomes non-shootable (but not non-solid, that's done later when it calls A_Fall)
  • Corpse and dropoff flags are added (so it can be detected by viles, fall from a ledge, etc.)
  • Height is divided by four! Important effect to keep in mind!
  • Kill count is increased
  • Mobj is put in death or xdeath state, as appropriate
  • If the actor is from one of the four zombie types, some loot is dropped
If the actor isn't resurrected by a vile, but by some dehacked trickery, the shootable flag isn't reinstated, the corpse and dropoff flags aren't removed, the height isn't restored to its normal value, etc.

Share this post

Link to post
TendaMonsta said:

Basically you're saying resurrecting monsters won't work with dehacked?

Nothing in Gez's post actually disproves what I've suggested in my first post here. VileChase IS the function for what the vile normally does - properly resurrects dead monsters.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now