ERAiAPI
Loading...
Searching...
No Matches
GoalNative Class Reference

Meant to document how the goal object works inside the game executable. More...

#include <GoalNative.hpp>

Public Member Functions

bool Activate ()
 Called from Update, Interrupt and other functions that can add goals. If already activated return true.
 
GOAL_RESULT Update (float dT)
 Called every game tick.
 
bool Terminate ()
 Called whenever a goal is deleted, such as success, failure, ClearSubGoal, etc. Only if goal already activated.
 
bool Interrupt ()
 Called on game tick.
 

Detailed Description

Meant to document how the goal object works inside the game executable.

Definition at line 7 of file GoalNative.hpp.

Member Function Documentation

◆ Activate()

bool GoalNative::Activate ( )

Called from Update, Interrupt and other functions that can add goals. If already activated return true.

Call goal's activate function, for script goals this first calls SetupScriptGoalInfo if not yet called, then if in battle state call InitializeTableGoal for table goals, and finally call GoalName_Activate or ActivateTableGoal (Goal.Activate).

If marked with no sub goal via REGISTER_GOAL_NO_SUB_GOAL immediately add sub goal ActivateNoSubGoal

◆ Interrupt()

bool GoalNative::Interrupt ( )

Called on game tick.

Interrupt sub goal, if sub goal interrupt result is true, return true. Otherwise continue.

If not marked with REGISTER_GOAL_NO_INTERUPT(goal, value) call goal's interrupt function, for script goals this is GoalName_Interupt or, InterruptTableGoal_Common (Goal.Interrupt) for every interrupt type and InterruptTableGoal.

If result is true call activate for subgoal.

◆ Terminate()

bool GoalNative::Terminate ( )

Called whenever a goal is deleted, such as success, failure, ClearSubGoal, etc. Only if goal already activated.

Terminate sub goals.

Call goal's terminate function, for script goals this is GoalName_Terminate or TerminateTableGoal (Goal.Terminate)

Provides unknown goal cleanup, such as team related info and more.

Set goal as not activated.

◆ Update()

GOAL_RESULT GoalNative::Update ( float dT)

Called every game tick.

If goal hasn't activated yet, activate it.

Update life.

Update goal timers. Update TurnTimerBeforeAttack.

Update update timer, if timer is done randomize a new value according to REGISTER_GOAL_UPDATE_TIME(goal, minTime, maxTime) (default 0.1, 0.1).

Update sub goal.

If a goal is not marked with no update via REGISTER_GOAL_NO_UPDATE(goal, isNoUpdate), and has life and, has no sub goals or its sub goals result is continue then call the goal's update function, for script goals this is GoalName_Update or UpdateTableGoal (Goal.Update).

If that goal result is continue and the subgoal result is success with no further subgoals, convert goal result to success.

If that goal result is contniue and your life is and you're set as success on end with GoalFunc::SetLifeEndSuccess then convert goal result to success.

If goal fail: check GoalFunc::SetFailedEndOption. Default is AI_GOAL_FAILED_END_OPT__REPLANING which will mark AI for replan, return goal failure. AI_GOAL_FAILED_END_OPT__PARENT_NEXT_SUB_GOAL will set goal result to success.

If goal continue: return continue.

If goal success: terminate goal, return success.

If top goal result is continue and has no subgoals, replan.


The documentation for this class was generated from the following file: