Make linedef activate script without changing map

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.

Make linedef activate script without changing map

Postby brick » Mon Oct 11, 2021 7:33 pm

Hi all.

I'm trying to modify an existing map so that walking over an existing linedef (that currently has no flag) will activated a scripted action. Nothing complex, I just want, when they player crosses over, for a small image (area name, CWILV-style) to fade in, while the music changes. The caveat is that, for various reasons, I do not want to touch the map or the original WAD in any way. Everything has to be done outside the WAD, and when loaded alongside it be able to call the script when the map is being played. The map is in Doom format.

The best bet seems to be using Zscript. Load zscript.zc separately (in a companion wad), and have it run the following script when the line is crossed:
Code: Select allExpand view
{
      SetFont("CWILV01");
      HudMessage(s:"A";HUDMSG_FADEINOUT,2,CR_UNTRANSLATED, 1.5, 0.5, 6.0, 1.0, 1.0);
      SetMusic("D_STALKS");
}

If I understand what I'm doing (not a certainty!), this will change the music and make the name fade in the center of the screen and stay for 6 seconds before fading out. The problem is that I can't figure out what functions I need to include to call this when line #19624 is crossed. I tried going through the Zscript documentation on the Wiki here as well as on Github and I confess I'm having a great deal of trouble understanding most of what I see (my programming brain is so bad I struggled with DECORATE).

Ideally I'd like to be able to tell the script "if MAP05 is loaded and linedef #19624 is W1-triggered then run this script", but is this even possible? The alternative that I can think of is using LevelPostProcessor but how could I use this to point it to the script? It's a Doom format map, so ACS_execute (or whatever Zscript equivalent) won't work. I'd also still have the problem of getting the script to understand which map I want this to happen on - every example I see with LevelPostProcessor uses a checksum, which I don't have; can you simply tell LevelPostProcessor to look in a specific map name without the checksum?
(the other problem with ACS is that, again if I understand it right, I'd need the script to be in the map's BEHAVIOR, which is not an option since it'd require changing the wad itself)

Thanks in advance.
brick
 
Joined: 30 Apr 2021
Operating System: Windows Vista/7/2008 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Make linedef activate script without changing map

Postby Blue Shadow » Mon Oct 11, 2021 9:10 pm

brick wrote:The alternative that I can think of is using LevelPostProcessor but how could I use this to point it to the script? It's a Doom format map, so ACS_execute (or whatever Zscript equivalent) won't work. I'd also still have the problem of getting the script to understand which map I want this to happen on - every example I see with LevelPostProcessor uses a checksum, which I don't have; can you simply tell LevelPostProcessor to look in a specific map name without the checksum?
(the other problem with ACS is that, again if I understand it right, I'd need the script to be in the map's BEHAVIOR, which is not an option since it'd require changing the wad itself)

You can get a map's checksum by executing mapchecksum command from the console, e.g. mapchecksum map05.

LevelPostProcessor has a method to assing an action special to a line.

ACS libraries allow you to load and execute ACS scripts even if the map format doesn't support ACS.
User avatar
Blue Shadow
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Make linedef activate script without changing map

Postby brick » Tue Oct 12, 2021 11:50 pm

Thanks a lot for the pointers! This turned out to be easier than I thought. I had seen a LOADACS lump before but hadn't really understood what it did and what libraries are.
I assigned both SetLineActivation and SetLineSpecial through Zscript using the map checksum, then put my script in the ACS library. I tested the level a bit and everything seems to be working exactly as I wanted it.
Thanks again!
brick
 
Joined: 30 Apr 2021
Operating System: Windows Vista/7/2008 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests