[ZScript] Headquarters

Post your example zscripts/ACS scripts/etc here.

[ZScript] Headquarters

Postby m8f » Sun Dec 13, 2020 11:01 am

This is an experimental mod for GZDoom that allows the player to go to another map for a while, and then return back.

Basically, this is an extension for GZDoom hub feature. This mod saves the player position and the current map name so player can return back.

Download library
Source code

What this can be used for

  • Slayer Gate analog.
  • Scroll of Town Portal for RPG-like dungeon/town game loop.
  • Injecting more levels in an existing mappack mid-level.


  • works with existing maps, no map editing required.
  • works in multiplayer.
  • accessible via hotkey (see `keyconf.txt`), or from arbitrary ZScript code (see API).


  • HQ map should be defined for each cluster.
  • every cluster/hub must have its own "headquarters" map. It's possible to edit the code so every map has its own HQ map.
  • for the HQ map to save its state clusters must be hubs or manually redefined as hubs in mapinfo. If player moves between hubs, the HQ map loses its state. No problems for typical Doom/Heretic/Hexen episodes, problematic for Doom 2 clusters: player may not realize that moving to the next map resets HQ map.
  • making a cluster a hub may result in savefile bloat (all maps in cluster become stored in a savefile).


hq_Api class has two functions:
1. request() - requests transportation to an HQ map.
2. requestBack() - requests transportation back to a normal map from an HQ map.

request() will do nothing if the player is already in an HQ map. requestBack() will do nothing if the player is in a normal map.

Both functions are data scope, meaning that they can be called from all all scopes, including UI. The actual code that makes the change is synchronized with network events.

Code: Select allExpand view
// For transportation to an HQ map:

// For transportation back from an HQ map:

Thanks to

  • Netheritor for a question that inspired this script library.
  • Nash Muhandes for helpful thoughts.


User avatar
Joined: 29 Dec 2017
Location: Siberia (UTC+7)
Discord: m8f#0629
Github ID: mmaulwurff
Operating System: Other Linux 64-bit

Return to Script Library

Who is online

Users browsing this forum: No registered users and 1 guest