Lua and XML: Goal Management

I have previously mentioned TaskForce.Set_As_Goal_System_Removable(false): this sets a TaskForce plan permanently "on" so that the goal system cannot re-evaluate it based on changes in perceptions. There are other functions that act as Goal - Lua go betweens. '''

Purge_Goals(PlayerObject)

This resets every goal for the PlayerObject. If production is underway and remains affordable under the budgets after re-evaluation, the production should continue.

TaskForce.Set_Plan_Result(boolean)

This tells the goal system that the plan was succesfully executed. This allows for per failure desire adjusts to affect perceptual equation results based on the number of failures. Note that calling ScriptExit will usually tell the AI that the plan has failed unless the result is set to True using TaskForce.Set_Plan_Result(true) first.

Budget.Flush_Category("goal_category_name")

This Lua function empties the budget of a goal category so that it is forced to be reset to its current perceptual equation-defined fraction of the total budget. The vanilla game uses this to clean out the Empire player's tech budget if either they are upgrading tech (Can_Reclaim_Excess_MajorItem_Budget equation, Reclaim_Excess_MajorItem_Budget goal) or if they need to free up the budget for more space forces, or they already have the Death Star (Need_to_Flush_MajorItem_Budget perception, Flush_MajorItem_Budget goal)