Game logic - Custom controls – Ylands
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.
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
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 a trigger
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