Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 |
//============================================================================= // DMSquad. // operational AI control for DeathMatch // each bot is on its own squad //============================================================================= class DMSquad extends SquadAI; function AssignCombo(Bot B) { if ( (B.Enemy != None) && B.EnemyVisible() ) B.TryCombo("DMRandom"); } function DisplayDebug(Canvas Canvas, out float YL, out float YPos) { local string EnemyList; local int i; Canvas.SetDrawColor(255,255,255); EnemyList = " Enemies: "; for ( i=0; i<ArrayCount(Enemies); i++ ) if ( Enemies[i] != None ) EnemyList = EnemyList@Enemies[i].GetHumanReadableName(); Canvas.DrawText(EnemyList, false); YPos += YL; Canvas.SetPos(4,YPos); } function bool IsDefending(Bot B) { return false; } function AddBot(Bot B) { Super.AddBot(B); SquadLeader = B; } function RemoveBot(Bot B) { if ( B.Squad != self ) return; Destroy(); } /* Return true if squad should defer to C */ function bool ShouldDeferTo(Controller C) { return false; } function bool CheckSquadObjectives(Bot B) { return false; } function bool WaitAtThisPosition(Pawn P) { return false; } function bool NearFormationCenter(Pawn P) { return true; } /* BeDevious() return true if bot should use guile in hunting opponent (more expensive) */ function bool BeDevious() { return ( (SquadMembers.Skill >= 4) && (FRand() < 0.65 - 0.15 * Level.Game.NumBots) ); } function name GetOrders() { return CurrentOrders; } function bool SetEnemy( Bot B, Pawn NewEnemy ) { local bool bResult; if ( (NewEnemy == None) || (NewEnemy.Health <= 0) || (NewEnemy.Controller == None) || ((Bot(NewEnemy.Controller) != None) && (Bot(NewEnemy.Controller).Squad == self)) ) return false; // add new enemy to enemy list - return if already there if ( !AddEnemy(NewEnemy) ) return false; // reassess squad member enemy bResult = FindNewEnemyFor(B,(B.Enemy !=None) && B.LineOfSightTo(SquadMembers.Enemy)); if ( bResult && (B.Enemy == NewEnemy) ) B.AcquireTime = Level.TimeSeconds; return bResult; } function bool FriendlyToward(Pawn Other) { return false; } function bool AssignSquadResponsibility(Bot B) { local Pawn PlayerPawn; local Controller C; local actor MoveTarget; AssignCombo(B); if ( B.Enemy == None ) { // suggest inventory hunt if ( (B.Skill > 5) && (Level.Game.NumBots == 1) && ((B.Pawn.Weapon.AIRating > 0.7) || B.Pawn.Weapon.bSniping) ) { // maybe hunt player - only if have a fix on player location from sounds he's made for ( C=Level.ControllerList; C!=None; C=C.NextController ) if ( (PlayerController(C) != None) && (C.Pawn != None) ) { PlayerPawn = C.Pawn; if ( (Level.TimeSeconds - C.Pawn.Noise1Time < 5) || (Level.TimeSeconds - C.Pawn.Noise2Time < 5) ) { B.bHuntPlayer = true; if ( (Level.TimeSeconds - C.Pawn.Noise1Time < 2) || (Level.TimeSeconds - C.Pawn.Noise2Time < 2) ) B.LastKnownPosition = C.Pawn.Location; break; } else if ( (VSize(B.LastKnownPosition - C.Pawn.Location) < 800) || (VSize(B.LastKillerPosition - C.Pawn.Location) < 800) ) { B.bHuntPlayer = true; break; } } } if ( B.FindInventoryGoal(0) ) { B.bHuntPlayer = false; B.SetAttractionState(); return true; } if ( B.bHuntPlayer ) { B.bHuntPlayer = false; B.GoalString = "Hunt Player"; if ( B.ActorReachable(PlayerPawn) ) MoveTarget = PlayerPawn; else MoveTarget = B.FindPathToward(PlayerPawn,B.Pawn.bCanPickupInventory && (Vehicle(B.Pawn) == None)); if ( MoveTarget != None ) { B.MoveTarget = MoveTarget; if ( B.CanSee(PlayerPawn) ) SetEnemy(B,PlayerPawn); B.SetAttractionState(); return true; } } // roam around level? return B.FindRoamDest(); } return false; } defaultproperties { CurrentOrders=Freelance } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |