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 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 |
//============================================================================= // WeaponInvRocketLauncher.uc // $Author: Pcarlson $ // $Date: 10/30/02 3:36p $ // $Revision: 45 $ //============================================================================= class WeaponInvRocketLauncher extends U2Weapon; //#exec TEXTURE IMPORT FILE=Assets\RocketLauncher\RL_TPFlash.dds GROUP=Skins LODSET=2 ENVMAP=CubemapsT.Cubemap_dull_sad_001 ENVTYPE=1 //ARL //#exec TEXTURE IMPORT FILE=Assets\RocketLauncher\RL_FPFlash.dds GROUP=Skins LODSET=2 ENVMAP=CubemapsT.Cubemap_dull_sad_001 ENVTYPE=1 #exec OBJ LOAD File=..\Meshes\GlmWeaponsG.ugx #exec OBJ LOAD File=..\Textures\GlmWeaponsT.utx #exec OBJ LOAD File=..\Textures\WeaponFXT.utx var Projectile LastFiredRocket; var Point RocketLocation1, RocketLocation2, RocketLocation3, RocketLocation4; var enum EFireMode { FM_None, FM_Fire, FM_AltFire } FireMode; var float AltFireMinIneffectiveRange; // distance within which altfire will likely pass through/miss target var float AltFireReallyIneffectiveRange; // generally AltFireReallyIneffectiveRange/X preset for speed var float PreferAltFireRange; // distance at which skilled NPCs will prefer altfire simulated function Actor GetAltRocket() { return projectileAltRocket(LastFiredRocket); } simulated function Actor GetMiniRocket( int i ) { return projectileAltRocket(LastFiredRocket).Guide.Rockets[i]; } simulated function bool GetRocketStatus( int i ) { local projectileRocketGuide Guide; Guide = projectileAltRocket(LastFiredRocket).Guide; if( Guide? ) { switch(i) { case 0: return projectileAltRocket(LastFiredRocket).Guide.RocketStatus.R0; case 1: return projectileAltRocket(LastFiredRocket).Guide.RocketStatus.R1; case 2: return projectileAltRocket(LastFiredRocket).Guide.RocketStatus.R2; case 3: return projectileAltRocket(LastFiredRocket).Guide.RocketStatus.R3; } } return false; } simulated function HandleTargetDetails( Actor A, Canvas Canvas, vector ViewLoc, rotator ViewRot ) { local Actor AltRocket; local point RocketLocation; local bool bAltRocket; local vector dummyloc; RocketLocation.X = 0; RocketLocation.Y = 0; AltRocket = GetAltRocket(); bAltRocket = AltRocket!=None && (GetRocketStatus(0) || GetRocketStatus(1) || GetRocketStatus(2) || GetRocketStatus(3)); if( LastFiredRocket!=None && !LastFiredRocket.bDeleteMe ) { if( AltRocket==None ) { if (class'UtilGame'.static.ActorLookingAt(Level.PlayerControllerList.Pawn,LastFiredRocket,cos (Level.PlayerControllerList.FOVAngle/57.2958))) {RocketLocation = GetProjectedLocation( LastFiredRocket.Location, Canvas );} else {RocketLocation = GetProjectedLocation( dummyloc, Canvas, true );} if( FireMode!=FM_Fire ) { FireMode = FM_Fire; class'UIConsole'.static.SendEvent("RL_Fire"); } } else if( bAltRocket ) { if( FireMode!=FM_AltFire ) { FireMode = FM_AltFire; class'UIConsole'.static.SendEvent("RL_AltFire"); } } else { if( FireMode!=FM_None ) { FireMode = FM_None; class'UIConsole'.static.SendEvent("RL_Default"); } } } else if( FireMode!=FM_None ) { FireMode = FM_None; class'UIConsole'.static.SendEvent("RL_Default"); } RocketLocation1.X = RocketLocation.X - 8; RocketLocation1.Y = RocketLocation.Y - 4; RocketLocation2.X = RocketLocation.X + 8; RocketLocation2.Y = RocketLocation.Y - 4; RocketLocation3.X = RocketLocation.X + 8; RocketLocation3.Y = RocketLocation.Y + 4; RocketLocation4.X = RocketLocation.X - 8; RocketLocation4.Y = RocketLocation.Y + 4; if( bAltRocket ) { if( (GetRocketStatus(0))&&(class'UtilGame'.static.ActorLookingAt(Level.PlayerControllerList.Pawn,GetMiniRocket(0),cos (Level.PlayerControllerList.FOVAngle/57.2958))) ) { RocketLocation1 = GetProjectedLocation( GetMiniRocket(0).Location, Canvas );} else {RocketLocation1 = GetProjectedLocation( dummyloc, Canvas, true ); } if( (GetRocketStatus(1))&&(class'UtilGame'.static.ActorLookingAt(Level.PlayerControllerList.Pawn,GetMiniRocket(1),cos (Level.PlayerControllerList.FOVAngle/57.2958))) ) { RocketLocation2 = GetProjectedLocation( GetMiniRocket(1).Location, Canvas );} else {RocketLocation2 = GetProjectedLocation( dummyloc, Canvas, true ); } if( (GetRocketStatus(2))&&(class'UtilGame'.static.ActorLookingAt(Level.PlayerControllerList.Pawn,GetMiniRocket(2),cos (Level.PlayerControllerList.FOVAngle/57.2958))) ) { RocketLocation3 = GetProjectedLocation( GetMiniRocket(2).Location, Canvas );} else {RocketLocation3 = GetProjectedLocation( dummyloc, Canvas, true ); } if( (GetRocketStatus(3))&&(class'UtilGame'.static.ActorLookingAt(Level.PlayerControllerList.Pawn,GetMiniRocket(3),cos (Level.PlayerControllerList.FOVAngle/57.2958))) ) { RocketLocation4 = GetProjectedLocation( GetMiniRocket(3).Location, Canvas );} else {RocketLocation4 = GetProjectedLocation( dummyloc, Canvas, true ); } } } simulated function Point GetProjectedLocation( vector Loc, Canvas Canvas, optional bool returnbad) { local vector RocLoc; local point Pt; Pt.X=Canvas.SizeX+8; Pt.Y=Canvas.SizeY+8; if (returnbad) return Pt; RocLoc = Canvas.Project( Loc ); if ( RocLoc.X >= 0 && RocLoc.X <= Canvas.SizeX && RocLoc.Y >= 0 && RocLoc.Y <= Canvas.SizeY ) { Pt.X = RocLoc.X - Canvas.SizeX/2; Pt.Y = RocLoc.Y - Canvas.SizeY/2; } return Pt; } simulated function Point GetRocketLocation01(){ return RocketLocation1; } simulated function Point GetRocketLocation02(){ return RocketLocation2; } simulated function Point GetRocketLocation03(){ return RocketLocation3; } simulated function Point GetRocketLocation04(){ return RocketLocation4; } function Projectile ProjectileFire( class<projectile> ProjClass ) { LastFiredRocket = Super.ProjectileFire( ProjClass ); return LastFiredRocket; } function float GetProjSpeed( bool bAlt ) { if( bAlt ) return class'projectileRocketGuide'.default.Speed; else return Super.GetProjSpeed( bAlt ); } function bool AdjustProjectileAim( bool bAltFire, class<Projectile> ProjectileClass, vector projStart, float FireSpread, bool bLeadTarget, bool bWarnTarget, bool bTossed, bool bTrySplash ) { if( bAltFire ) { ProjectileClass = class'projectileRocketGuide'; bTossed = false; bTrySplash = false; } return Super.AdjustProjectileAim( bAltFire, ProjectileClass, projStart, FireSpread, bLeadTarget, bWarnTarget, bTossed, bTrySplash ); } // not tossed even though rocket guide has PHYS_Falling function UpdateAltRanges(); /*----------------------------------------------------------------------------- Bots with skill ratio <= 0.25 don't realize that alt-fire is pretty much useless at very close range since by the time the mini rockets are launched, they are likely to be past the target or will miss it. They have a 50/50 chance of ignoring the given ratings. Bots with skill ratio <= 0.50 know not to use alt-fire at very close range but outside of a slightly greater range, they're just as likely to use primary or alt fire. Bots with skill >= 0.625 know how to choose effectively between alt and primary fire at all ranges. They'll only tend to use alt-fire for targets which are fairly far away since a "spam" shot will have a better chance of hitting the Target. */ function PostModifyRatings( Actor Target, float DistanceToEnemy, out float PriFireRating, out float AltFireRating ) { // mdf-tbd: how to expose range of skills to rest of code local float OwnerSkill; // only applies to bots (should place this in AI code?) if( Level.NetMode == NM_Standalone ) return; // if no Target or either mode disabled, base class picks based on raw ratings if( Target != None && PriFireRating != RatingDisabled && AltFireRating != RatingDisabled ) { // has Target and both weapons are enabled (could still have RatingIneffective..RatingDangerous though) // consider skill OwnerSkill = Instigator.Controller.GetSkill(); // mdf-tbd: ideally, all of these cutoffs should be somewhat fuzzy // mdf-tbd: generalize this approach to other weapons? Any applicable? if( OwnerSkill < 0.333 ) { // pretty dumb -- use altfire sometimes even if inside effective range if( FRand() < 0.50 ) { // 50/50 chance of making either mode just as likely if( PriFireRating > AltFireRating ) AltFireRating = PriFireRating; else PriFireRating = AltFireRating; } else { // let base class filter based purely on rating which doesn't take // min effective range into account } } else if( OwnerSkill < 0.67 ) // <=4 { //DM( "Skill <=4 -- AltFireReallyIneffectiveRange: " $ AltFireReallyIneffectiveRange $ " AltFireMinIneffectiveRange: " $ AltFireMinIneffectiveRange ); // fairly skilled bot -- avoid using altfire if target inside min effective range if( DistanceToEnemy <= AltFireReallyIneffectiveRange ) { // really close AltFireRating = RatingIneffective; } else if( DistanceToEnemy <= AltFireMinIneffectiveRange ) { // in AltFireReallyIneffectiveRange..AltMinEffectiveRange --> odds of filtering in 1.0..0.0 //DM( " Odds: " $ (AltFireMinIneffectiveRange - DistanceToEnemy)/(AltFireMinIneffectiveRange-AltFireReallyIneffectiveRange) ); if( FRand() < (AltFireMinIneffectiveRange - DistanceToEnemy)/(AltFireMinIneffectiveRange-AltFireReallyIneffectiveRange) ) { // filter out alt fire AltFireRating = RatingIneffective; } } else { // only highly skilled bots know how to use primary/alt fire most // effectively outside this range -- dumb down ratings // make either mode just as likely if( PriFireRating > AltFireRating ) AltFireRating = PriFireRating; else PriFireRating = AltFireRating; } } else // >=5 { // skilled bot -- encourange primary fire unless target far away // mdf-tbd: scale odds with distance from PreferAltFireRange? if( DistanceToEnemy <= AltFireMinIneffectiveRange ) { AltFireRating = RatingIneffective; } else if( DistanceToEnemy < PreferAltFireRange ) { // tend to prefer pri fire up to this distance if( FRand() < (0.5 + 0.45*OwnerSkill + 0.35*(PreferAltFireRange - DistanceToEnemy)/PreferAltFireRange) ) AltFireRating = RatingIneffective; } else { // tend to prefer alt fire at long distances (low odds either way) if( FRand() < (0.5 - 0.45*OwnerSkill) ) PriFireRating = RatingIneffective; } } } //DMN( " PostModifyRatings (OUT) PriFireRating: " $ PriFireRating $ " AltFireRating: " $ AltFireRating ); } defaultproperties { AltFireMinIneffectiveRange=512.000000 AltFireReallyIneffectiveRange=256.000000 PreferAltFireRange=1280.000000 FireTime=1.083000 AltFireTime=1.083000 FireLastDownTime=2.500000 AltFireLastDownTime=2.500000 FireLastReloadTime=4.000000 AltFireLastReloadTime=4.000000 ReloadTime=3.500000 FlashSkin=Shader'WeaponFXT.RocketLauncher.RL_FP_Skin2FX' FlashSkinTP=Shader'WeaponFXT.RocketLauncher.RL_TP_Skin2FX' FireLastRoundSound=Sound'U2WeaponsA.RocketLauncher.RL_FireLastRound' AltFireLastRoundSound=Sound'U2WeaponsA.RocketLauncher.RL_AltFireLastRound' ReloadUnloadedSound=Sound'U2WeaponsA.RocketLauncher.RL_ReloadUnloaded' GunButtSounds(0)=Sound'U2WeaponsA.GunButt.GunButt01' GunButtSounds(1)=Sound'U2WeaponsA.GunButt.GunButt02' GunButtSounds(2)=Sound'U2WeaponsA.GunButt.GunButt03' GunButtSounds(3)=Sound'U2WeaponsA.GunButt.GunButt04' FirstPersonOffset=(X=50.000000,Z=-10.000000) bCrosshairGlows=true WeaponAnimationType=AT_Shoulder AltShakeMag=3.000000 AltShakeTime=0.150000 TargetableTypes(0)='Pawn' CrosshairName="RL_Cross" RangeMinFire=192.000000 RangeIdealFire=512.000000 RangeMaxFire=2048.000000 RangeLimitFire=32767.000000 RatingInsideMinFire=-20.000000 RatingRangeMinFire=-0.500000 RatingRangeIdealFire=0.800000 RatingRangeMaxFire=0.200000 RatingRangeLimitFire=0.100000 AIRatingFire=0.750000 RangeMinAltFire=80.000000 RangeIdealAltFire=1024.000000 RangeMaxAltFire=1400.000000 RangeLimitAltFire=1400.000000 RatingInsideMinAltFire=-20.000000 RatingRangeMinAltFire=-0.500000 RatingRangeIdealAltFire=0.750000 RatingRangeMaxAltFire=0.100000 RatingRangeLimitAltFire=0.010000 AIRatingAltFire=0.700000 AmmoName=Class'U2Weapons.ammoInvRocketLauncher' PickupAmmoCount=5 AutoSwitchPriority=14 PreferCrouchingMultiplier=2.000000 PreferProneMultiplier=0.000000 FiringSpeed=1.000000 FireOffset=(X=10.000000,Y=19.000000,Z=4.000000) ProjectileClass=Class'U2Weapons.projectileHeavyRocket' AltProjectileClass=Class'U2Weapons.projectileAltRocket' ShakeMag=14.000000 ShakeTime=0.300000 bWarnTarget=true bAltWarnTarget=true bSplashDamage=true bAltSplashDamage=true bRecommendSplashDamage=true AIRating=0.750000 RefireRate=1.000000 AltRefireRate=2.000000 FireSound=Sound'U2WeaponsA.RocketLauncher.RL_Fire' AltFireSound=Sound'U2WeaponsA.RocketLauncher.RL_AltFire' CockingSound=Sound'U2WeaponsA.RocketLauncher.RL_Reload' SelectSound=Sound'U2WeaponsA.RocketLauncher.RL_Select' InventoryGroup=3 GroupOffset=1 PickupClass=Class'U2Weapons.weaponRocketLauncher' PlayerViewOffset=(X=0.000000,Z=0.000000) BobDamping=0.975000 ThirdPersonMesh=LegendMesh'GlmWeaponsG.RL_TP' ItemName="Rocket Launcher" ItemID="RL" IconIndex=5 Mesh=LegendMesh'GlmWeaponsG.RL_FP' Mass=500.000000 UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |