U2AI.BehaviorControllerBasic
- Extends
- BehaviorControllerInterf
Core.Object
|
+-- U2AI.BehaviorControllerInterf
|
+-- U2AI.BehaviorControllerBasic
Inherited Contants from Core.Object |
DegreesToRadians, DegreesToRotationUnits, MaxFlt, MaxInt, MAXSEED, NoLabel, NoState, Pi, RadiansToDegrees, RF_NotifyStateChange, RotationUnitsToDegrees |
Enumerations Summary |
EMetaState MS_AttackInactive,
MS_AttackActive,
MS_AttackActiveCantReach,
MS_AttackActiveEnemyNotVisible,
MS_AttackActiveMelee,
MS_AttackActiveMeleeHit,
MS_AttackActiveUseCover,
MS_AttackPassive,
MS_AttackPassiveCantReach,
MS_AttackPassiveEnemyNotVisible,
MS_AttackPassiveMelee,
MS_AttackPassiveMeleeHit,
MS_AttackPassiveUseCover,
|
Inherited Structures from Core.Object |
Alignment, BoundingVolume, Box, Color, ComponentHandle, Coords, Dimension, Guid, Matrix, NotifyInfo, ParticleHandle, Plane, Point, Range, RangeVector, Rectangle, Rotator, Scale, Vector |
Functions Summary |
| | AddTimerSafe (name TimerName, float TimerTime, bool bRepeat, optional float MinTime ))
|
| bool | BehaviorEnabled (int Index ))
|
| | BlockFiring (float SuggestedFireAgainDelay ))
|
| | CheckBehavior ()))
|
| | CheckBehaviorTimer ()))
|
| | CheckEnemySituation ()))
|
| | CheckFireShot ()))
|
| | CheckFireShotTimer ()))
|
| | CheckMetaState ()))
|
| | CheckMetaStateTimer ()))
|
| | CleanupBC ()))
|
| | DisableAllBehaviorsExcept (name TargetState ))
|
| | DisableBehavior (name TargetState ))
|
| | DisableBehaviorInAllLists (name TargetState, bool bDisabledFlag, bool bDisableAllExcept ))
|
| | DisableBehaviorInList (name TargetState, out array<U2PawnBasic.BehaviorT> BehaviorList, bool bDisabledFlag, bool bInvertSelection ))
|
| | DisableBehaviorTemporarily (name TargetState, float Duration ))
|
| | DisableBehaviorTemporarilyInList (name TargetState, float Duration, out array<U2PawnBasic.BehaviorT> BehaviorList, name BehaviorListName ))
|
| | DumpGList ()))
|
| | DumpList (array<U2PawnBasic.BehaviorT> BehaviorList, name BehaviorListName ))
|
| | EnableBehavior (name TargetState ))
|
| bool | GetBCEnabled ()))
|
| float | GetBehaviorOdds (int Index, out float MinOdds ))
|
| float | GetCheckBehaviorDelay ()))
|
| float | GetCheckMetaStateDelay ()))
|
| string | GetCurrentMetaStateName ()))
|
| string | GetCurrentMetaStateNameShort ()))
|
| string | GetExtendedStateInformation ()))
|
| float | GetMinFiringDelay ()))
|
| int | GetNumEnabledBehaviors (array BehaviorList ))
|
| | GetSelectedBehavior (out name SelectedBehaviorState, out name SelectedBehaviorLabel, out float SelectedBehaviorDuration ))
|
| | GetTimeOutDelays (out float CheckBehaviorDelay, out float CheckMetaStateDelay ))
|
| bool | IsFiringMetaState (EMetaState MS ))
|
| | RestoreTimeOutDelays (float CheckBehaviorDelay, float CheckMetaStateDelay ))
|
| | SetBCEnabled (bool bVal ))
|
| | SetLowOddsTimeInAllLists (name TargetState, float NewLowOddsTime ))
|
| | SetLowOddsTimeInList (name TargetState, float NewLowOddsTime, out array BehaviorList ))
|
| | SetMinTimeOutDelay (float MinTimeOutDelay ))
|
| | SetNextCheckFireShotDelay (float SuggestedFireAgainDelay ))
|
| bool | ShouldMeleeAttack ()))
|
| | StartFiring ()))
|
| | UpdateAttackActive (EBCType BCType, out name SelectedBehaviorState, out name SelectedBehaviorLabel, out float SelectedBehaviorDuration ))
|
| | UpdateAttackCantReach ()))
|
| | UpdateAttackEnemyNotVisible ()))
|
| | UpdateAttackMelee ()))
|
| | UpdateAttackMeleeHit ()))
|
| | UpdateAttackUseCover ()))
|
| | UpdateMetaState (EMetaState NewMetaState, float MinBehaviors ))
|
Inherited Functions from U2AI.BehaviorControllerInterf |
BlockFiring, CleanupBC, DisableAllBehaviorsExcept, DisableBehavior, EnableBehavior, GetBCEnabled, GetCheckBehaviorDelay, GetCheckMetaStateDelay, GetCurrentMetaStateName, GetCurrentMetaStateNameShort, GetExtendedStateInformation, GetMinFiringDelay, GetTimeOutDelays, RestoreTimeOutDelays, SetBCEnabled, SetMinTimeOutDelay, SetNextCheckFireShotDelay, StartFiring |
Inherited Functions from Core.Object |
!, !=, $, %, &, &&, *, **, *=, +, ++, +=, -, --, -=, / , /=, <, <<, <=, ==, >, >=, >>, >>>, ?, @, @=, Ablend, AblendR, Abs, Acos, AddFlagSafe, AddTimer, AddTimerS, Asc, Asin, Atan, Atan2, BeginState, Blend, BlendR, CallFunction, CallFunctionS, CanGetProperty, CanSetProperty, Caps, Chr, Clamp, ClassIsChildOf, Constructed, Cos, Cross, DefinesFunction, DefinesFunctionS, Delete, Disable, Dot, DumpProbes, DynamicLoadObject, Enable, EndState, EnumStr, Exp, FClamp, FDecision, FileSize, FindObject, FMax, FMin, FRand, GetAxes, GetContext, GetEnum, GetLanguage, GetPropertyText, GetRand, GetStateName, GetUnAxes, GetWhiteColor, GotoLabel, GotoState, InStr, Invert, IsA, IsInState, IsProbing, Left, Len, Lerp, LineLineIntersection, Localize, Locs, Log, Loge, Max, Mid, Min, MirrorVectorByNormal, Normal, Normalize, NotifyStateChange, ObjListMemStats, OrthoRotation, ProgressSeed, Quotes, Rand, RandomSpreadVector, RandRange, RemoveAllTimers, RemoveFlagSafe, RemoveTimer, RemoveTimerS, ResetConfig, ResetLoaders, Right, RMax, RMin, RotateAngleAxis, RotRand, Round, RSize, SaveConfig, SetProbing, SetPropertyText, SetPropertyTextDefault, Sin, Smerp, SMod, Split, Sqrt, Square, StaticCallFunction, StaticCallFunctionS, StaticDefinesFunction, StaticDefinesFunctionS, StaticSaveConfig, StrArray, StringToName, Tan, TimeRemaining, TimeRemainingS, TraceMessage, VRand, VSize, VSize2D, VSizeSq, VSizeSq2D, Warn, ^, ^^, |, ||, ~, ~= |
CheckBehaviorTimerName Source code
const CheckBehaviorTimerName = 'CheckBehaviorTimer';
CheckFireShotTimerName Source code
const CheckFireShotTimerName = 'CheckFireShotTimer';
CheckMetaStateTimerName Source code
const CheckMetaStateTimerName = 'CheckMetaStateTimer';
const MaxRecursionCount = 5;
var bool bCleaned;
var bool bEnabled;
var name BlockedStateName;
var bool bNPCSetFireShotDelay;
LastAttackActiveCantReachIndex Source code
var int LastAttackActiveCantReachIndex;
LastAttackActiveEnemyNotVisibleIndex Source code
var int LastAttackActiveEnemyNotVisibleIndex;
var int LastAttackActiveIndex;
LastAttackActiveMeleeHitIndex Source code
var int LastAttackActiveMeleeHitIndex;
LastAttackActiveMeleeIndex Source code
var int LastAttackActiveMeleeIndex;
LastAttackActiveUseCoverIndex Source code
var int LastAttackActiveUseCoverIndex;
LastAttackPassiveCantReachIndex Source code
var int LastAttackPassiveCantReachIndex;
LastAttackPassiveEnemyNotVisibleIndex Source code
var int LastAttackPassiveEnemyNotVisibleIndex;
LastAttackPassiveIndex Source code
var int LastAttackPassiveIndex;
LastAttackPassiveMeleeHitIndex Source code
var int LastAttackPassiveMeleeHitIndex;
LastAttackPassiveMeleeIndex Source code
var int LastAttackPassiveMeleeIndex;
LastAttackPassiveUseCoverIndex Source code
var int LastAttackPassiveUseCoverIndex;
LastSelectedBehaviorIndex Source code
var int LastSelectedBehaviorIndex;
var private float LastTimeSeconds;
var float MaxSetAmmoDelay;
var float MinSetAmmoDelay;
NextFireShotTimerAvailableTime Source code
var float NextFireShotTimerAvailableTime;
var float NextSetAmmoTime;
var private int RecursionCount;
var float TotalBehaviorOdds;
enum
EMetaState
{
MS_AttackInactive,
MS_AttackActive,
MS_AttackActiveCantReach,
MS_AttackActiveEnemyNotVisible,
MS_AttackActiveMelee,
MS_AttackActiveMeleeHit,
MS_AttackActiveUseCover,
MS_AttackPassive,
MS_AttackPassiveCantReach,
MS_AttackPassiveEnemyNotVisible,
MS_AttackPassiveMelee,
MS_AttackPassiveMeleeHit,
MS_AttackPassiveUseCover,
};
function AddTimerSafe ( name TimerName, float TimerTime, bool bRepeat, optional float MinTime ) )
function bool BehaviorEnabled ( int Index ) )
function BlockFiring ( float SuggestedFireAgainDelay ) )
local
name SelectedBehaviorState , SelectedBehaviorLabel ; local
float SelectedBehaviorDuration ; local
bool bKeepState ; SelectedBehaviorState = NoState ; SelectedBehaviorLabel = NoLabel ;
SelectedBehaviorDuration =
0.0 ; if(
Pawn!=None&&!ValidEnemy(ControllerEnemy)&&BCType!=BC_EnemyInvalid&&BCType!=BC_TookDamage&&BCType!=BC_UpdateInactive) { DMAssert(false,GetContext()) ; DM(
" NPC state: "$Outer.GetStateName()) ; DM(
" MetaState: "$EnumStr(enum
'EMetaState',MetaState)) ; DM(
" BCType: "$EnumStr(enum
'EBCType',BCType)) ; DM(
" Context: "$ContextStr) ; DM(
" Enemy: "$ControllerEnemy) ; if(ControllerEnemy!=None) { DM(
" Enemy Health: "$ControllerEnemy.Health) ; DM(
" Enemy bHidden: "$ControllerEnemy.Health) ; DM(
" Enemy bDeleteMe: "$ControllerEnemy.Health) ; DM(
" Attitude to Enemy: "$EnumStr(enum
'EAttitude',GetAttitudeTo(ControllerEnemy))) ; } } bKeepState = false ; switch(BCType) { case BC_BehaviorTimeOut : case BC_MetaStateTimeOut : UpdateAttackActive(BCType,SelectedBehaviorState,SelectedBehaviorLabel,
SelectedBehaviorDuration) ; break ; case BC_EnemyAcquired : LastAcquireTime =
Level.TimeSeconds ; SelectedBehaviorState = DefaultAcquisitionState ; break ; case BC_AttackUpdate : case BC_CoverNotFound : case BC_CoverNotNeeded : case BC_EnemyChanged : case BC_EnemyRecovered : case BC_MeleeRangeLost : UpdateAttackActive(BCType,SelectedBehaviorState,SelectedBehaviorLabel,
SelectedBehaviorDuration) ; break ; case BC_EnemyCantReach : UpdateAttackCantReach() ; if(IsMobile()) GetSelectedBehavior(SelectedBehaviorState,SelectedBehaviorLabel,
SelectedBehaviorDuration) ; else SelectedBehaviorState = DefaultImmobileAttackState ; break ; case BC_EnemyNotVisible : case BC_StakeOutEnd : UpdateAttackEnemyNotVisible() ; if(IsMobile()) GetSelectedBehavior(SelectedBehaviorState,SelectedBehaviorLabel,
SelectedBehaviorDuration) ; else if(HasScript()) SelectedBehaviorState = ScriptedState ; else SelectedBehaviorState = DefaultImmobileState ; break ; case BC_CoverLeavingCover : case BC_CoverEnemyNotVisible : case BC_CoverReachedCover : case BC_CoverRecoveredEnemy : case BC_CoverTimeOut : UpdateAttackUseCover() ; if(IsMobile()) GetSelectedBehavior(SelectedBehaviorState,SelectedBehaviorLabel,
SelectedBehaviorDuration) ; else SelectedBehaviorState = DefaultImmobileState ; if(BCType==BC_CoverRecoveredEnemy) { LastAcquireTime =
Level.TimeSeconds -
0.2 ; StartFiring() ; } break ; case BC_MeleeRange : case BC_MeleeUpdate : UpdateAttackMelee() ; if(IsPreparedToMelee(true)) GetSelectedBehavior(SelectedBehaviorState,SelectedBehaviorLabel,
SelectedBehaviorDuration) ; else bKeepState = true ; break ; case BC_MeleeUpdateHit : case BC_MeleeRangeLostHit : UpdateAttackMeleeHit() ; GetSelectedBehavior(SelectedBehaviorState,SelectedBehaviorLabel,
SelectedBehaviorDuration) ; break ; case BC_EnemyInvalid : case BC_TargetInvalid : case BC_UpdateInactive : RemoveTimer(CheckBehaviorTimerName) ; UpdateMetaState(MS_AttackInactive,
0) ; bKeepState = true ; break ; case BC_TookDamage : bKeepState = true ; break ; default : DMAssert(false,GetContext()) ; break ; } if(bKeepState) { } else if(SelectedBehaviorState==NoState) { } else { if(
Level.TimeSeconds==LastTimeSeconds) { RecursionCount + + ; if(RecursionCount>MaxRecursionCount) { Outer.GotoState(DefaultDeadLockedState) ; return ; } } else { LastTimeSeconds =
Level.TimeSeconds ; RecursionCount =
0 ; } if(
SelectedBehaviorDuration>
0.0) AddTimerSafe(CheckBehaviorTimerName,
SelectedBehaviorDuration,false) ; else RemoveTimer(CheckBehaviorTimerName) ; if(Outer.IsInState(SelectedBehaviorState)) { InitializeState() ; if(SelectedBehaviorLabel!=NoLabel) Outer.GotoLabel(SelectedBehaviorLabel) ; } else { Outer.GotoState(SelectedBehaviorState,SelectedBehaviorLabel) ; } } } function CheckBehavior ( ) )
function CheckBehaviorTimer ( ) )
function CheckEnemySituation ( ) )
function CheckFireShot ( ) )
function CheckFireShotTimer ( ) )
function CheckMetaState ( ) )
function CheckMetaStateTimer ( ) )
function CleanupBC ( ) )
DisableAllBehaviorsExcept Source code
function DisableAllBehaviorsExcept ( name TargetState ) )
function DisableBehavior ( name TargetState ) )
DisableBehaviorInAllLists Source code
function DisableBehaviorInAllLists ( name TargetState, bool bDisabledFlag, bool bDisableAllExcept ) )
function DisableBehaviorInList (
name TargetState, out array<
U2PawnBasic.BehaviorT>
BehaviorList,
bool bDisabledFlag,
bool bInvertSelection ) )
DisableBehaviorTemporarily Source code
function DisableBehaviorTemporarily ( name TargetState, float Duration ) )
DisableBehaviorTemporarilyInList Source code
function DisableBehaviorTemporarilyInList (
name TargetState,
float Duration, out array<
U2PawnBasic.BehaviorT>
BehaviorList,
name BehaviorListName ) )
function DumpGList ( ) )
if(bCanOverride||!bNPCSetFireShotDelay) { AddTimerSafe(CheckFireShotTimerName,TimerTime,true) ; } } function DumpList ( array<
U2PawnBasic.BehaviorT>
BehaviorList,
name BehaviorListName ) )
function EnableBehavior ( name TargetState ) )
function bool GetBCEnabled ( ) )
function float GetBehaviorOdds ( int Index, out float MinOdds ) )
function float GetCheckBehaviorDelay ( ) )
GetCheckMetaStateDelay Source code
function float GetCheckMetaStateDelay ( ) )
GetCurrentMetaStateName Source code
function string GetCurrentMetaStateName ( ) )
GetCurrentMetaStateNameShort Source code
function string GetCurrentMetaStateNameShort ( ) )
GetExtendedStateInformation Source code
function string GetExtendedStateInformation ( ) )
function float GetMinFiringDelay ( ) )
GetNumEnabledBehaviors Source code
function
int GetNumEnabledBehaviors ( array<
U2PawnBasic.BehaviorT>
BehaviorList ) )
function GetSelectedBehavior ( out name SelectedBehaviorState,
out name SelectedBehaviorLabel,
out float SelectedBehaviorDuration ) )
function GetTimeOutDelays ( out float CheckBehaviorDelay, out float CheckMetaStateDelay ) )
function
bool IsFiringMetaState (
EMetaState MS ) )
function RestoreTimeOutDelays ( float CheckBehaviorDelay, float CheckMetaStateDelay ) )
local
EBCType BCTypeOut ; if(
Pawn==None) { return ; } else if(
Pawn.Health<=
0) { return ; } if(!bEnabled) { return ; } BCTypeOut = BCTypeIn ; if(MetaState==MS_AttackActiveUseCover||MetaState==MS_AttackPassiveUseCover) { if(BCTypeOut==BC_BehaviorTimeOut) BCTypeOut = BC_CoverTimeOut ; else if(BCTypeOut==BC_EnemyRecovered) BCTypeOut = BC_CoverRecoveredEnemy ; else if(BCTypeOut==BC_EnemyNotVisible&&Outer.GetStateName()!=AttackStationaryState) BCTypeOut = BC_CoverEnemyNotVisible ; } else if(MetaState==MS_AttackActiveMelee||MetaState==MS_AttackPassiveMelee) { if(BCTypeOut==BC_AttackUpdate) BCTypeOut = BC_MeleeUpdate ; } if(BCTypeOut==BC_MeleeUpdateHit) { if((bExecuteOrders&&GetNumEnabledBehaviors(U2PBasic.AttackPassiveMeleeHitBehaviors)==
0)||(!bExecuteOrders&&GetNumEnabledBehaviors(U2PBasic.AttackActiveMeleeHitBehaviors)==
0)) BCTypeOut = BC_MeleeUpdate ; } else if(BCTypeOut==BC_MeleeRangeLostHit) { if((bExecuteOrders&&GetNumEnabledBehaviors(U2PBasic.AttackPassiveMeleeHitBehaviors)==
0)||(!bExecuteOrders&&GetNumEnabledBehaviors(U2PBasic.AttackActiveMeleeHitBehaviors)==
0)) BCTypeOut = BC_MeleeRangeLost ; } if(BCTypeOut==BC_CoverNotFound||BCTypeOut==BC_CoverNotNeeded) { DisableBehaviorTemporarily(AttackMoveToCoverCombatState,U2PBasic.AttackUseCoverLockoutTime) ; } else if(BCTypeOut==BC_AttackCantFire) { DisableBehaviorTemporarily(Outer.GetStateName(),U2PBasic.AttackCantFireLockoutTime) ; BCTypeOut = BC_AttackUpdate ; } else if(BCTypeOut==BC_EnemyRecovered) { SetLowOddsTimeInAllLists(AttackMoveToCoverCombatState,
Level.TimeSeconds+U2PBasic.RecoverLockOutUseCoverTime) ; } BlockedStateName = Outer.GetStateName() ; PreviousMetaState = MetaState ; BlockedStateName =
'' ; } function SetBCEnabled (
bool bVal ) )
SetLowOddsTimeInAllLists Source code
function SetLowOddsTimeInAllLists ( name TargetState, float NewLowOddsTime ) )
function SetLowOddsTimeInList (
name TargetState,
float NewLowOddsTime, out array<
U2PawnBasic.BehaviorT>
BehaviorList ) )
function SetMinTimeOutDelay ( float MinTimeOutDelay ) )
SetNextCheckFireShotDelay Source code
function SetNextCheckFireShotDelay ( float SuggestedFireAgainDelay ) )
function bool ShouldMeleeAttack ( ) )
function StartFiring ( ) )
function UpdateAttackActive (
EBCType BCType,
out
name SelectedBehaviorState,
out
name SelectedBehaviorLabel,
out
float SelectedBehaviorDuration ) )
function UpdateAttackCantReach ( ) )
UpdateAttackEnemyNotVisible Source code
function UpdateAttackEnemyNotVisible ( ) )
function UpdateAttackMelee ( ) )
function UpdateAttackMeleeHit ( ) )
function UpdateAttackUseCover ( ) )
function UpdateMetaState (
EMetaState NewMetaState,
float MinBehaviors ) )
defaultproperties
{
LastSelectedBehaviorIndex=-1
LastAttackActiveIndex=-1
LastAttackActiveCantReachIndex=-1
LastAttackActiveEnemyNotVisibleIndex=-1
LastAttackActiveUseCoverIndex=-1
LastAttackActiveMeleeIndex=-1
LastAttackActiveMeleeHitIndex=-1
LastAttackPassiveIndex=-1
LastAttackPassiveCantReachIndex=-1
LastAttackPassiveEnemyNotVisibleIndex=-1
LastAttackPassiveUseCoverIndex=-1
LastAttackPassiveMeleeIndex=-1
LastAttackPassiveMeleeHitIndex=-1
bEnabled=true
MinSetAmmoDelay=1.000000
MaxSetAmmoDelay=5.000000
}
|
Creation time: sk 3-1-2016 10:48:27.843 - Created with
UnCodeX