Ylands Custom controls

From Bohemia Interactive Community
Jump to navigation Jump to search

Overview

Custom controls manager allows the user to customize the controls (i.e key bindings) of a custom game.

  • Custom controls manager can be found under Scripting Tools / Custom controls in the Editor header.
  • Custom controls allow to disable any of the default actions.
  • Custom controls allow to define custom triggers and custom actions.
Ylands-Editor-CC-scheme.png

Triggers

Each time player uses any kind of Human Interface Device (keyboard, mouse or mobile device) a trigger is fired. There are two types of triggers - custom and default triggers.

  • Default triggers - are default user controls (as defined in game options) which trigger default game actions.
  • Custom triggers - are custom user controls defined only for the purpose of current Custom game, but alone they will do nothing.

Actions

When a trigger is fired (default or custom), in order to take effect a corresponding action has to be fired to actually make any impact on the game.

  • Default actions - are the actual default user actions embedded in the game, such as firing a weapon or driving a car.
    • Can be disabled using the Custom Controls Manager.
  • Custom actions - are actions defined by Game creator.
    • Custom action can use both default or custom triggers to be instigated.
    • In order to have any effect, each custom action has to be scripted via Event Listener.

Custom Controls manager

Ylands-Editor-CC-overview.png

Default actions + Context

List of default actions. When "Filter by selected context" is checked, all the actions will be filtered according to the selected Context. In order to disable any default action, just simply un-check the checkbox next to the name of that action.

Context

Context is a category of controls related to specific control mode, for example when sailing a ship or riding a horse. When selecting a context from drop-down menu, the preview in the middle will change accordingly. Preview allows to check the controls layout and verify whether the control elements are not obstructing each other (mobile only).

Custom triggers + Custom actions

Both custom triggers and custom action can be defined in corresponding tabs.

Adding Custom Trigger

Trigger properties

It is possible to add new trigger by simply pressing the + button at the end of the trigger list. Any trigger can be then edited by using the properties panel found at the other side of the screen. It is necesarry to define the controls for both PC and mobile. PC is supporting keyboard and mouse. Mobile on other hand does not have these and has to have all the control elements present on the screen in form of buttons.

  • Name - name of the custom trigger.
  • PC properties
    • Default key - the key used for this trigger on PC.
  • Mobile properties
    • Button position - position of the button on mobile device.
    • Sprite - image used for the button.
    • Button text - or text, if no image is used.
    • Button background - background color.
    • Button foreground - foreground color.

Adding Custom Action

Action properties

Actions are managed in same manner as custom triggers. However actions does not have to be always active and can be enabled or disabled via scripting.

  • Active - determines whether the action is active (available) by default.
    • Actions can be enabled / disabled via Visual Scripting using the Get / Set Custom Action instruction.
  • Name - name of the action.
  • ID - internal identifier, used in scripting.
  • Trigger type - haptic requirements of the action.
  • Trigger - allows to select a trigger from the list.
    • Default - available default triggers.
    • Custom - all the custom triggers.
  • PC
    • Show hint - whether to show the hint on players HUD in game.
    • Hint - hint text.

Mobile

    • Hint - text under the button.

Scripting Custom Controls

Event Listener

Event listener

To start scripting custom actions, first add new Event Listener from Game Logic panel and set it to listen to Player Action event On Custom Key Action. Corresponding Event will be then available in Visual Scripting and can be used. To distinguish between different Custom Actions, Action ID event parameter can be used. This parameter is corresponding with ID defined via Controls Manager and it is passed along while the Custom Action is triggered.

Instructions

Both Default nad Custom Actions can be enabled or disabled in runtime via Visual Scripting.