Page MenuHomeFeedback Tracker

Command to return string of unit's description from editor
Closed, ResolvedPublic

Description

Currently there's no command to return the description of a unit (the one from the field in the editor below the unit's initialization-field, that's shown in the role selection screen).
In a lot of cases it'd be great to have such a command, as you could display not only the rank of unit or the player's/unit's name but its description as well. Currently you can only use getText(configFile >> "CfgVehicles" >> typeOf(_x) >> "displayName").

getDescription could do that, but it only gives out an array of the unit's clothing and backpack. Something like getUnitDescription should instead return a string from the unit's description-field or, if not specified, the displayName from CfgVehicles.

Details

Legacy ID
3086501986
Severity
None
Resolution
Fixed
Reproducibility
N/A
Category
Feature Request
Additional Information

Syntax: String = getUnitDescription object
Parameters: object: Object
Return Value: String

Example:
_role = getUnitDescription player;
hint format ["You play the role of %2.",_role];

hints "You play the role of MG-Gunner Team Alpha."

Event Timeline

Belbo edited Steps To Reproduce. (Show Details)Nov 12 2014, 1:27 PM
Belbo edited Additional Information. (Show Details)
Belbo set Category to Feature Request.
Belbo set Reproducibility to N/A.
Belbo set Severity to None.
Belbo set Resolution to Fixed.
Belbo set Legacy ID to 3086501986.May 7 2016, 7:49 PM

While I believe there should be command like this, there is a workaround

Give your unit name, for example: soldier1
Give your unit description, for example: "Heli Gunner"
In init field put: this setVariable ["soldier1", "Heli Gunner"];

to get description in game use

_unit getVariable vehicleVarName _unit

Belbo added a subscriber: Belbo.May 7 2016, 7:49 PM
Belbo added a comment.Nov 19 2014, 5:05 PM

That's not actually a bad idea.

(Although an explicit command would still be better.)