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

Setting sector effects through scripting

Recommended Posts

I'm trying to add an effect to a sector with scripting but I'm not sure how,

e.g. I want to make a sector that lowers into some lava and when it reaches the lava level the floor will change flat and the sector will then become instant death,

I had a look on the wiki but I couldnt find anything. Im using ZDOOM btw.

Share this post


Link to post

Well, it's just a matter of finding the right ACS functions and specials to alter the sectors in question.

For your scenario, you'll want to use something like this:

Script 1 (int Tag, int Speed)
{
  Floor_LowerToLowest(Tag, Speed);         // Lower sector.
  TagWait(Tag);                            // Wait for sector to stop lowering.
  ChangeFloor(Tag, "LAVA1");               // Change floor texture.
  Sector_SetDamage(Tag, 10000, MOD_LAVA);  // Assign damage to sector.
}
This script will lower a sector's floor to the lowest adjacent sector, which will we assume is instant-kill lava. The floor will change to lava and the sector damage will be applied to it, only after the sector has finished lowering.

To call this script, you need to supply two arguments in your map editor: the tag of the sector to lower, and how fast you want it to lower. I'll assume you're also using "LAVA1" as your lava flat textures. Of course you can change anything in the script to customize it to your liking.

The idea is that a script is broken down into specific steps and you have to combine action specials to usually get where you want to go. You can make things more flexible by defining arguments and using them in your code like variables. Notice how all of the specials/functions make use of the "Tag" argument. If you do this, you can specify the tag and speed in the map itself, and reuse it on as many sectors as you wish, without actually having to write a new script for each area where you want a floor to drop into lava.

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
×