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 |
/** * Copyright 1998-2011 Epic Games, Inc. All Rights Reserved. */ /** defines a place bots should defend. Bots automatically determine reasonable defending positions in sight of their * objective (e.g. flag room), so these should only be used for hard to reach camping spots or choke points far from the objective area */ class UTDefensePoint extends UDKScriptedNavigationPoint placeable; var Controller CurrentUser; var UTDefensePoint NextDefensePoint; // list of defensepoints for same objective var() UDKGameObjective DefendedObjective; var bool bFirstScript; // first script in list of scripts var() bool bSniping; // bots should snipe when using this script as a defense point var() bool bOnlyOnFoot; // bot should not attempt to use this script while in a vehicle var() bool bOnlySkilled; // low skill bots shouldn't use this defense point var() class<Weapon> WeaponPreference; // bots using this defense point will preferentially use this weapon /** defensepoint grouping - bots will make sure each group has at least one defender before assigning a second */ var() name DefenseGroup; var() enum EDefensePriority { /** this point will be used after automatic defensepoints */ DEFPRI_Low, /** this point will be used before automatic defensepoints */ DEFPRI_High, } DefensePriority; /** sprites used for this actor in the editor, depending on which team DefendedObjective is on (if possible to determine in editor) */ var editoronly array<Texture2D> TeamSprites; /* Reset() reset actor to initial state - used when restarting level without reloading. */ function Reset() { Super.Reset(); FreePoint(); } function FreePoint() { CurrentUser = None; } function bool CheckForErrors() { if ( DefendedObjective == None ) { `Log(Self$" has no DefendedObjective!"); return true; } return Super.CheckForErrors(); } function PreBeginPlay() { local UTDefensePoint S, Last; Super.PreBeginPlay(); if ( DefendedObjective == None ) { `Warn(self @ "has no DefendedObjective!"); } else if ( bFirstScript ) { Last = self; // first one initialized - create script list ForEach AllActors(class'UTDefensePoint',S) if ( (S != self) && (S.DefendedObjective == DefendedObjective) ) { Last.NextDefensePoint = S; S.bFirstScript = false; Last = S; } } } /** determines if this point is higher priority than the passed in point * @param S - the point to check against * @param B - the bot that's checking * @param bAutoPointsInUse - whether other bot(s) on this team are using the automatic defensepoints (so allow low priority) * @param bPrioritizeSameGroup - if true, prefer defensepoints of the same group as current, all else being equal * @param NumChecked - the number of usable points so far * @return whether this point is a better choice */ function bool HigherPriorityThan(UTDefensePoint S, UTBot B, bool bAutoPointsInUse, bool bPrioritizeSameGroup, out int NumChecked) { if ( bBlocked || (bOnlySkilled && B.Skill < 3.0) || (bOnlyOnFoot && Vehicle(B.Pawn) != None) || (!bAutoPointsInUse && DefensePriority < DEFPRI_High) ) { return false; } if (CurrentUser != None && !CurrentUser.bDeleteMe && CurrentUser != B && WorldInfo.GRI.OnSameTeam(CurrentUser, B)) { if (UTBot(CurrentUser) != None && UTBot(CurrentUser).DefensePoint != self) { UTBot(CurrentUser).DefensePoint = None; } else { return false; } } if (S == None || S.DefensePriority < DefensePriority) { return true; } if (S.DefensePriority > DefensePriority) { return false; } if (B.FavoriteWeapon != None && ClassIsChildOf(WeaponPreference, B.FavoriteWeapon)) { return true; } if (bPrioritizeSameGroup && S.DefenseGroup != DefenseGroup) { return false; } NumChecked++; return (FRand() < 1.0 / float(NumChecked)); } function Actor GetMoveTarget() { return self; } defaultproperties { Begin Object NAME=Sprite Sprite=Texture2D'EnvyEditorResources.DefensePoint' End Object TeamSprites[0]=Texture2D'EnvyEditorResources.RedDefense' TeamSprites[1]=Texture2D'EnvyEditorResources.BlueDefense' bStatic=true bCollideWhenPlacing=true bFirstScript=true } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |