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 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 |
//============================================================================= // JumpSpot. // specifies positions that can be reached with greater than normal jump // forced paths will check for greater than normal jump capability //============================================================================= class JumpSpot extends JumpDest placeable; var() bool bOnlyTranslocator; var bool bRealOnlyTranslocator; var() bool bNeverImpactJump; var() bool bNoLowGrav; var() bool bForceAllowDoubleJumping; // LD promises that bot can really make this double jump (for ones the conservative AI code says would barely fail) var() bool bDodgeUp; var() name TranslocTargetTag; // target to transloc toward var() float TranslocZOffset; var Actor TranslocTarget; var vector CachedSpeed[8]; function PostBeginPlay() { Super.PostBeginPlay(); bRealOnlyTranslocator = bOnlyTranslocator; // used for JumpSpot testing } function bool CanMakeJump(Pawn Other, Float JumpHeight, Float GroundSpeed, Int Num, Actor Start, bool bForceCheck) { local vector V,S; if ( Other.Physics == PHYS_Flying ) return true; if ( bDodgeUp || (JumpPad(Start) != None) ) return true; if ( !bForceCheck && (PhysicsVolume.Gravity.Z >= CalculatedGravityZ[Num]) ) { if ( NeededJump[Num].Z < JumpHeight ) return true; if ( PhysicsVolume.Gravity.Z == CalculatedGravityZ[Num] ) return false; } if ( bForceDoubleJump ) GroundSpeed = FMax(GroundSpeed, Other.Default.GroundSpeed); if ( (CachedSpeed[Num].X <= JumpHeight) && (CachedSpeed[Num].Y <= GroundSpeed) ) return ( CachedSpeed[Num].Z < JumpHeight ); S = Start.Location; S.Z = S.Z - Start.CollisionHeight + Other.CollisionHeight; V = SuggestFallVelocity(Location, S, 2*JumpHeight, GroundSpeed); CachedSpeed[Num].X = JumpHeight; CachedSpeed[Num].Y = GroundSpeed; CachedSpeed[Num].Z = V.Z; //log(self$" jumpZ "$JumpHeight$" groundSpeed "$groundspeed$" suggested Z "$V.Z$" from "$Start); return ( V.Z < JumpHeight ); } function bool CanDoubleJump(Pawn Other) { return ( bForceDoubleJump || Other.bCanDoubleJump || (PhysicsVolume.Gravity.Z > PhysicsVolume.Default.Gravity.Z) ); } function float EffectiveDoubleJump(ReachSpec Path) { // if its about distance, then effective is doubled if ( Path != None && Path.Start != None && Path.End != None && ( Path.Start.Location.Z >= Path.End.Location.Z + 32 ) ) return 1.9; return 1.5; } event int SpecialCost(Pawn Other, ReachSpec Path) { local int Num; local vector DodgeV; local float AllowedJumpZ, RealGroundSpeed; if ( Vehicle(Other) != None ) return 10000000; if ( Other.Physics == PHYS_Flying ) return 100; if ( Other.Controller.bAllowedToTranslocate ) return 200; if ( bOnlyTranslocator || (bNoLowGrav && (PhysicsVolume.Gravity.Z > PhysicsVolume.Default.Gravity.Z)) ) return 10000000; Num = GetPathIndex(Path); if ( CanDoubleJump(Other) ) { if ( bDodgeUp || bForceAllowDoubleJumping ) return 100; AllowedJumpZ = Other.JumpZ * EffectiveDoubleJump(Path); } else { if ( bDodgeUp ) return 10000000; AllowedJumpZ = Other.JumpZ; } if ( CanMakeJump(Other,AllowedJumpZ,Other.GroundSpeed,Num,Path.Start,false) ) return 100; if ( (Path.Distance > 1000) && (PhysicsVolume.Gravity.Z > PhysicsVolume.Default.Gravity.Z) && (UnrealPawn(Other) != None) ) { if ( bForceDoubleJump ) { RealGroundSpeed = Other.GroundSpeed; Other.GroundSpeed = Other.Default.GroundSpeed; DodgeV = UnrealPawn(Other).BotDodge(vect(1,0,0)); Other.GroundSpeed = RealGroundSpeed; } else DodgeV = UnrealPawn(Other).BotDodge(vect(1,0,0)); if ( CanMakeJump(Other,DodgeV.Z + (EffectiveDoubleJump(Other.Controller.CurrentPath) - 1)*Other.JumpZ,DodgeV.X,Num,Path.Start,true) ) return 100; } if ( !bNeverImpactJump && (NeededJump[Num].Z <= 1100) && (bForceDoubleJump || Other.Controller.bAllowedToImpactJump) ) return 3500; return 10000000; } event bool SuggestMovePreparation(Pawn Other) { local int Num; local bot B; local float RealJumpZ, RealGroundSpeed; local vector DodgeV, Dir; if ( Other.Controller == None ) return false; if ( bDodgeUp ) { B = Bot(Other.Controller); if ( B == None ) return false; // only here if can double jump DodgeV = UnrealPawn(Other).BotDodge(vect(1,0,0)); UnrealPawn(Other).CurrentDir = DCLICK_Forward; Other.bWantsToCrouch = false; B.MoveTarget = self; B.Destination = Location; B.bPlannedJump = true; if ( (Other.Anchor != None) && Other.ReachedDestination(Other.Anchor) ) Dir = Location - Other.Anchor.Location; else Dir = Location - Other.Location; Dir.Z = 0; Dir = Normal(Dir); Other.Velocity = DodgeV.X * Dir; Other.Velocity.Z = DodgeV.Z; Other.Acceleration = Other.AccelRate * Dir; Other.SetPhysics(PHYS_Falling); Other.DestinationOffset = CollisionRadius; B.bNotifyApex = true; B.bPendingDoubleJump = true; return false; } Num = GetPathIndex(Other.Controller.CurrentPath); // try translocator if landing would hurt if ( (Other.MaxFallSpeed < Other.Controller.CurrentPath.MaxLandingVelocity) && TryTranslocator(Other) ) return true; if ( bNoLowGrav && (PhysicsVolume.Gravity.Z > PhysicsVolume.Default.Gravity.Z) ) return TryTranslocator(Other); if ( !bOnlyTranslocator && CanMakeJump(Other,Other.JumpZ,Other.GroundSpeed,Num,Other.Controller.CurrentPath.Start,false) ) { //log("regular jump"); DoJump(Other); return false; } B = Bot(Other.Controller); if ( B == None ) return false; if ( bOnlyTranslocator ) return TryTranslocator(Other); if ( CanDoubleJump(Other) && (bForceAllowDoubleJumping || CanMakeJump(Other,Other.JumpZ * EffectiveDoubleJump(Other.Controller.CurrentPath),Other.GroundSpeed,Num,Other.Controller.CurrentPath.Start,false)) ) { // log("double jump"); RealJumpZ = Other.JumpZ; Other.JumpZ = Other.JumpZ * EffectiveDoubleJump(Other.Controller.CurrentPath); DoJump(Other); Other.JumpZ = RealJumpZ; Other.Velocity.Z = FClamp(Other.Velocity.Z - 0.5 * Other.JumpZ,0.7*Other.JumpZ,Other.JumpZ); B.bNotifyApex = true; B.bPendingDoubleJump = true; return false; } if ( (Other.Controller.CurrentPath.Distance > 1000) && (PhysicsVolume.Gravity.Z > PhysicsVolume.Default.Gravity.Z) && (UnrealPawn(Other) != None) ) { //log("TRY DODGE JUMP"); if ( bForceDoubleJump ) { RealGroundSpeed = Other.GroundSpeed; Other.GroundSpeed = Other.Default.GroundSpeed; DodgeV = UnrealPawn(Other).BotDodge(vect(1,0,0)); Other.GroundSpeed = RealGroundSpeed; } else DodgeV = UnrealPawn(Other).BotDodge(vect(1,0,0)); if ( CanMakeJump(Other,DodgeV.Z + (EffectiveDoubleJump(Other.Controller.CurrentPath) - 1) * Other.JumpZ,DodgeV.X,Num,Other.Controller.CurrentPath.Start,true) ) { //log("dodge jump"); RealJumpZ = Other.JumpZ; RealGroundSpeed = Other.GroundSpeed; Other.GroundSpeed = DodgeV.X; Other.JumpZ = DodgeV.Z + (EffectiveDoubleJump(Other.Controller.CurrentPath) - 1) * RealJumpZ; UnrealPawn(Other).CurrentDir = DCLICK_Forward; DoJump(Other); Other.GroundSpeed = RealGroundSpeed; Other.JumpZ = RealJumpZ; Other.Velocity.Z = FMax(0.7*Other.JumpZ, Other.Velocity.Z - 0.5 * Other.JumpZ); B.bNotifyApex = true; B.bPendingDoubleJump = true; return false; } } if ( TryTranslocator(Other) ) return true; if ( !bNeverImpactJump && (NeededJump[Num].Z < 1100) && B.CanImpactJump() ) { Other.Acceleration = vect(0,0,0); B.bPreparingMove = true; B.ImpactTarget = self; B.Focus = None; B.FocalPoint = B.Location - vect(0,0,100); if ( Other.Weapon.IsA('ShieldGun') ) B.ImpactJump(); else B.SwitchToBestWeapon(); return true; } // try double jumping anyway if ( CanDoubleJump(Other) ) { // log("fallback double jump"); RealJumpZ = Other.JumpZ; Other.JumpZ = Other.JumpZ * EffectiveDoubleJump(Other.Controller.CurrentPath); DoJump(Other); Other.JumpZ = RealJumpZ; Other.Velocity.Z = FClamp(Other.Velocity.Z - 0.5 * Other.JumpZ,0.7*Other.JumpZ,Other.JumpZ); B.bNotifyApex = true; B.bPendingDoubleJump = true; return false; } return false; } function bool TryTranslocator(Pawn Other) { local bot B; B = Bot(Other.Controller); B.TranslocationTarget = None; B.RealTranslocationTarget = None; if ( B.CanUseTranslocator() ) { Other.Acceleration = vect(0,0,0); B.bPreparingMove = true; B.TranslocationTarget = self; B.RealTranslocationTarget = self; if ( TranslocTargetTag != '' ) { if ( TranslocTarget == None ) ForEach AllActors(class'Actor',TranslocTarget,TranslocTargetTag) break; if ( TranslocTarget != None ) B.TranslocationTarget = TranslocTarget; } B.ImpactTarget = self; B.Focus = self; if ( Other.Weapon.IsA('TransLauncher') ) { Other.PendingWeapon = None; Other.Weapon.SetTimer(0.2,false); } else B.SwitchToBestWeapon(); return true; } return false; } defaultproperties { CachedSpeed(0)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) CachedSpeed(1)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) CachedSpeed(2)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) CachedSpeed(3)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) CachedSpeed(4)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) CachedSpeed(5)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) CachedSpeed(6)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) CachedSpeed(7)=(X=1000000.000000,Y=1000000.000000,Z=1000000.000000) } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |