Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
StRiKeR

Zdoom ACS Scripting Help [solved]

Recommended Posts

I want to lower a sector from 128 to -64 when the player kills four enemies. I don't know how to put the script together to accomplish this. I'm using DB2 btw. I am somewhat familiar with scripting. I can spawn enemies to a mapspot. Any help would be appreciated.

EDIT: SOLVED

script 2 OPEN
{
   While(ThingCountName("Cacodemon", 666) > 0)
      Delay(35);
   
   Floor_LowerToLowest(666, 16);
}

Share this post


Link to post

You know about thing specials, right? Where you can assign a special to activate upon it's death?

Okay, simple. Pick a TID for the monsters to use. Only these four monsters should use this TID. Now, you need a script that does something like this:

Script XXX
{
  If (ThingCount(T_NONE, TID) == 0)
    Floor_LowerByValue(SectorTag, Speed, 192);
}
Of course you want to set up the parameters above to use whatever values you need for your map.

Now, for each monster, set their TID to the TID you chose. Then set their Thing Special to ACS_Execute and call the script above. Each time one of the monsters dies, the same script will activate, and it will check if all the other monsters are dead, and if so, the wall will lower.

Edit:

In your ninja edit, try changing:
While(ThingCountName("Cacodemon", 666) > 0)
To:
While(ThingCountName("Cacodemon", 999) > 0)
You were giving spawned monsters a new TID of 999, but you were counting those with TID 666.

Share this post


Link to post

In your ninja edit, try changing:

code:While(ThingCountName("Cacodemon", 666) > 0)


To:

code:While(ThingCountName("Cacodemon", 999) > 0)



You were giving spawned monsters a new TID of 999, but you were counting those with TID 666.



Script 1 is not related to Script 2, sorry for the confusion. I am spawning two enemies when the player picks up a shotgun. One right next to the player and the other one outside the room the player entered with script one. Is there a value i can put for the TID on Script 1 that tells it not to apply a TID? I don't need to assign a TID to those two enemies because I am not doing anything else with them after they spawn that would require it.

Share this post


Link to post

Ah, well if you're spawning a monster, be sure to omit the "New TID" argument. I think it is optional, and like you said, only useful if you need to reference the monsters later on. If ACS won't compile the script without that argument, just make it 0 instead.

If needed, to check for monsters without a TID, you can use ThingCount(T_WHATEVER, 0) to return all monsters alive of the specified type and whose TID is 0 (or none). By the way, you should also use the constants defined in zdefs.acs, like T_IMP or T_CACODEMON, so it makes your code a bit more readable.

Share this post


Link to post

But how to add the TID? I am very new to ACS scripting, so please do not laugh at me.

I am currently trying to make a floor lower to the nearest floor when certain enemies are killed. I am using the wiki & this tutorial currently: http://zdoom.org/wiki/A_quick_beginner%27s_guide_to_ACS

What I don't understand is how to assign a thing special to a monster.

Here is my code right now (I'm practicing with one zombie):
#include "zcommon.acs"
script 1 (void)
{
print(s:"You killed a zombie"); //prints "You killed a zombie" onto the screen
Floor_LowerToNearest (1, 64)
ACS_Execute (1, 0, 0, 0, 0)
}

I just have two rooms and one zombie. But how do I specify that particular zombie as the monster to use in the script to make the floor lower? In Doom Builder if you right click on a thing there is no way to add a tag or anything like that. What should I type in the script to make the zombie a Thing Special?

Share this post


Link to post
redcrow said:

In Doom Builder if you right click on a thing there is no way to add a tag or anything like that.

Yes there is; but you have to map in UDMF or the Hexen format. Click on the "Action" tab. There you can give it a tag (aka TID) and an action, with parameters.

Share this post


Link to post

Isn't there a way to make it work in regular Doom 2 format? When you play map07 (Even Simpler) in Doom 2 Hell on Earth for example, you kill all the mancuby and then the walls lower to reveal an arachnotron ambush.

I looked at those walls in Doom Builder and found that they have the tag 666 which indicates that there is some scripting somewhere in the WAD for that level involving the death of the mancuby.

I am not familiar with skulltag or Hexen format yet. I plan to delve deeper into ACS and a wider range of editing possibilities, but for right now I'd like to know how to make this work in Doom 2. I just experimented with hexen format and the single zombie I placed disappeared for some reason. Also a few other things were screwy and didn't work right.

Is it possible to keep it in Doom 2 format and just make an action triggered by the death of monsters?

Share this post


Link to post
redcrow said:

Isn't there a way to make it work in regular Doom 2 format?

Not really.

There are ways to use ACS in Doom format maps; but since the format was never designed to support ACS (which didn't exist at the time after all) doing this is more complicated.

redcrow said:

When you play map07 (Even Simpler) in Doom 2 Hell on Earth for example, you kill all the mancuby and then the walls lower to reveal an arachnotron ambush.

But it's not scripted; it's hardcoded. That's why it only happens on MAP07 and always happens on MAP07.

If you want to make mancubus/arachnotron battles on MAP07 with sectors that lower when all the fatsos are dead and sectors that raise when all the spiders are dead; you don't need ACS at all.

That said, ZDoom does generalize this to some extent. So you can use some MAPINFO keywords to replicate boss battles in other levels; provided the monsters in question have the BOSSDEATH flag. Among stock actors, it includes barons, fatsos, arachnotrons, spiderdemons and cyberdemons. If you want a door to open when all cacodemons are dead, you're out of luck or you'll have to delve into DECORATE as well to make some cacobosses.

Share this post


Link to post
Gez said:

That said, ZDoom does generalize this to some extent. So you can use some MAPINFO keywords to replicate boss battles in other levels; provided the monsters in question have the BOSSDEATH flag. Among stock actors, it includes barons, fatsos, arachnotrons, spiderdemons and cyberdemons. If you want a door to open when all cacodemons are dead, you're out of luck or you'll have to delve into DECORATE as well to make some cacobosses.


Oh that's OK. I was originally just trying to get a wall to lower when a spider mastermind was defeated. That would explain why the zombie never made the wall lower on my experimental map with only two rooms, despite all the trial and error.

So can I simply create an ACS script that applies to the BOSSDEATH flag of a spiderdemon and just have a spiderdemon in the map?

Share this post


Link to post

You can't change properties of monsters in ACS. You need DECORATE for that. ACS can only change things that are bound to the level and gameplay state.

If you want to use ACS, I'd recommend using "ZDoom, Doom in Hexen format" which is fairly close in format to original Doom. There are some extra things.

For lowering a wall when a monster dies (mastemind or zombieman), go go the properties, the action tab, and put an action "Script/Script Execute" on the monster, and enter a script number (eg. 1)

Now make a script like this:

#include "zcommon.acs"
script 1 (void)
{
print(s:"You killed a zombie"); //prints "You killed a zombie" onto the screen
Floor_LowerToNearest (1, 64)
}

btw, what were you trying by executing script 1 from within script 1? Infinite loop?

Share this post


Link to post

Zom-B said:
btw, what were you trying by executing script 1 from within script 1? Infinite loop? [/B]


Oh that was just a mistake. I didn't mean to type it like that. Anyway thanks a million! You've all saved me a lot of time!

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
×