Follower Commands
Creating Commands
To create a command, you first need to make a class overriding CustomFollowerCommand
.
Example:
CustomFollowerCommand
supports the following overrides:
Type | Name | Default |
---|---|---|
string | InternalName | [REQUIRED] |
Sprite | InventoryIcon | TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath(“placeholder.png”)) |
List<FollowerCommandCategory> | Categories | new() { FollowerCommandCategory.DEFAULT_COMMAND } |
string | GetTitle(Follower follower) | LocalizationManager.GetTranslation($“FollowerInteractions/{ModPrefix}.{InternalName}“) |
string | GetDescription(Follower follower) | LocalizationManager.GetTranslation($“FollowerInteractions/{ModPrefix}.{InternalName}/Description”) |
string | GetLockedDescription(Follower follower) | LocalizationManager.GetTranslation($“FollowerInteractions/{ModPrefix}.{InternalName}/NotAvailable”) |
bool | ShouldAppearFor(Follower follower) | true |
bool | IsAvailable(Follower follower) | true |
void | Execute(interaction_FollowerInteraction interaction, FollowerCommands finalCommand = FollowerCommands.None) | interaction.Close(true, reshowMenu: false); |
Coroutines
Some actions, such as changing tasks, require starting a coroutine using interaction.StartCoroutine(interaction.FrameDelayCallback())
.
Example:
Adding Commands
To add a command to the game, simply use CustomFollowerCommandManager.Add()
.
Example:
Final Steps
For the icon to load, you need to put it in the appropriate location. For the example, this would be /Assets/example_follower_command.png
relative to the root folder containing the .dll
Directory structure: