Activate (Line)

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


Line

native bool Activate(Actor activator, int side, int type)

Usage

Activates the calling linedef.

Parameters

  • Actor activator
The actor that activated the linedef, if any.
  • int side
The side of the line to activate from. If a side of -1 specified, the height of the activator relative to the line will not be checked. (Verification needed) Possible sides include:
  • Line.Front: The front side of the linedef.
  • Line.Back: The back side of the linedef.
  • int type
The activation type. Multiple can be given, but not all of these are particularly useful. Possible types include:
  • SPAC_Cross: A player crossed the line.
  • SPAC_Use: A player used the line.
  • SPAC_MCross: A monster crossed the line.
  • SPAC_Impact: A projectile hit the line.
  • SPAC_Push: A player pushed the line.
  • SPAC_PCross: A projectile crossed the line.
  • SPAC_UseThrough: (Need more info)
  • SPAC_AnyCross: Activated by anything besides actors with NOTELEPORT.
  • SPAC_MUse: A monster used the line.
  • SPAC_MPush: A monster pushed the line.

Return value

Returns true if the line was successfully activated. False otherwise.

RemoteActivate()

In addition to Activate(), ZScript also has a RemoteActivate() function, which works the exact same except for the inclusion of a pos parameter:

  • pos: The Vector3 position to remotely activate the line from, if any. This is useful for linedefs that use range checks to see if they can be activated.

Examples

This basic function can be added on an monsters' code to make them try to use whatever line last blocked them, unless it has no special.

	bool AttemptLineUse ()
	{
		if (bNoTrigger) return false;
		
		if (BlockingLine && BlockingLine.special)
		{
			if (bCanUseWalls)
			{
				BlockingLine.Activate (Self,0,SPAC_MUse);
				return true;
			}
			else if (bCanPushWalls)
			{
				BlockingLine.Activate (Self,0,SPAC_MPush);
				return true;
			}
		}
		
		return false;
	}