Hub maps with respawning enemies?

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Hub maps with respawning enemies?

Postby Marscaleb » Thu May 21, 2020 11:49 am

Is it possible to restore enemies to their original condition when a hub-map loads? So when you return to an old area you can always have some enemies to fight. (Not all enemies, but certain ones.) And ideally have them respawn in their original location, rather than where they died.
User avatar
Marscaleb
 
Joined: 18 May 2016

Re: Hub maps with respawning enemies?

Postby Amuscaria » Fri May 22, 2020 4:59 pm

Automatically upon hub entry? Not that I know of. I'm assuming you don't just want to turn on the monster resurrect game option, in which case you'll have to use ACS scripting with ZDoom_Hexen or UDMF mapping format.

You can use the action Thing_Raise(TID) to raise all the monster in a map. Just give all the monster in the map a tag/thing id. In ACS have a script like this:

Script 1 ENTER
{
Thing_Raise(##);
}

## being the thing tag number.

I'd recommend using UDMF format, if you aren't already, so you can give monsters multiple tags, and use one tag for all the monsters you want raised instead of calling multiple Thing_Raise actions for each tagged monster.
User avatar
Amuscaria
The Sentient Mushroom
 
Joined: 26 Jul 2004
Location: Growing from mycelium near you.

Re: Hub maps with respawning enemies?

Postby Arctangent » Sat May 23, 2020 3:14 am

Amuscaria wrote:I'd recommend using UDMF format, if you aren't already, so you can give monsters multiple tags, and use one tag for all the monsters you want raised instead of calling multiple Thing_Raise actions for each tagged monster.

This isn't actually a thing - UDMF allows for multiple tags, yes, but only linedefs and sectors can be tagged. Actors are assigned tids instead, which are still very much one-per-actor.

Also, resurrecting monsters with an ENTER script will do quite literally nothing, unless you're playing on a Zandronum co-op server, in which case ... it'll resurrect the monsters every time a player joins the game for the first time, which isn't exactly what this is going for. REOPEN is much more fitting, as it not only runs only when the level starts after already having its state saved to the hub, but it also makes the script a world script instead of a player script - so you don't have to worry about side effects popping up in multiplayer.
User avatar
Arctangent
squawky
 
Joined: 06 Nov 2014
Discord: SquawkyAtan#2371

Re: Hub maps with respawning enemies?

Postby Marscaleb » Sun May 24, 2020 2:05 pm

So I'm gathering that there is a spot in the scripts I can hook commands to call when a hub map is opened, but actually assigning it to specific monsters is going to be hard since I have a limit on custom properties I can assign monsters (at least that the existing scripts will recognize.)
Sorry if my info is out of date; I haven't really looked into doom mods since around the time UDMF was first coming into the scene, so I'm aware of it but I never really played with it to see its limitations.

Also, isn't using the standard resurrect command just going to bring it back in the spot where it currently lies? I'd really need an option to return it to its original starting position. Considering that you could have enemies do things like fall off ledges when they die, or die in a doorway, or a dozen other places that we wouldn't want them to be. Hell a monster could just be led to an "out of the way" spot and die there, and then the player doesn't have to face any monsters if they go back through an old area.

As I think about it, monsters wouldn't necessarily have to respawn when the map is loaded, but it just ought to be done "when the player isn't looking." If the player is still working their way through a given level and a dead monster respawns, the player is going to feel compelled to fight it, or worse yet, decide that killing monsters doesn't actually have any benefits to it since they don't stay dead.
So alternatively, it would work just as well (if not better) if I could tie monsters respawning to events and triggers I set in my maps. Like maybe they don't reset until the player gets back to the central hub, and maybe I could tie it to some trigger/linedef somewhere in the map so they don't reset until it is certain the player is leaving the area, just in case they accidentally triggered the map change. And restoring monsters in the central hub doesn't happen until they defeat the boss of the last area or whatever.
So, can I set (specific) monsters to reset to their original positions & state when the player triggers specific events/etc, particularly ones triggered within other maps within a hub-cluster?
User avatar
Marscaleb
 
Joined: 18 May 2016


Return to Mapping

Who is online

Users browsing this forum: BLEX [Bot] and 1 guest