From Unreal Wiki, The Unreal Engine Documentation Site
Jump to navigation Jump to search
UT2003 :: Actor >> NavigationPoint >> JumpPad >> UTJumpPad >> TriggerJumpPad (Custom Class)

This is a custom JumpPad that switches on and off when triggered. Use Object -> InitialState to set its initial behaviour.

Simple version

This toggles between active and dormant each time it is triggered. This is accomplished with two states.

The Dormant state overrides the Touch() and PostTouch events with empty functions. These are what caused the actual jumping behaviour in the parent class JumpPad.

Both states have their own version of the Trigger() function which handles the switch to the other state and displays a message on the HUD for testing purposes.

The variable bBlocked is flipped for bot support.


To use this actor:

  1. create a subclass
  2. paste in the code and compile

Because NavigationPoint sets bStatic = True in its default properties, you'll need to change this for the subclass: in the UnrealEd console type

editdefault class=TriggerJumpPad
  1. A pseudo-properties window opens. Set None -> bStatic = False. This will enable the class to change states and repond to being triggered
  2. Add an actor of this class to you map, and set it up as you would a UTJumpPad.
  3. Set the following properties:
    • Object -> InitialState to either Active or Dormant
    • Events -> Tag to match your Trigger's Events -> Event
  4. Set your Trigger's ReTriggerDelay to something like 1 or 2 seconds, otherwise when you test it you'll probably trigger it twice each time you walk into the Trigger.

Once only version

SuperApe originally requested this script, and also asked for a version that could be only be triggered once (for example, in a single-player game you might want to blow up a jump pad).

If you're following this page as a tutorial, you can use the class you've already made: in UnrealEd's script editor, erase the earlier code, paste in this code, and recompile.


We've added two variables and a check section in each Trigger() function. For a one-shot TriggerJumpPad, the mapper sets bTriggerOnceOnly to True. Now this is what happens each time it is triggered:

  1. First Trigger:
    • bTriggered is False, so this check is skipped
    • if bTriggerOnceOnly is True, set the bTriggered flag so next time we'll catch the first test. If bTriggerOnceOnly is False, do nothing.
  2. Second Trigger:
    • if bTriggered is True, return. The Trigger function will never again go past this point. Note that the bTriggered flag will never be set to True if bTriggerOnceOnly is False.

This works, but is somewhat convoluted code. There's also the matter that we've got a certain amount of redundancy: the checking block is duplicated in the two state Trigger() functions. This could in theory be placed in a non-state version of Trigger(), but then there is the problem that the only thing it does is return. In a sub-call of Global.Trigger(), a return statement would just take us back to the state version – so not terribly good.

Once only version: cleaner

Here's the third and final version. We've removed the bTriggered flag and added a third state, Dead. This overrides Touch() and PostTouch() in the same way as the state Dormant, but it has no Trigger() function. Note that this state is not configurable: it's defined without parentheses after the state keyword. This is because there is no reason for the mapper to have the actor begin in this state: the actor simply won't do anything at all, apart from function as a NavigationPoint!

At first view, we seem to be a state short, since the actor can have four configurations: Dormant, Active, Dead, and Permanently Active. However, we've made clever use of the "null" state. This class has nothing defined outside of state code, but it inherits all of its parents' functions. So in the null state, it will behave exactly like UTJumpPad: a jump pad that is always active and can't be triggered, which is exactly what we want for "Permanently Active".

There's still the bTriggerOnceOnly variable to be set by the mapper. Now we simply test against this before switching states. If it's True, Dormant goes to Null, and Active goes to Dead. If it's False, the actor will keep flipping between Active and Dormant each time it's triggered.



Try modifying this class so it can be triggered a certain number of times.