Multiple Actions From One Switch/Item Pickup/Etc...

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.

Multiple Actions From One Switch/Item Pickup/Etc...

Postby hjordan159 » Sun Sep 20, 2020 6:54 pm

Hello,

I done a fair amount of level design with the source engine (HL2, L4D2), but am new when it comes to mapping for Doom. I'm trying to figure out how to have multiple actions occur from doing one event. For example: pressing use on a switch raises a door, AND lowers a nearby wall. Or perhaps having a linedef that will lower a wall when crossed, but only AFTER the player has picked up an item (keycard in this instance). There must be a way to assign more than one event per action, does Ultimate Doom Builder do this natively or does it require scripts?

I've tried googling, but can't really think of a good way to phrase what I'm looking for, so I haven't been able to find an answer yet. Thank you to anyone who can help!
hjordan159
 
Joined: 20 Sep 2020

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby SanyaWaffles » Sun Sep 20, 2020 6:56 pm

you're looking for using ACS. It's a scripting language available to the Hexen and UDMF formats.
User avatar
SanyaWaffles
Certified Heretic and Grill Champion
 
Joined: 25 Apr 2013
Location: Disappointment Island
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby Hellser » Sun Sep 20, 2020 7:00 pm

What map format are you mapping for? Boom? UDMF? There's different answers for what you want to do. But generally if you're aiming for this be playable on ZDoom and its children ports, you should be using UDMF and scripting your map with ACS. ACS is powerful - and can do EXACTLY what you need it for. :)
User avatar
Hellser
Remember Citadel
Global Moderator
 
Joined: 25 Jun 2006
Location: Citadel Station
Discord: Hellser#8156
Operating System: Windows 11
OS Test Version: Yes (Using Development/Testing Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby hjordan159 » Sun Sep 20, 2020 7:04 pm

Thanks for answering so quickly! I'm am using UDMF, this will be running through GZDOOM. I'll take a look at ACS.
hjordan159
 
Joined: 20 Sep 2020

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby Hellser » Sun Sep 20, 2020 7:06 pm

Don't be afraid to ask questions. There are very talented users here that can give you pointers on ACS.
User avatar
Hellser
Remember Citadel
Global Moderator
 
Joined: 25 Jun 2006
Location: Citadel Station
Discord: Hellser#8156
Operating System: Windows 11
OS Test Version: Yes (Using Development/Testing Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby hjordan159 » Sun Sep 20, 2020 8:04 pm

Since this is my first map, I'll probably keep it simple with the scripting. I am not a coder, hopefully I can understand the basic stuff for what I'm trying to accomplish above.

Lets say that I want picking up a key card to do the following:

1. Lower a nearby wall
2. Allow for a linedef to also lower a wall when crossed (does nothing if keycard isn't picked up).

I would start with the key, and give it the action of execute script, correct?

Code: Select allExpand view
script 1 (void)
{
   Floor_LowerToNearest (tag, speed)
}     


Would the above work for at least the first part? Not sure how to approach the linedef. Can you setup the linedef action in the editor, but have it start out as disabled? And then include something in the above script to have it enable when picking up the keycard?
hjordan159
 
Joined: 20 Sep 2020

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby Kappes Buur » Mon Sep 21, 2020 4:08 am

To have a single action occur you would attach that action special to the linedef, may it be a walkover trigger or a press use trigger.

To have multiple actions occur from a single trigger you simply add the action specials one after the other in a script. This usually involves giving id tags to sectors. To execute a script you would use the action special ACS_Execute attached to a linedef.

https://zdoom.org/wiki/Action_specials
https://zdoom.org/wiki/Built-in_ACS_functions

If an action takes some time to conclude then add Tagwait or a delay after the action special,

https://zdoom.org/wiki/Richard_Clark%27s_tutorials
https://zdoom.org/wiki/Script_types

For example, to move the ceiling of a sector (id tag 37) up and down repeatedly


Code: Select allExpand view
#include "zcommon.acs"                      //  don't forget this

script 200 OPEN                             //  an OPEN script starts right away

//  194:Ceiling_RaiseInstant (tag, arg1, height)
//  193:Ceiling_LowerInstant (tag, arg1, height)
//  void ChangeCeiling(int tag, str flatname)
//  void Delay (int tics);

{
    Ceiling_RaiseInstant ( 37, 0, 2);       //  raise ceiling of sector 37, 2 times 8 units
    ChangeCeiling        ( 37, "F_SKY1");   //  change the ceiling texture
    delay ( 35*3);                          //  wait 3 seconds

    Ceiling_LowerInstant ( 37, 0, 2);       //  lower ceiling of sector 37, 2 times 8 units
    ChangeCeiling        ( 37, "CEIL5_1");  //  change the ceiling texture
    delay ( 35*3);                          //  wait 3 seconds

    restart;                                 // repeat
}
User avatar
Kappes Buur
 
 
 
Joined: 17 Jul 2003
Location: British Columbia, Canada

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby hjordan159 » Tue Sep 22, 2020 9:38 am

Thanks, I've played around with the built in script editor and some of the above examples. Once I get further along with the WAD I'll post some screenshots and will hopefully have a finished map to share. Thank you!
hjordan159
 
Joined: 20 Sep 2020

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby hjordan159 » Sat Oct 03, 2020 8:29 pm

Hello Again,

I'm having an issue scripting this out: Killing monster A will spawn monster B.

I've used ThingCount and it works exactly how I need when I test with Vanilla Doom 2. However, the map I've been working on is really meant to played with Brutal Doom and more preferably Project Brutality, and when I test with either of those the script behaves differently. I built a quick test map to compare vanilla vs modded with the below script:

Code: Select allExpand view
#include "zcommon.acs"

script 1 OPEN
{
   While(ThingCount(T_zombie, 1) > 0)
      Delay(35);

   Thing_SpawnFacing (2, 1, 0);


Killing the zombie with TID 1 will active the Map Spot, which has a TID of 2 and spawns a second enemy. In vanilla Doom 2, this works exactly as intended. When I try testing with Brutal/Project Brutality, the Map Spot auto activates and spawns the second enemy. It does not wait for the first zombie to be killed. I've tried changing the script type to VOID and/or having it execute from crossing a Line Def, but still have the same issue. Thanks again for any help you can provide.
hjordan159
 
Joined: 20 Sep 2020

Re: Multiple Actions From One Switch/Item Pickup/Etc...

Postby hjordan159 » Mon Oct 05, 2020 10:45 pm

I think I figured this out, so nevermind for now. I replaced T_zombie with T_none and it works correctly.
hjordan159
 
Joined: 20 Sep 2020


Return to Mapping

Who is online

Users browsing this forum: No registered users and 0 guests