Game Master: Entity Tooltip Creation – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
m (cat)
m (Text replacement - "\{\{Link\|enfusion.*\.c\|([A-Za-z0-9_]+)\}\}" to "{{Link/Enfusion|armaR|$1}}")
 
Line 3: Line 3:
This is a step by step guide on how to create tooltips for Entities that can be viewed when focusing on Editable Entities in [[Arma Reforger:Game Master|Game Master]].
This is a step by step guide on how to create tooltips for Entities that can be viewed when focusing on Editable Entities in [[Arma Reforger:Game Master|Game Master]].


The entity name as well as the icon and image are set within the {{Link|enfusion://ScriptEditor/scripts/Game/Editor/Components/EditableEntity/SCR_EditableEntityComponent.c|SCR_EditableEntityComponent}} on the (editable) entity itself.
The entity name as well as the icon and image are set within the {{Link/Enfusion|armaR|SCR_EditableEntityComponent}} on the (editable) entity itself.




== Script Creation ==
== Script Creation ==


Create a new class inheriting from {{Link|enfusion://ScriptEditor/scripts/Game/Editor/UI/Components/Tooltips/Tooltips/Details/SCR_EntityTooltipDetail.c|SCR_EntityTooltipDetail}} in {{hl|Data\scripts\Game\Editor\UI\Components\Tooltips\Tooltips\Details}}.
Create a new class inheriting from {{Link/Enfusion|armaR|SCR_EntityTooltipDetail}} in {{hl|Data\scripts\Game\Editor\UI\Components\Tooltips\Tooltips\Details}}.


There are a few methods that are important for a basic tooltip detail:
There are a few methods that are important for a basic tooltip detail:

Latest revision as of 12:04, 5 January 2023

An entity tooltip in action.

This is a step by step guide on how to create tooltips for Entities that can be viewed when focusing on Editable Entities in Game Master.

The entity name as well as the icon and image are set within the SCR_EditableEntityComponent on the (editable) entity itself.


Script Creation

Create a new class inheriting from SCR_EntityTooltipDetail in Data\scripts\Game\Editor\UI\Components\Tooltips\Tooltips\Details.

There are a few methods that are important for a basic tooltip detail:

Method Description
InitDetail() This method checks if the tooltip can be displayed as well as getting any references to the (content) layout part of the tooltip detail using the given widget. Return true if the tooltip is to be displayed.

Note that once the condition is met the tooltip detail cannot be hidden until the player stops focusing on the entity, so take that into account.

NeedUpdate() It will update the tooltip detail if you return it true.
UpdateDetail() This is called after init and if NeedUpdate() returns true. Here you can update the content part of the tooltip detail by changing the widgets.


Config Modding

Open the Entity Tooltip config EntityTooltips.conf located in \Data\Configs\Editor\Tooltips; all entity tooltips share the same config.

The Entity Tooltip config holds an array of all Editable Entity types. Each Entity Type has their own tooltips that are displayed when hovering over it. Each of the Entity Type elements holds once again an array of tooltip Details. Generally each line you see in the tooltip is its own detail that can be shown, hidden and changed depending on the entity conditions.
The layout of a tooltip detail is divided into two parts: the label layout and the content layout.

Layout Description
Label The label is spawned by default and holds the Display Name of the tooltip detail as well as a widget which will hold the content layout.
Content This is the more unique part of the tooltip which you can change. In general this is a Text widget but it can be anything you like such as a slider.

Add to Config

Locate the correct entity type with which to display the tooltip detail. Add the tooltip detail within their array - note that the order in the array is the same as displayed in the actual tooltip.

Make sure to set the following default variables:

Variable Description
Display Name This is the display name which will be shown on the label of the tooltip detail
Layout This is the actual content of the tooltip detail. (InitDetail() has a reference to this Widget) You can use any of the existing Layouts (\Data\UI\layouts\Editor\Tooltips\TooltipPrefabs\) or create your own.
Show Label If false it will not show a label. Display Name in this case is not needed as it is hidden.
Most tooltip details have more variables than the default, be sure to check them for examples.