Skip to content

Campaign Lua functions for branching#7298

Open
MjnMixael wants to merge 2 commits intoscp-fs2open:masterfrom
MjnMixael:campaign_lua_methods
Open

Campaign Lua functions for branching#7298
MjnMixael wants to merge 2 commits intoscp-fs2open:masterfrom
MjnMixael:campaign_lua_methods

Conversation

@MjnMixael
Copy link
Contributor

BtA3 will have full campaign branching powered by a custom UI that lives outside of the mission environment. This PR provides the necessary methods to make that work.

First it provides a way to use ca.jumpToMission without mucking up the loadout in the campaign. Easy, simple boolean pass that preserves standard behavior.

Second there is a new method, ca:getValidNextMissions(), that walks the mission formula from the current position and returns a table of mission files names whose formula returns true. Standard behavior in FSO with a branch setup like this is to proceed to the first mission whose formula returns true. The rest are ignored.

With these in place, BtA3 can write the branching directly into the campaign file and access the list of valid next missions through Lua. With that we can build a UI and let the player select which mission they want. Then we can use ca.jumpToMission() to take them there with no side effects.

@MjnMixael MjnMixael added the Requested by Active Mod A feature request that has been requested by a mod that is actively in development. label Mar 18, 2026
@MjnMixael MjnMixael added this to the Release 26.0 milestone Mar 18, 2026
@wookieejedi wookieejedi added enhancement A new feature or upgrade of an existing feature to add additional functionality. scripting A feature or issue related to LUA scripting labels Mar 23, 2026
@MjnMixael MjnMixael force-pushed the campaign_lua_methods branch from 076915e to 18172a5 Compare March 24, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A new feature or upgrade of an existing feature to add additional functionality. Requested by Active Mod A feature request that has been requested by a mod that is actively in development. scripting A feature or issue related to LUA scripting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants