Actions between maps (ZDoom In Hexen Format)

Ask about ACS, DECORATE, ZScript, or any other scripting questions 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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
VVanTuz2OO2
Posts: 7
Joined: Thu Nov 24, 2022 11:04 am
Preferred Pronouns: He/Him
Operating System Version (Optional): many
Graphics Processor: Intel (Legacy GZDoom)

Actions between maps (ZDoom In Hexen Format)

Post by VVanTuz2OO2 »

Hello everybody.

I'm using Doom Builder 2 and SLADE 3 to create somewhat of an open world Doom Megawad with overworld and dungeons. I have learned many things and still learning through Chubzdoomer and Doomkid tutorials while reading ZDoom wiki. However... How do I handle some of these problems?

I'm on early stage of development so nothing crucial has happened. I'm checking things before I can go further so I will not make huge amount of mistakes that I will need to fix manually. This topic will not be only about starter things, but maybe about things that pop up when I get to next stages.

First of, it is very annoying limitation of 256 values of tags on lines. While some other things has neverending limits of 25565 values... 0-255 is just not nearly enough for commonly used linedef tricks. Please, show some tips for the level design that can potentially save some already limited linedef tags.

Secondly, how do I perform actions between maps? By that I mean thE Hexen thing of pull switch in MAP03 so the stairs raise in MAP04 and a door opens in MAP05. Without such exploration mechanics hub is pretty much a useless feature (not always, but we're talking about open world).
Gez
 
 
Posts: 17840
Joined: Fri Jul 06, 2007 3:22 pm

Re: Actions between maps (ZDoom In Hexen Format)

Post by Gez »

VVanTuz2OO2 wrote: Wed May 03, 2023 12:02 pmneverending limits of 25565 values...
255 is the 8-bit limit, 32767 the signed 16-bit limit, 65535 the unsigned 16-bit limit, and the 32-bit limit is over two billions signed, or four billions unsigned.

The Hexen map format is limited to 8-bit values, but UDMF is not.
VVanTuz2OO2 wrote: Wed May 03, 2023 12:02 pm Secondly, how do I perform actions between maps? By that I mean thE Hexen thing of pull switch in MAP03 so the stairs raise in MAP04 and a door opens in MAP05. Without such exploration mechanics hub is pretty much a useless feature (not always, but we're talking about open world).
The way Hexen did that is through ACS, as it was a rather simple way for them to share variables between maps. See the article on variable scope for information.
VVanTuz2OO2
Posts: 7
Joined: Thu Nov 24, 2022 11:04 am
Preferred Pronouns: He/Him
Operating System Version (Optional): many
Graphics Processor: Intel (Legacy GZDoom)

Re: Actions between maps (ZDoom In Hexen Format)

Post by VVanTuz2OO2 »

Gez wrote: Wed May 03, 2023 12:13 pm The Hexen map format is limited to 8-bit values, but UDMF is not.

The way Hexen did that is through ACS, as it was a rather simple way for them to share variables between maps. See the article on variable scope for information.
Thanks, that's a lot of helpful info. I'm learning and using ACS so it is really great that you pointed the exact paragraph.

So in case ZDoom\Hexen format proves to be a bad choice in later stages I can just convert in in UDMF format.
Last edited by VVanTuz2OO2 on Wed May 03, 2023 1:25 pm, edited 1 time in total.
VVanTuz2OO2
Posts: 7
Joined: Thu Nov 24, 2022 11:04 am
Preferred Pronouns: He/Him
Operating System Version (Optional): many
Graphics Processor: Intel (Legacy GZDoom)

Re: Actions between maps (ZDoom In Hexen Format)

Post by VVanTuz2OO2 »

Hello again. World scope variables work fine.

This time around I wish I could do multiple exits and entrances and i'm not sure how to execute that. I know how to do multiple exits to different maps, but if your map is real big then you need to specify which place you wanna spawn after you came from that exact map\exit. Because if you set the usual Player 1 Start thing it uses the one that was created the last. There is an idea to solve the problem with tags but Teleport to Map (74) linedefs do not have tags.

I searched the forum specifically for Hexen/hub exits and teleports. I didn't find what I need in that case (or maybe a little unexperienced). ZDoom wiki has a lot of script categories in ACS but I'm a little starter to find the exact solution to it.

Which script or object should I use in order to achieve this goal?

Here's the example of what I need.

We have a square MAP01. It has a MAP02 teleporter on the left and MAP03 teleporter on a right. They work fine as you spawn in the level a go through them in order to enter another map in a hub, but when you come back you get back to the position as if you have just started MAP01. So basically you should stand in front of the teleporter you came from, again like in Hexen. That is really needed for big Maps that are connected together in circle.
User avatar
ramon.dexter
Posts: 1543
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Actions between maps (ZDoom In Hexen Format)

Post by ramon.dexter »

Try using acs action ChangeLevel() with combination of correctly set-up player starts.
Look here:
https://zdoom.org/wiki/ChangeLevel

The usage is quite simple.
In MAP01 place default player start with args set to 0. That will be the start where you start the map from menu.
Then you can set up transfer into other maps (aka make a hub). So, just find a suitable place to transport to MAP02 and prepare a way to trigger following script:

Code: Select all

Script "toMap02" (void) {
  ChangeLevel("map02", 201, 0);
}
Then, in MAP02 just place a player start with arg0 set to 201.
If you want to return to MAP01, repeat the mentioned actions, just change the required to make it work in repeat.
So, in map01 place a player start in place that is reasonable to return from map02, in arg0 set up, lets say 102 and in map02 create a script:

Code: Select all

Script "toMap01" (void) {
  ChangeLevel("map01", 102, 0);
}
For other maps, just repeat the process with appropriate parameters.
Last edited by ramon.dexter on Thu May 04, 2023 12:57 pm, edited 3 times in total.
VVanTuz2OO2
Posts: 7
Joined: Thu Nov 24, 2022 11:04 am
Preferred Pronouns: He/Him
Operating System Version (Optional): many
Graphics Processor: Intel (Legacy GZDoom)

Re: Actions between maps (ZDoom In Hexen Format)

Post by VVanTuz2OO2 »

ramon.dexter wrote: Thu May 04, 2023 12:43 pm Try using acs action ChangeLevel() with combination of correctly set-up player starts.
Look here:
https://zdoom.org/wiki/ChangeLevel
Thanks, that's the solution. And I finally got it how to search the wiki efficiently.
User avatar
MartinHowe
Posts: 2031
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom

Re: Actions between maps (ZDoom In Hexen Format)

Post by MartinHowe »

I'm also trying to get my head around this. AFAIK, libraries didn't exist in the original ACS. So how did one compile a script in one map that was meant to be executed in another? Did HeXen simply have access to all scripts in all maps? Can scripts be declared with a scope? Please can anyone give me a simple explanation?
User avatar
Player701
 
 
Posts: 1647
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: Actions between maps (ZDoom In Hexen Format)

Post by Player701 »

You call remotely call a script in another map via ACS_Execute or ACS_NamedExecute simply by providing a non-zero value of the second argument corresponding to the desired map number (e.g. 5 for MAP05, and if your map does not follow the MAPxx naming convention, you will have to define a number manually).

Note that the wiki states that both maps must belong to the same cluster for this to work, but I'm not sure it's actually true: AFAIK, Hexen makes use of this feature to implement a switch puzzle that spans multiple hubs (which unlocks a secret level at the end).

Return to “Scripting”