Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Koko Ricky

ACS Script that causes killed thing to open door/spawn projectiles?

Question

I'm entirely new to ACS scripting (I'm mapping in UDMF fyi), and I'm finding that both the wiki articles and video tutorials are overwhelming; even the beginner material is too abstract for my understanding. What's the best way for someone in my position to learn ACS? Specifically, for my first script, I'm trying to do something relatively simple: At the end of the map, upon killing a specific enemy (a cyberdemon), I want both a door to open, as well as revenant missiles to fire from a specified location, similar to the missile attacks in Doom 64. 

Share this post


Link to post

16 answers to this question

Recommended Posts

  • 0

@GoatLord: Here is a simple script that might help you.

 

#include "zcommon.acs"

//****
// Script 1: Opens door & Triggers Revenant Missiles when Cyberdemon dies
//****

script 1 (void)
{
	Door_Open(100,32);				//Opens door with Tag # 100
	Thing_Projectile (1,53,192,255,0);		//Spawns revenant missile (Spawn ID 53) from Map Spot with TID = 1
							//193 is the Byte Angle
							//255 is the horizontal speed, 0 is the vertical speed
}

You will need to place map spot at the locations where you want the revenant missiles to spawn from. Adjust the Byte Angle and speed to suit your needs.

 

Then, select your cyberdemon and assign it an ACS special, with 1 being the first argument (i.e., the script number). When the cyberdemon dies, the ACS script will be triggered.

Edited by ReX : Added information & made a correction

Share this post


Link to post
  • 0

Also, I'm guessing you've already reviewed the "official" ZDooM tutorial on ACS, yes? Still, go back and read it again, as it provides the basics of script structure and syntax (the rules and "vocabulary" that apply to scripting).

Share this post


Link to post
  • 0

This is really over my head and I'm not understanding the responses here, and I'm also finding the Zdoom tutorial to be overwhelming. I'm not sure what to ask because this is a bit too abstract for me.

Share this post


Link to post
  • 0

I'm trying to think of an easier way of doing it if possible, if it helps. But I'm pretty sure it's going to require a script to just have projectiles just pop out of no where.

So here's this so far..

 

--------------------------------------------------------------------------

Cyber demon to open the door when it dies without script:

Editing the Thing Properties in the UDB:

 

In UDMF format, you should be able to tell the Cyber demon to open the door when it dies by clicking on the Cyber in the editor then go to Action/Tag/Misc. and give it an action of 11 Door Open. 

Then give it a tag number that of course would be the same as your doors sector tag that you want to open.

That's basically that, when the Cyber dies, the door opens..

--------------------------------------------------------------------------

 

Spawn Revenant projectile without script using a linedef to activate:

This assumes that you have linedef in your map, ready to walk over heh..

 

Ok you could actually spawn the Revenant projectile using a linedef to Activate a Mapspot thing.

So, Linedef Action: 134 Spawn Projectile

And then set up the Linedef with say:

MapSpot Tag of 2 

Projectile type: Tracer ~ it's the Revenants projectile..

Movement angle: we'll just say 128 for now..

Then the speeds: horizontal, lets make it fast like 200 lol, and the vertical at 0..

Then Check repeatable and when player walks over..

Ok it..

 

Now place a normal dynamic light in your map, set its height at about 64 and give it a tag of 2..

Run the map.

--------------------------------------------------------------------------

 

Caution, once you walk over the linedef, there should be a projectile flying 200 miles per frame just above your head. 

I'm sure it could be done different ways, aside from the most common using a script, like mapspot sector regions etc, but anyways..

Ok now, I hope that helps. ;)

 

Note* the linedef is telling the projectile to shot only one direction, if you want some projectiles to also shoot from the other side of the room the opposite direction, setup another linedef with a mapspot tag of 3 in this case and set its direction to the opposite. since the other line is saying the direction of 128, set this one to 0.. and then a few more dyno lights on the other side of the room with a tag of 3. 

Also note that these projectiles Do Not Seek the player.

That said, just because this is another way of doing it, this is just a work around, it doesn't mean a scripted version wouldn't work better!

 

Here ya go:

projectile_test01.zip

I have it so an imp opens the door when he dies instead.. didn't want to have to battle a cyber every time to test the wad lol.

Cheers

 

Edited by Mr.Rocket

Share this post


Link to post
  • 0
6 hours ago, GoatLord said:

This is really over my head and I'm not understanding the responses here ....

I'm unclear on whether you can't follow the example script and accompanying instructions, or you can't understand the overall process of implementing a script. Let me try to simplify things further:

 

A. What You're Trying to Achieve

1. Multiple actions once the cyberdemon dies

2. Specifically, the opening of a door and the spawning of revenant missiles

 

B. The Process of Making That Happen: Map Elements

1. Assign a special to the cyberdemon, indicating the script number that will be triggered upon the cyberdemon's death. [Assume the script number = 1]

2. Assign a tag number to the door you wish to have open

3. Place mapspots where you want the revenant missiles to originate

4. Assign one or more tag numbers to the mapspots. [The example script assumes one or more mapspots with just one tag number]

 

C. The Process of Making That Happen: Script Elements

1. Open your script editor

2. All ACS scripts for ZDooM must begin with the statement: #include "zcommon.acs"

3. Use "//" to comment out any text. The script ignores such comments while interpreting the logic of your instructions. Comments are useful, as they allow you (and others) to follow the logic that was developed for the script. In the case of the example script, you can see that the comments explain various aspects of the script. Here is what the script will look like with no comments:

#include "zcommon.acs"

script 1 (void)
{
	Door_Open(100,32);
	Thing_Projectile (1,53,192,255,0);
}

3. Scripts must have a number (or a name) and be of the types listed here. Because your script is triggered by the death of an enemy, it is considered a "closed" script. This means that the script must indicate "void" in the argument. [There are other valid arguments, but for your purposes, "void" will work very well.] Hence, the statement: script 1 (void)

4. For ACS to process and understand the logic of a script, there needs to be a way for each script to be kept separate from the other scripts. For this, a pair of curly braces [ { and } ] must be used, the "left" curly brace at the beginning, and the "right" curly brace at the end

5. Between the curly braces is where your instructions will go.

6. Each instruction must be closed with a semicolon ( ; ) This allows ACS to know when one instruction has ended and the next one has begun

 

D. The Process of Making That Happen: Specifics of Your Script

1. Door_Open is the instruction for opening a door using ACS. You'll notice that the instruction takes 3 arguments - tag of affected sector, speed with which the door rises, and lighttag (tag of sector to perform a gradual lighting effect in). ACS will work equally well if only the first two arguments are used. Hence, the instruction: Door_Open(100,32);

2. Thing_Projectile is the instruction for spawning one of the available types of projectiles. The arguments taken are:

a. TID (thing ID) of the mapspots where your projectiles are spawned (in this case, TID =1)

b. Type of projectile, identified by spawn number (in this case, the revenant missile, which has a spawn ID number = 53)

c. The angle (direction) that the projectile will travel from the mapspot. This argument uses Byte Angles to determine direction. Byte Angles differ from "traditional" angles, in that they don't go from 0 to 360. Instead, they go from 0 to 255. In the example script, a Byte Angle value of 192 represents a direction of South. [Note, I had accidentally used a value of 270 in my original example, which I have now edited/changed.]

d. Horizontal speed of the projectile; a value of 255 is very high, representing a very fast projectile

e. Vertical speed of the projectile; if you want the projectile to travel only horizontally, assign a value of "0" to this argument

 

This is an example of a very simple script that is conditional only on the death of the cyberdemon.

Share this post


Link to post
  • 0
4 hours ago, GoatLord said:

I don't understand how I'm supposed to give a map spot thing a tag when it's been placed.

 

Furnish a tag just like with any thing

 

o2sT5TJ.png

 

On 1/31/2021 at 11:29 AM, GoatLord said:

This is really over my head and I'm not understanding the responses here, and I'm also finding the Zdoom tutorial to be overwhelming. I'm not sure what to ask because this is a bit too abstract for me.

 

My intro into scripting may be seem like rambling on, but I tried to make it as easy to understand as possible.

Share this post


Link to post
  • 0
8 hours ago, GoatLord said:

I don't understand how I'm supposed to give a map spot thing a tag when it's been placed.

No offense, but if you don't know how to do that, scripting might be a little too soon for you.

Share this post


Link to post
  • 0

I suspect we're at the receiving end of a massive practical joke.

 

@Kappes Buur: I searched your site for an ACS tutorial, but found none. Had I found it I wouldn't have blathered on, the way I did in my post.

Share this post


Link to post
  • 0
2 minutes ago, ReX said:

I suspect we're at the receiving end of a massive practical joke.

Well I hope that's the case, heh.

Share this post


Link to post
  • 0
43 minutes ago, ReX said:

I suspect we're at the receiving end of a massive practical joke.

 

@Kappes Buur: I searched your site for an ACS tutorial, but found none. Had I found it I wouldn't have blathered on, the way I did in my post.

 

That's odd. The link in my post works for me.

 

xKWtcu2.png

Share this post


Link to post
  • 0

The door opens, but the projectiles don't launch. I have them as mapspots with the right tags (I copied/pasted thing_projectile so there's four instances of them, with different tags and angles, and those tags correspond to the ones assigned to the mapspots). I don't get why this isn't working.

Share this post


Link to post
  • 0
14 hours ago, ReX said:

I suspect we're at the receiving end of a massive practical joke.

Although I haven't been formally diagnosed, friends and family members have told me repeatedly they believe I have a learning disability. Without professional examination, I can't say one way or the other, but I have noticed that I tend to find instructions confusing and have sometimes had to drag a thread into the mud trying to understand how to mod Doom. I can assure you this is not a joke, I'm just...kind of dumb with certain things. I'm not exactly happy about it. The tutorials are presented clearly in plain English, but I find it difficult to mentally model what is being expressed. The way words are arranged sometimes doesn't automatically create meaning in my mind.

Edited by GoatLord

Share this post


Link to post
  • 0
2 hours ago, GoatLord said:

...... The tutorials are presented clearly in plain English, but I find it difficult to mentally model what is being expressed. The way words are arranged sometimes doesn't automatically create meaning in my mind.

 

This is an example video of displaying text on the screen

 

 

maybe that will help.

 

Nevertheless, to really understand what is going on some reading is involved.

For example, check out the ZDoom Wiki for the various terms used in the video.

 

One error which crept in was that delay (1); is not one second, it is really one tic, which is 1/35 of a second.

So, a one second delay would be 35 tics

delay (35); or delay (1*35);

or a delay of 5 seconds would be

delay (175); or delay (5*35);

 

Share this post


Link to post
  • 0
12 hours ago, GoatLord said:

Although I haven't been formally diagnosed, friends and family members have told me repeatedly they believe I have a learning disability.

My apologies for my previous comment. I did not intend to mock your perceived condition.

 

At any rate, @Mr.Rocket had sent me an example wad using a variation of the script I had outlined above. I believe he won't have any objections to my posting it here. Open up the map, see how the things (enemy, mapspots) are defined, and look at the script. He has jazzed up the spawning of the revenant missiles, but you will get the gist.

projectile_script.zip

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×