Mostly Harmless

Legacy:ElevatorTriggerPlus

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT :: Actor (UT) >> Triggers (UT) >> ElevatorTrigger >> ElevatorTriggerPlus (custom)

The elevator trigger only responds to proximity. This class disables proximity but adds tag event response.

//=============================================================================
// ElevatorTriggerPlus.
//=============================================================================
class ElevatorTriggerPlus extends Triggers;
 
// A special trigger devised for the ElevatorMover class, since
// detecting one trigger message is not enough to determine 2 or more
// different commands (like up/down). When an event
// triggers it, it sends a message to the ElevatorMover with the desired
// keyframe change and moving time interval.
 
var() int GotoKeyframe;
var() float MoveTime;
var() bool bTriggerOnceOnly;
 
//
// Called when something triggers the trigger.
//
function Trigger( actor Other, pawn EventInstigator )
{
local ElevatorMover EM;
// Call the ElevatorMover's Move function
if( Event != '' )
foreach AllActors( class 'ElevatorMover', EM, Event )
EM.MoveKeyframe( GotoKeyFrame, MoveTime );
 
if( bTriggerOnceOnly )
// Ignore future touches.
SetCollision(False);
}

Implementation

  1. open actor browser
  2. click on "triggers"
  3. click "trigger" -> "new script"
    1. package: MyLevel
    2. name : ElevatorTriggerPlus
  4. put the code over the small code UT put there
  5. tools -> compile changed
  6. use the trigger in your level before you save and exit or it wont save it

(there's a page that explains this you can link to: Create A Subclass)

Credit

Taken from http://forums.beyondunreal.com/showthread.php?t=88718

Credit to "The_Countess".