Combat Actions
Estimated reading time: 4 minutesPurpose
maplebirch.combat.CombatAction adds modded action buttons to vanilla combat action lists, and can also attach the matching combat reaction text.
The button itself is shown through the vanilla generateCombatAction flow. When the action is selected, the framework injects the configured effect into the matching action section of vanilla effectsman.
See Combat Reactions and Combat Speech for more on reactions and dialogue.
Entry Point
You can register multiple actions at once:
Minimal Example
Then define a normal Twine widget for the text and effects:
When the player selects this action, $leftaction becomes myModQuickStrike. During effectsman, the framework generates and runs a block similar to:
Config
Most fields except id and actionType may be functions. Functions receive a ctx object.
actionType
The same action can be registered to multiple lists:
effect
effect is the Twine content that runs after the action is selected. The recommended form is a widget call:
It can also be a function:
The framework wraps the effect in an action check, resets the corresponding action variable to 0, and updates the default action:
Put more complex default-action handling, targeting, skill cost, or branching text inside your own effect widget.
Injection Position
Vanilla combat reaction text is hardcoded in effectsman, but actions are roughly grouped by body/action section. The framework injects mod effects into the matching section:
leftaction/rightaction: hand action sectionfeetaction: feet action sectionmouthaction: mouth action sectionvaginaaction: vagina action sectionanusaction: anus action sectionthighaction: thigh action sectionpenisaction: penis action sectionchestaction: chest action section
This keeps a left-hand action reaction near the hand-action text instead of appending it to the end of the whole combat output.
Full Example
Notes
valueshould not collide with vanilla actions or other mods. A mod prefix is recommended.- Keep
condlightweight and avoid changing game state inside it. effectmay output text, call macros, update variables, spend stamina, or change NPC state.- Set
combatTypeif the action is only valid in a specific combat type.
