LineSide

From ZDoom Wiki
Jump to: navigation, search

int LineSide (void)

Usage

Returns an integer value based on the side of the line a script was activated from. For readability there are defines in zdefs.acs as follows:

  • LINE_FRONT = 0
  • LINE_BACK = 1

This allows you to carry out actions depending on which way the player crosses the line.

Examples

This script creates a one-way corridor. It uses a sequence of lines, all set to be repeatable and activated when walked over. They activate this script, script using the parameter which is the direction the player would be going in if they were walking from the front of the line over to the back.

script 1 (int angle)
{
	if (LineSide() == LINE_BACK)
		ThrustThing(angle, 10, 0, 0);
}

If the player crosses the line normally, e.g. front to back, they will not be hindered. If they try to cross it in reverse, e.g. back to front, they will be thrust away in the correct direction.