Player Selector


The Player Selector device module (BP_DeviceModule_PlayerSelector) allows the gadget to have the functionality to select players in different ways.

There are a few different ways of selecting a player using the selector module:

  • Manually: Click on players, or drag a rectangle over a group of players. For more details, see Manual Selector Modes.

  • By role: Selects everyone by their current role (the list matches your level's roles table, with roles like "participant", "presenter", etc.)

  • By tag: Selects people by their tags (handled by the M2M User Tag Component). You can manually add tags to players using M2M_UserTagComponent::AddUserTag.

  • Select Everyone

This item needs to have the module added to its item executor's button data to be used. For more details on how to configure the module, and listen to its events, see Usage.

Manual Selector Modes

Player Individual

This mode allows the user to select a character using a line trace from the mouse to the world. It will select the first Actor it detects that is/inherits from BP_M2_PlayerCharacterBase. To select people using this mode simply move the cursor over a character and do a quick tap to the Left Mouse Button

Player Combined

This mode combines Player Individual with a Marquee mode.

The Marquee mode allows the user to draw a rectangle on the screen and select all the characters that are contained in that box. A quick tap to the Left Mouse Button will use the Individual mode option with the same functionality as described above. Holding the Left Mouse Button for a brief moment will enable the Marquee mode and the user will see a border being drawn on the screen. Releasing the Left Mouse Button will select all the characters that are within this border.


To have the ability to select players with a gadget the BP_DeviceModule_PlayerSelector needs to be added to the Button data used by the gadget ItemExecutor. This will add the UI for the device as well as adding the functionality to select the players using the mouse.

Configuring the module data

There are various properties in the player selector module, which can be configured depending on your use case:

  • ShortcutAction/ShortcutMapping - controls what button is used for making manual selections. The recommended shortcuts are IA_PresenterSelector1/2 which are bound to left and right click respectively.

  • AllowTagSelection - if this is true, the "Select by tag" option will be available (it will be hidden if not)

  • AllowRoleSelection - if this is true, the "Select by role" option will be available

  • AllowSelfSelection - if this is true, you will be able to click on your own character and treat them as a selection. (If not, you will only be able to click on other characters)

  • AllowSelectAll - if this is true, the "Select everyone" button will be present

  • AllowPluralManualSelection - if this is true, then selecting people will be done in "additive mode" - i.e. selecting new people will add to the group of selected people. If the flag is false, making a new manual selection will replace the old manual selection.

  • ShowSelectionInstructions - if true, there will be some info text added to the controls widget for the item.

  • DefaultToSelectEveryone - if true, this marks to the UI that having nobody selected means everyone is selected. This is used e.g. by BP_ItemExecutor_ItemGranter. NOTE: This is only a UI flag, actually selecting everyone will need to be done implementation-side.

  • AllowManualSelection - not currently used

Getting your currently selected characters

The player selector module exposes a OnSelectionUpdated event, which triggers whenever the selection changes.

It also has a GetSelection method, which returns all the current selection details, both from manual selection and roles/tags. This can be passed to the ability, so that the ability's effects are applied to the correct people

In the ability, you can then use one of two flows (using helpers from BPFL_DeviceModules):

  • On the clients, you can check SelectionIncludesPlayer, to know whether an ability applies to the provided morpheus actor:

  • If applying the ability on the server, you can use the GetAllSelectedPlayers helper. NOTE: This iterates over all characters currently in the world, so won't scale well at high player counts. If you are running large scale events, take care when using this flow.

Be also sure to enable the PlayerSelector module on the "InitializeExecutor" event and disable it on the "TearDownExecutor" event

About Marquee Selection

Detecting Actors On Rectangle

The marquee functionality uses a modified function from the Unreal Engine source code. "AHUD::GetActorsInSelectionRectangle" is a function that given 2 points will return an array of actors that are on the same screen position as the rectangle formed by those 2 points. This function can not be used as is only available during HUD draw calls. The modified version lives under AJ_BaseHUD::IsBoundingBoxInRectangle. This modified version uses a similar functionality but instead of going through all the actors in the world it will receive a FBox that are the bounds of an actor on Local Space, the center position of the bounding box in World Space and the 2 points of the rectangle. This allows the function to work with any bounding box provided. It also has the option to requiere the bounding box to be fully enclosed in the rectangle.

Showing Marquee Selection Border

To be able to show the Rectangle on screen the WBP_MarqueeSelector widget must be spawned. It contains the basic functionality to get a border on screen and get the coordenates afterwards to be used with the detection. Once the widget is spawned the order of operation is the following (No need to use mouse coordinates):

  • Call "SetStartingLocation" with the mouse coordinates

  • Make the border visible calling "SetVisible"

  • Update the coordinates of the second point of the rectangle using "UpdatedMouseLocation".

  • To get the rectangle coordinates call "GetFixedRectangleForSelection" which return a transformed coordinates to take into account the scale of the window.

  • Call "ResetValues" to clear the rectangle and hide the border

Last updated