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

A script that executes the second time it's triggered

Recommended Posts

What would a script look like where the action occurs the second time the script is triggered?

Say I wanted a floor to lower after a player walks over a line twice.

Share this post


Link to post

Set a variable to count how many times the script has been triggered. For example like this:

#include "zcommon.acs"

int i = 0;                      // variable declaration

script 1 (void) {
  i++;                                // adds 1 to the value of i
  if(i==2) {                          // condition
    Floor_LowerToLowest(1,8);         // action
  }
}
I hope you get the idea. The script will be actually triggered every time you cross the linedef. Variable stores a value (number), which increases every time the script is called, and the value is always checked if it's equal to 2, and if it is, your floor-lowering action is performed.

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
×