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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×