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 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 |
/****************************************************************************** PersesMAS Creation date: 2011-08-18 21:35 Last change: $Id$ Copyright © 2011, Wormbo Website: http://www.koehler-homepage.de/Wormbo/ Feel free to reuse this code. Send me a note if you found it helpful or want to report bugs/provide improvements. Please ask for permission first, if you intend to make money off reused code. ******************************************************************************/ class PersesMAS extends ONSWheeledCraft; #exec obj load file=PersesMesh.ukx package=WVPersesMAS var() const editconst string Build; var array<vector> GunnerTurretAttachOffsets; var vector GunMountOffset; var float GunMountScale; var array<name> HiddenBones; var array<Material> DestroyedSkins; var float ThrottleFixTime, FixedThrottle, FixedSteering, BotEnterTime; simulated function String GetDebugName() { return Name$" (build "$Build$")"; } simulated function PostNetBeginPlay() { local int i; for (i = 0; i < HiddenBones.Length; ++i) { SetBoneScale(i, 0.0, HiddenBones[i]); } SetBoneLocation('LeftFrontGunMount', GunMountOffset); SetBoneLocation('RightFrontGunMount', GunMountOffset * vect(1,-1,1)); SetBoneLocation('LeftRearGunMount', GunMountOffset * vect(-1,1,1)); SetBoneLocation('RightRearGunMount', GunMountOffset * vect(-1,-1,1)); SetBoneScale(i++, GunMountScale, 'LeftFrontGunMount'); SetBoneScale(i++, GunMountScale, 'RightFrontGunMount'); SetBoneScale(i++, GunMountScale, 'LeftRearGunMount'); SetBoneScale(i++, GunMountScale, 'RightRearGunMount'); SetBoneScale(i++, 0.001, 'RocketArm'); SetBoneScale(i++, 1100.0, 'RocketPost'); for (i = 0; i < PassengerWeapons.Length; i++) { SetBoneLocation(PassengerWeapons[i].WeaponBone, GunnerTurretAttachOffsets[i]); } //AnimBlendParams(1, 1.0, 0.0, 0.0, 'MainGunPowerBase'); //AnimBlendParams(1, 1.0, 0.0, 0.0, 'MainGunPost'); //PlayAnim('MASMainGunHide',,, 1); //FreezeAnimAt(0.0, 1); //PlayAnim('MASMainGunDeploy',,, 2); //FreezeAnimAt(0.0, 2); Super.PostNetBeginPlay(); //if (WeaponPawns.Length > 1 && WeaponPawns[1] != None && PersesTankTurret(WeaponPawns[1].Gun) != None) // PersesTankTurret(WeaponPawns[1].Gun).SetLeftTurret(); // invert aim yaw constraints } function bool ImportantVehicle() { return true; } function bool NeedToTurn(vector targ) { // rocket pack turns quickly enough to allow approximately spamming in the desired direction return (ActiveWeapon >= Weapons.Length || Weapons[ActiveWeapon].bCorrectAim || vector(Weapons[ActiveWeapon].CurrentAim) dot Normal(targ - Weapons[ActiveWeapon].Location) > 0.9); } /** Pick most efficient projectile type for the target to attack. */ function ChooseFireAt(Actor A) { local byte BestType; local float Dist; local Pawn P; local int AdditionalTargets; if (A != None) { if (ActiveWeapon < Weapons.Length && !Weapons[ActiveWeapon].bCorrectAim) BestType = 1; // homing missiles, because not aiming correctly yet else BestType = 0; // mercury missile Dist = VSize(Location - A.Location); if (Dist > 3000 && Dist < 15000 && (Pawn(A) == None || Pawn(A).GroundSpeed < 500)) { foreach RadiusActors(class'Pawn', P, 2000, A.Location) { if (P.Health > 0 && P.bCollideActors && (P.GetTeamNum() == 255 || P.GetTeamNum() != Instigator.GetTeamNum()) && (Vehicle(P) == None || Vehicle(P).IndependentVehicle())) { AdditionalTargets++; } } } if (AdditionalTargets > 1) { BestType = 2; // frag missiles } if (AdditionalTargets < 4) { if (Pawn(A) != None && Pawn(A).bCanFly || ONSVehicle(A) != None && ONSVehicle(A).FastVehicle()) { BestType = 1; // homing missiles } else if (DestroyableObjective(A) != None || DestroyableObjective(A.Owner) != None || Pawn(A) != None && (Pawn(A).GroundSpeed < 700 && A.CollisionRadius > 200 || Pawn(A).bStationary)) { BestType = 3; // napalm rockets } } } else log(Self@"firing without target"@A); if (ActiveWeapon < Weapons.Length && PersesRocketPack(Weapons[ActiveWeapon]) != None) PersesRocketPack(Weapons[ActiveWeapon]).ChangeProjectile(BestType); Super.ChooseFireAt(A); } function float BotDesireability(Actor S, int TeamIndex, Actor Objective) { local SquadAI Squad; Squad = SquadAI(S); if (Squad.GetOrders() == 'Defend') return 0; return super.BotDesireability(S,TeamIndex, Objective); } function AltFire(optional float F) { local PlayerController PC; PC = PlayerController(Controller); if (PC == None) return; bWeaponIsAltFiring = true; PC.ToggleZoom(); } function ClientVehicleCeaseFire(bool bWasAltFire) { local PlayerController PC; if (!bWasAltFire) { Super.ClientVehicleCeaseFire(bWasAltFire); return; } PC = PlayerController(Controller); if (PC == None) return; bWeaponIsAltFiring = false; PC.StopZoom(); } simulated function ClientKDriverLeave(PlayerController PC) { Super.ClientKDriverLeave(PC); bWeaponIsAltFiring = false; PC.EndZoom(); } function Vehicle FindEntryVehicle(Pawn P) { local Bot B; local int i; local Vehicle EntryVehicle; B = Bot(P.Controller); if (B == None || WeaponPawns.Length == 0 || !IsVehicleEmpty() && Driver == None) { EntryVehicle = Super.FindEntryVehicle(P); } else { i = Rand(WeaponPawns.Length); if (WeaponPawns[i].Driver == None) EntryVehicle = WeaponPawns[i]; else EntryVehicle = Super.FindEntryVehicle(P); } if (EntryVehicle == None && Driver != None) { // If a player is trying to drive and we're full of bots, kick out the bot driver so the player can drive if (PlayerController(P.Controller) != None && Bot(Controller) != None && Controller.SameTeamAs(P.Controller)) { KDriverLeave(true); return self; } } else return EntryVehicle; } function KDriverEnter(Pawn P) { Super.KDriverEnter(P); BotEnterTime = Level.TimeSeconds; } simulated event DestroyAppearance() { local int i; // For replication bDestroyAppearance = True; // Put brakes on Throttle = 0; Steering = 0; Rise = 0; // Destroy the weapons if (Role == ROLE_Authority) { for (i = 0; i < Weapons.Length; i++) { if (Weapons[i] != None) Weapons[i].Destroy(); } for(i = 0; i < WeaponPawns.Length; i++) WeaponPawns[i].Destroy(); } Weapons.Length = 0; WeaponPawns.Length = 0; // Destroy the effects if (Level.NetMode != NM_DedicatedServer) { bNoTeamBeacon = true; for (i = 0; i < HeadlightCorona.Length; i++) HeadlightCorona[i].Destroy(); HeadlightCorona.Length = 0; if (HeadlightProjector != None) HeadlightProjector.Destroy(); } // Become the dead vehicle mesh Skins = DestroyedSkins; RepSkin = Skins[0]; NetPriority = 2; } simulated event ClientVehicleExplosion(bool bFinal) { local int SoundNum; local Actor DestructionEffect; // Explosion effect if (ExplosionSounds.Length > 0) { SoundNum = Rand(ExplosionSounds.Length); PlaySound(ExplosionSounds[SoundNum], SLOT_None, ExplosionSoundVolume*TransientSoundVolume,, ExplosionSoundRadius); } if (bFinal) { if (Level.NetMode != NM_DedicatedServer) DestructionEffect = Spawn(DisintegrationEffectClass,,, Location, Rotation); GotoState('VehicleDisintegrated'); } } state VehicleDisintegrated { ignores Died; Begin: Sleep(0.75); Destroy(); } function ServerChangeDriverPosition(byte F) { if ((F == 0 || F > WeaponPawns.Length + 1) && ActiveWeapon < Weapons.Length && PersesRocketPack(Weapons[ActiveWeapon]) != None) PersesRocketPack(Weapons[ActiveWeapon]).ChangeProjectile(F - WeaponPawns.Length - 2); else Super.ServerChangeDriverPosition(F); } simulated function Tick(float DeltaTime) { Super.Tick(DeltaTime); if (Bot(Controller) != None) { if (Level.TimeSeconds - BotEnterTime < 1.0) { // wait for potential passengers Throttle = 0.0; Steering = 0.0; } else if (VSize(Velocity) < 10 && EngineRPM > 700 || Level.TimeSeconds - ThrottleFixTime < 1.5) { // bot got stuck somewhere and doesn't notice if (Level.TimeSeconds - ThrottleFixTime > 1.5) { ThrottleFixTime = Level.TimeSeconds; if (Gear == 0) FixedThrottle = 1.0; // stuck in reverse, try forward instead else FixedThrottle = -1.0; // stuck in forward, try reverse instead FixedSteering = -Steering * Rand(2); // randomly back up straight (in case bot managed to get stuck in narrow passage) } //if (Level.TimeSeconds - ThrottleFixTime < 1.0) // Steering = 0.0; // bots usually get stuck trying to turn, so backing up straight shouldn't break anything Throttle = FixedThrottle; Steering = FixedSteering; } // TODO: slow down to allow additional passengers to catch up } } simulated function DrawHud(Canvas C) { local Hud H; Super.DrawHud(C); H = C.Viewport.Actor.MyHud; if (H == None || H.bShowDebugInfo || H.bHideHud || H.bShowLocalStats || H.bShowScoreBoard || H.PlayerOwner == None || H.PawnOwner == None || H.PawnOwnerPRI == None || H.PlayerOwner.IsSpectating() && H.PlayerOwner.bBehindView) return; // don't draw weapon bar on spectator HUD if (ActiveWeapon < Weapons.Length && PersesRocketPack(Weapons[ActiveWeapon]) != None) PersesRocketPack(Weapons[ActiveWeapon]).DrawWeaponBar(C); } //============================================================================= // Default values //============================================================================= defaultproperties { Build = "%%%%-%%-%% %%:%%" VehiclePositionString="in a Perses" VehicleNameString="Perses MAS" VehicleDescription="Perses, the ancient Greek Titan god of destruction. And destruction is what the Perses Mobile Assault Station is all about." Mesh=Mesh'PersesChassis' HiddenBones = ("LeftFrontArm1","RightFrontArm1","LeftRearArm1","RightRearArm1") DriverWeapons(0) = (WeaponClass=class'PersesRocketPack',WeaponBone=RocketPackAttach) bHasAltFire = False bSeparateTurretFocus = True PassengerWeapons(0)=(WeaponPawnClass=class'PersesTankTurretPawn',WeaponBone=RightFrontGunAttach) PassengerWeapons(1)=(WeaponPawnClass=class'PersesTankTurretPawn',WeaponBone=LeftFrontGunAttach) PassengerWeapons(2)=(WeaponPawnClass=class'PersesArtilleryTurretPawn',WeaponBone=RightRearGunAttach) PassengerWeapons(3)=(WeaponPawnClass=class'PersesArtilleryTurretPawn',WeaponBone=LeftRearGunAttach) GunMountOffset=(X=32,Z=3) GunMountScale=1.4 GunnerTurretAttachOffsets(0)=(Z=2.5) GunnerTurretAttachOffsets(1)=(Z=2.5) GunnerTurretAttachOffsets(2)=(X=-2,Z=3) GunnerTurretAttachOffsets(3)=(X=-2,Z=3) DestroyedSkins = (Texture'ONSFullTextures.DeadTextures.MASdeadTEX') DestructionEffectClass=class'Onslaught.ONSVehicleExplosionEffect' DisintegrationEffectClass=class'PersesDeathExplosion' DestructionLinearMomentum=(Min=250000,Max=400000) DestructionAngularMomentum=(Min=100,Max=300) RedSkin=Shader'ONSFullTextures.MASGroup.MASRedShad' BlueSkin=Shader'ONSFullTextures.MASGroup.MASBlueShad' ShadowCullDistance=2000.0 Health=7000 HealthMax=7000 DisintegrationHealth=0 DriverDamageMult=0.0 MomentumMult=0.01 UpsideDownDamage=500.0 RanOverDamageType=class'DamTypePersesRoadkill' CrushedDamageType=class'DamTypePersesPancake' ExplosionDamage=250.0 ExplosionRadius=500.0 AirPitchDamping=45.0 FPCamPos=(X=-350,Y=0,Z=350) TPCamLookat=(X=-350,Y=0,Z=300) TPCamWorldOffset=(X=0,Y=0,Z=200) TPCamDistance=780 TPCamDistRange=(Min=0,Max=2500) bDrawDriverInTP=False bDrawMeshInFP=True bAllowBigWheels=True CollisionHeight=+60.0 CollisionRadius=+260.0 NavigationPointRange=+190.0 bSuperSize=true DrivePos=(X=16.921,Y=-40.284,Z=65.794) DriveRot=(Pitch=0) IdleSound=sound'ONSVehicleSounds-S.MAS.MASEng01' StartUpSound=sound'ONSVehicleSounds-S.MAS.MASStart01' ShutDownSound=sound'ONSVehicleSounds-S.MAS.MASStop01' EngineRPMSoundRange=8000 SoundRadius=255 SoundVolume=255 IdleRPM=1000 RevMeterScale=4000 StartUpForce="MASStartUp" ShutDownForce="MASShutDown" SteerBoneName="" SteerBoneAxis=AXIS_Z SteerBoneMaxAngle=90 EntryPosition=(X=0,Y=0,Z=0) EntryRadius=500.0 ExitPositions(0)=(X=0,Y=-365,Z=200) ExitPositions(1)=(X=0,Y=365,Z=200) ExitPositions(2)=(X=0,Y=-365,Z=-100) ExitPositions(3)=(X=0,Y=365,Z=-100) WheelPenScale=1.0 WheelPenOffset=0.01 WheelSoftness=0.04 WheelRestitution=0.1 WheelAdhesion=0.0 WheelLongFrictionFunc=(Points=((InVal=0,OutVal=0.0),(InVal=50.0,OutVal=1.0),(InVal=100.0,OutVal=0.9),(InVal=10000000000.0,OutVal=0.9))) WheelLongFrictionScale=0.9 WheelLatFrictionScale=1.5 WheelLongSlip=0.001 WheelLatSlipFunc=(Points=((InVal=0.0,OutVal=0.0),(InVal=30.0,OutVal=0.009),(InVal=45.0,OutVal=0.00),(InVal=10000000000.0,OutVal=0.00))) WheelHandbrakeSlip=0.01 WheelHandbrakeFriction=0.1 WheelSuspensionTravel=40.0 WheelSuspensionOffset=0.0 WheelSuspensionMaxRenderTravel=40.0 HandbrakeThresh=200 FTScale=0.01 ChassisTorqueScale=0.1 MinBrakeFriction=4.0 MaxBrakeTorque=20.0 MaxSteerAngleCurve=(Points=((InVal=0,OutVal=40.0),(InVal=700.0,OutVal=20.0),(InVal=1000000000.0,OutVal=10.0))) SteerSpeed=110 StopThreshold=100 TorqueCurve=(Points=((InVal=0,OutVal=36.0),(InVal=200,OutVal=5.0),(InVal=1500,OutVal=6.0),(InVal=2500,OutVal=0.0))) EngineBrakeFactor=0.002 EngineBrakeRPMScale=0.1 EngineInertia=0.5 WheelInertia=0.01 TransRatio=0.11 // TransRatio=0.01 GearRatios[0]=-0.2 GearRatios[1]=0.2 NumForwardGears=1 ChangeUpPoint=2000 ChangeDownPoint=1000 LSDFactor=1.0 // VehicleMass=25.0 VehicleMass=12.0 HeadlightCoronaOffset(0)=(X=365,Y=-87,Z=130) HeadlightCoronaMaterial=Material'EpicParticles.flashflare1' HeadlightCoronaMaxSize=120 DamagedEffectOffset=(X=300,Y=0,Z=185) DamagedEffectScale=2.5 Begin Object Class=KarmaParamsRBFull Name=KParams0 KStartEnabled=True KFriction=0.5 KLinearDamping=0.05 KAngularDamping=0.05 KImpactThreshold=500 bKNonSphericalInertia=True bHighDetailOnly=False bClientOnly=False bKDoubleTickRate=True KInertiaTensor(0)=1.260000 KInertiaTensor(1)=0 KInertiaTensor(2)=0 KInertiaTensor(3)=3.099998 KInertiaTensor(4)=0 KInertiaTensor(5)=4.499996 KMaxSpeed=650.0 KCOMOffset=(X=0,Y=0,Z=0) bDestroyOnWorldPenetrate=True bDoSafetime=True End Object KParams=KarmaParams'KParams0' Begin Object Class=SVehicleWheel Name=RightRearTIRE BoneName="RightRearTire" BoneRollAxis=AXIS_Y BoneSteerAxis=AXIS_Z BoneOffset=(X=0.0,Y=0.0,Z=0.0) WheelRadius=99 bPoweredWheel=True SteerType=VST_Fixed // SupportBoneName="RightRearStrut" End Object Wheels(0)=SVehicleWheel'RightRearTIRE' Begin Object Class=SVehicleWheel Name=LeftRearTIRE BoneName="LeftRearTire" BoneRollAxis=AXIS_Y BoneSteerAxis=AXIS_Z BoneOffset=(X=0.0,Y=0.0,Z=0.0) WheelRadius=99 bPoweredWheel=True SteerType=VST_Fixed // SupportBoneName="LeftRearStrut" End Object Wheels(1)=SVehicleWheel'LeftRearTIRE' Begin Object Class=SVehicleWheel Name=RightFrontTIRE BoneName="RightFrontTire" BoneRollAxis=AXIS_Y BoneSteerAxis=AXIS_Z BoneOffset=(X=0.0,Y=0.0,Z=0.0) WheelRadius=99 bPoweredWheel=True SteerType=VST_Steered // SupportBoneName="RightFrontStrut" End Object Wheels(2)=SVehicleWheel'RightFrontTIRE' Begin Object Class=SVehicleWheel Name=LeftFrontTIRE BoneName="LeftFrontTire" BoneRollAxis=AXIS_Y BoneSteerAxis=AXIS_Z BoneOffset=(X=0.0,Y=0.0,Z=0.0) WheelRadius=99 bPoweredWheel=True SteerType=VST_Steered // SupportBoneName="LeftFrontStrut" End Object Wheels(3)=SVehicleWheel'LeftFrontTIRE' bDriverHoldsFlag=false FlagBone=LeftFrontGunAttach bKeyVehicle=true bNeverReset=true bEnableProximityViewShake=true bOnlyViewShakeIfDriven=true ViewShakeRadius=1000.0 ViewShakeOffsetMag=(X=0.7,Y=0.0,Z=2.7) ViewShakeOffsetFreq=7.0 HornSounds(0)=sound'ONSVehicleSounds-S.LevHorn01' HornSounds(1)=sound'ONSVehicleSounds-S.LevHorn02' MaxDesireability=2.0 ObjectiveGetOutDist=3000.0 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |