//============================================================================= // SchlonzSuperEightBall. //============================================================================= class SchlonzSuperEightBall expands UT_Eightball; var() enum SuperEightBallModes { SEBS_Serie, SEBS_Faecher, SEBS_Bueschel } SuperEightBallMode; var bool ModeChanged; var int altFireCounter; var bool AltFired; var() float SeriePeriod; var Actor ShotTarget[5]; var int ShotTargetCnt; /////////////////////////////////////////////////////// function changeSuperEightBallMode() { if( SuperEightBallMode == SEBS_Serie ) { SuperEightBallMode = SEBS_Faecher; } else if( SuperEightBallMode == SEBS_Faecher ) { SuperEightBallMode = SEBS_Bueschel; } else { SuperEightBallMode = SEBS_Serie; } //Finish(); GotoState('SuperEightBallModeChanged'); } function spawnRocket( Vector FireLocation, Rotator AdjustedAim ) { local rocketmk2 r; local SchlonzSuperSeekingRocket s; if( LockedTarget != None ) { s = Spawn( class 'SchlonzSuperSeekingRocket',, '', FireLocation, AdjustedAim ); s.Seeking = LockedTarget; r = s; } else { r = Spawn( class'rocketmk2',, '', FireLocation, AdjustedAim ); if( RocketsLoaded > 4 && bTightWad ) r.bRing=True; } r.NumExtraRockets = 2000; // amount of smoke: higher value = less smoke r.Velocity *= (0.9 + 0.2 * FRand()); r.Damage *= 3; r.MomentumTransfer *= 3; } function Fire( float Value ) { if( (AmmoType == None) && (AmmoName != None) ) { // ammocheck GiveAmmo(Pawn(Owner)); } if( SuperEightBallMode == SEBS_Serie ) { ShotTargetCnt = 0; GotoState('FiringSerie'); } else { AltFired = false; GotoState('PreFire'); } /* if ( AmmoType.UseAmmo(1) ) { GotoState('NormalFire'); bPointing=True; bCanClientFire = true; ClientFire(Value); if ( bRapidFire || (FiringSpeed > 0) ) Pawn(Owner).PlayRecoil(FiringSpeed); if ( bInstantHit ) TraceFire(0.0); else ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget); } */ } function AltFire( float Value ) { if ( (AmmoType == None) && (AmmoName != None) ) { // ammocheck GiveAmmo(Pawn(Owner)); } if( SuperEightBallMode == SEBS_Serie ) { GotoState('AltFiringSerie'); } else { AltFired = true; GotoState('PreFire'); } } /////////////////////////////////////////////////////// state Idle { Begin: ModeChanged = false; if( altFireCounter < 0 || altFireCounter >= 10 ) altFireCounter = 0; if (Pawn(Owner).bFire!=0) Fire(0.0); if (Pawn(Owner).bAltFire!=0) AltFire(0.0); bPointing=False; if (AmmoType.AmmoAmount<=0) Pawn(Owner).SwitchToBestWeapon(); //Goto Weapon that has Ammo PlayIdleAnim(); OldTarget = CheckTarget(); if( Owner.IsA('PlayerPawn') ) { // lock faster :-] SetTimer( 0.1, True ); } else { SetTimer( 1.25, True ); // til locked } LockedTarget = None; bLockedOn = False; PendingLock: if ( bPendingLock ) bPointing = true; if ( TimerRate <= 0 ) SetTimer(1.0, true); } /////////////////////////////////////////////////////// state PreFire { function Tick( float DeltaTime ) { local pawn PawnOwner; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; if( PawnOwner.bFire==0 && PawnOwner.bAltFire==0 ) { RocketsLoaded++; AmmoType.UseAmmo(1); GotoState('FireRockets'); } if( PawnOwner.bFire!=0 && PawnOwner.bAltFire!=0 ) { changeSuperEightBallMode(); } } function Timer() { local pawn PawnOwner; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; if( PawnOwner.bFire!=0 && PawnOwner.bAltFire!=0 ) { changeSuperEightBallMode(); } else { GotoState('FireLoading'); } } Begin: SetTimer( 0.1, False ); RocketsLoaded = 0; } /////////////////////////////////////////////////////// state FireLoading { function Tick( float DeltaTime ) { local pawn PawnOwner; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; if( PawnOwner.bFire==0 && PawnOwner.bAltFire==0 ) { RocketsLoaded++; AmmoType.UseAmmo(1); GotoState('FireRockets'); } /* if( PawnOwner.bFire!=0 && PawnOwner.bAltFire!=0 ) { changeSuperEightBallMode(); } */ } function AnimEnd() { if ( bRotated ) { bRotated = false; PlayLoading(1.1, RocketsLoaded); } else { if ( RocketsLoaded == 6 ) { GotoState('FireRockets'); return; } RocketsLoaded++; AmmoType.UseAmmo(1); if ( (PlayerPawn(Owner) == None) && ((FRand() > 0.5) || (Pawn(Owner).Enemy == None)) ) Pawn(Owner).bAltFire = 0; bPointing = true; Owner.MakeNoise(0.6 * Pawn(Owner).SoundDampening); RotateRocket(); } } function RotateRocket() { if (AmmoType.AmmoAmount<=0) { GotoState('FireRockets'); return; } PlayRotating(RocketsLoaded-1); bRotated = true; } function BeginState() { Super.BeginState(); RocketsLoaded = 1; bFireLoad = False; RotateRocket(); } } /////////////////////////////////////////////////////// state FireRockets { function BeginState() { local pawn PawnOwner; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; if( SuperEightBallMode == SEBS_Faecher ) { if( AltFired == true ) { ChleuderFaecher( PawnOwner ); } else { FireFaecher( PawnOwner ); } } else { if( AltFired == true ) { ChleuderBueschel( PawnOwner ); } else { FireBueschel( PawnOwner ); } } } function FireFaecher( Pawn PawnOwner ) { local vector FireLocation, StartLoc, X,Y,Z; local rotator FireRot, RandRot; local rocketmk2 r; local SchlonzSuperSeekingRocket s; local ut_grenade g; local float Angle, RocketRad, RocketAngle; local pawn BestTarget; local PlayerPawn PlayerOwner; local bool bMultiRockets; PawnOwner.PlayRecoil(FiringSpeed); PlayerOwner = PlayerPawn(Owner); if ( PlayerOwner == None ) bTightWad = ( FRand() * 4 < PawnOwner.skill ); GetAxes(PawnOwner.ViewRotation,X,Y,Z); StartLoc = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; if ( bFireLoad ) AdjustedAim = PawnOwner.AdjustAim(ProjectileSpeed, StartLoc, AimError, True, bWarnTarget); else AdjustedAim = PawnOwner.AdjustToss(AltProjectileSpeed, StartLoc, AimError, True, bAltWarnTarget); if ( PlayerOwner != None ) AdjustedAim = PawnOwner.ViewRotation; PlayRFiring(RocketsLoaded-1); Owner.MakeNoise(PawnOwner.SoundDampening); /* if ( !bFireLoad ) { LockedTarget = None; bLockedOn = false; } else if ( LockedTarget != None ) */ if ( LockedTarget != None ) { BestTarget = Pawn(CheckTarget()); if ( (LockedTarget!=None) && (LockedTarget != BestTarget) ) { LockedTarget = None; bLockedOn=False; } } else BestTarget = None; bPendingLock = false; bPointing = true; FireRot = AdjustedAim; RocketRad = 4; if (bTightWad || !bFireLoad) RocketRad=7; bMultiRockets = ( RocketsLoaded > 1 ); // gimme more rockets :-] RocketsLoaded *= 10; // correct the angle //RocketAngle = 1.0484 RocketAngle = 0.010484 * (100-RocketsLoaded); Angle = -RocketAngle * (RocketsLoaded / 2); While ( RocketsLoaded > 0 ) { if ( bMultiRockets ) Firelocation = StartLoc - (Sin(Angle)*RocketRad - 7.5)*Y + (Cos(Angle)*RocketRad - 7)*Z - X * 4 * FRand(); else FireLocation = StartLoc; FireRot.Yaw = AdjustedAim.Yaw + Angle * 500; spawnRocket( FireLocation, FireRot ); Angle += RocketAngle; RocketsLoaded--; } bTightWad=False; bRotated = false; } function ChleuderFaecher( Pawn PawnOwner ) { local vector FireLocation, StartLoc, X,Y,Z; local rotator FireRot, RandRot; local rocketmk2 r; local SchlonzSuperSeekingRocket s; local ut_grenade g; local float Angle, RocketRad, RocketAngle; local pawn BestTarget; local PlayerPawn PlayerOwner; local bool bMultiRockets; PawnOwner.PlayRecoil(FiringSpeed); PlayerOwner = PlayerPawn(Owner); if ( PlayerOwner == None ) bTightWad = ( FRand() * 4 < PawnOwner.skill ); GetAxes(PawnOwner.ViewRotation,X,Y,Z); StartLoc = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; if ( bFireLoad ) AdjustedAim = PawnOwner.AdjustAim(ProjectileSpeed, StartLoc, AimError, True, bWarnTarget); else AdjustedAim = PawnOwner.AdjustToss(AltProjectileSpeed, StartLoc, AimError, True, bAltWarnTarget); if ( PlayerOwner != None ) AdjustedAim = PawnOwner.ViewRotation; PlayRFiring(RocketsLoaded-1); Owner.MakeNoise(PawnOwner.SoundDampening); if ( !bFireLoad ) { LockedTarget = None; bLockedOn = false; } else if ( LockedTarget != None ) { BestTarget = Pawn(CheckTarget()); if ( (LockedTarget!=None) && (LockedTarget != BestTarget) ) { LockedTarget = None; bLockedOn=False; } } else BestTarget = None; bPendingLock = false; bPointing = true; FireRot = AdjustedAim; RocketRad = 4; if (bTightWad || !bFireLoad) RocketRad=7; bMultiRockets = ( RocketsLoaded > 1 ); // gimme more rockets :-] RocketsLoaded *= 10; // correct the angle //RocketAngle = 1.0484 RocketAngle = 0.010484 * (100-RocketsLoaded); Angle = -RocketAngle * (RocketsLoaded / 2); While ( RocketsLoaded > 0 ) { if ( bMultiRockets ) Firelocation = StartLoc - (Sin(Angle)*RocketRad - 7.5)*Y + (Cos(Angle)*RocketRad - 7)*Z - X * 4 * FRand(); else FireLocation = StartLoc; FireRot.Yaw = AdjustedAim.Yaw + Angle * 500; g = Spawn( class 'ut_Grenade',, '', FireLocation,FireRot); //g.NumExtraGrenades = DupRockets; RandRot.Pitch = FRand() * 1500 - 750; RandRot.Yaw = FRand() * 1500 - 750; RandRot.Roll = FRand() * 1500 - 750; g.Velocity = g.Velocity >> RandRot; //Angle += 1.0484; //2*3.1415/6; Angle += RocketAngle; RocketsLoaded--; } bTightWad=False; bRotated = false; } function FireBueschel( Pawn PawnOwner ) { local vector FireLocation, StartLoc, X,Y,Z; local rotator FireRot, RandRot; local rocketmk2 r; local SchlonzSuperSeekingRocket s; local ut_grenade g; local float Angle, RocketRad, RocketAngle, BueschelRadius; local pawn BestTarget; local PlayerPawn PlayerOwner; local bool bMultiRockets; local int bueschelMult; PawnOwner.PlayRecoil(FiringSpeed); PlayerOwner = PlayerPawn(Owner); if ( PlayerOwner == None ) bTightWad = ( FRand() * 4 < PawnOwner.skill ); GetAxes(PawnOwner.ViewRotation,X,Y,Z); StartLoc = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; if ( bFireLoad ) AdjustedAim = PawnOwner.AdjustAim(ProjectileSpeed, StartLoc, AimError, True, bWarnTarget); else AdjustedAim = PawnOwner.AdjustToss(AltProjectileSpeed, StartLoc, AimError, True, bAltWarnTarget); if ( PlayerOwner != None ) AdjustedAim = PawnOwner.ViewRotation; PlayRFiring(RocketsLoaded-1); Owner.MakeNoise(PawnOwner.SoundDampening); /* if( !bFireLoad ) { LockedTarget = None; bLockedOn = false; } else if( LockedTarget != None ) */ if( LockedTarget != None ) { BestTarget = Pawn(CheckTarget()); if( (LockedTarget!=None) && (LockedTarget != BestTarget) ) { LockedTarget = None; bLockedOn=False; } } else BestTarget = None; bPendingLock = false; bPointing = true; FireRot = AdjustedAim; RocketRad = 4; if (bTightWad || !bFireLoad) RocketRad=7; bMultiRockets = ( RocketsLoaded > 1 ); // gimme more rockets :-] RocketsLoaded *= 10; // correct the angle //RocketAngle = 1.0484 RocketAngle = 0.010484 * (100-RocketsLoaded); Angle = -RocketAngle * (RocketsLoaded / 2); bueschelMult = RocketsLoaded * 60 + 1500; BueschelRadius = Sqrt(RocketsLoaded+4) / 30.0; While ( RocketsLoaded > 0 ) { if ( bMultiRockets ) Firelocation = StartLoc - (Sin(Angle)*RocketRad - 7.5)*Y + (Cos(Angle)*RocketRad - 7)*Z - X * 4 * FRand(); else FireLocation = StartLoc; RandRot = Rotator( Normal(Vector(AdjustedAim)) + BueschelRadius * VRand() ); spawnRocket( FireLocation, RandRot ); Angle += RocketAngle; RocketsLoaded--; } bTightWad=False; bRotated = false; } function ChleuderBueschel( Pawn PawnOwner ) { local vector FireLocation, StartLoc, X,Y,Z; local rotator FireRot, RandRot; local rocketmk2 r; local SchlonzSuperSeekingRocket s; local ut_grenade g; local float Angle, RocketRad, RocketAngle; local pawn BestTarget; local PlayerPawn PlayerOwner; local bool bMultiRockets; PawnOwner.PlayRecoil(FiringSpeed); PlayerOwner = PlayerPawn(Owner); if ( PlayerOwner == None ) bTightWad = ( FRand() * 4 < PawnOwner.skill ); GetAxes(PawnOwner.ViewRotation,X,Y,Z); StartLoc = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; if ( bFireLoad ) AdjustedAim = PawnOwner.AdjustAim(ProjectileSpeed, StartLoc, AimError, True, bWarnTarget); else AdjustedAim = PawnOwner.AdjustToss(AltProjectileSpeed, StartLoc, AimError, True, bAltWarnTarget); if ( PlayerOwner != None ) AdjustedAim = PawnOwner.ViewRotation; PlayRFiring(RocketsLoaded-1); Owner.MakeNoise(PawnOwner.SoundDampening); bPendingLock = false; bPointing = true; FireRot = AdjustedAim; RocketRad = 4; if (bTightWad || !bFireLoad) RocketRad=7; bMultiRockets = ( RocketsLoaded > 1 ); // gimme more rockets :-] RocketsLoaded *= 10; // correct the angle //RocketAngle = 1.0484 RocketAngle = 0.010484 * (100-RocketsLoaded); Angle = -RocketAngle * (RocketsLoaded / 2); While ( RocketsLoaded > 0 ) { if ( bMultiRockets ) Firelocation = StartLoc - (Sin(Angle)*RocketRad - 7.5)*Y + (Cos(Angle)*RocketRad - 7)*Z - X * 4 * FRand(); else FireLocation = StartLoc; FireRot.Yaw = AdjustedAim.Yaw + Angle * 500; g = Spawn( class 'ut_Grenade',, '', FireLocation,AdjustedAim); //g.NumExtraGrenades = DupRockets; RandRot.Pitch = FRand() * 2000 - 1000; RandRot.Yaw = FRand() * 2000 - 1000; RandRot.Roll = FRand() * 2000 - 1000; g.Velocity = g.Velocity >> RandRot; Angle += RocketAngle; RocketsLoaded--; } bTightWad=False; bRotated = false; } } /////////////////////////////////////////////////////// state NormalFire { function bool SplashJump() { return true; } function Tick( float DeltaTime ) { if ( (PlayerPawn(Owner) == None) && ((Pawn(Owner).MoveTarget != Pawn(Owner).Target) || (LockedTarget != None) || (Pawn(Owner).Enemy == None) || ( Mover(Owner.Base) != None ) || ((Owner.Physics == PHYS_Falling) && (Owner.Velocity.Z < 5)) || (VSize(Owner.Location - Pawn(Owner).Target.Location) < 400) || !Pawn(Owner).CheckFutureSight(0.15)) ) Pawn(Owner).bFire = 0; if( pawn(Owner).bFire==0 || RocketsLoaded > 5) // If Fire button down, load up another GoToState('FireRockets'); } function AnimEnd() { if ( bRotated ) { bRotated = false; PlayLoading(1.1, RocketsLoaded); } else { if ( RocketsLoaded == 6 ) { GotoState('FireRockets'); return; } RocketsLoaded++; AmmoType.UseAmmo(1); if (pawn(Owner).bAltFire!=0) bTightWad=True; NewTarget = CheckTarget(); if ( Pawn(NewTarget) != None ) Pawn(NewTarget).WarnTarget(Pawn(Owner), ProjectileSpeed, vector(Pawn(Owner).ViewRotation)); if ( LockedTarget != None ) { If ( NewTarget != LockedTarget ) { LockedTarget = None; Owner.PlaySound(Misc2Sound, SLOT_None, Pawn(Owner).SoundDampening); bLockedOn=False; } else if (LockedTarget != None) Owner.PlaySound(Misc1Sound, SLOT_None, Pawn(Owner).SoundDampening); } bPointing = true; Owner.MakeNoise(0.6 * Pawn(Owner).SoundDampening); RotateRocket(); } } function BeginState() { if( SuperEightBallMode == SEBS_Faecher ) { GotoState('FiringSerie'); } else { Super.BeginState(); } } function RotateRocket() { if ( PlayerPawn(Owner) == None ) { if ( FRand() > 0.33 ) Pawn(Owner).bFire = 0; if ( Pawn(Owner).bFire == 0 ) { GoToState('FireRockets'); return; } } if ( AmmoType.AmmoAmount <= 0 ) { GotoState('FireRockets'); return; } if ( AmmoType.AmmoAmount == 1 ) Owner.PlaySound(Misc2Sound, SLOT_None, Pawn(Owner).SoundDampening); PlayRotating(RocketsLoaded-1); bRotated = true; } Begin: Sleep(0.0); } /////////////////////////////////////////////////////// state AltFiring { function Tick( float DeltaTime ) { local ut_grenade g; local vector FireLocation, X,Y,Z; local pawn PawnOwner; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; /* if( PawnOwner.bAltFire==0 ) { //GotoState( 'Idle' ); Finish(); return; } */ if( PawnOwner.bFire!=0 && PawnOwner.bAltFire!=0 ) { changeSuperEightBallMode(); return; } if( (pawn(Owner).bAltFire==0) || (RocketsLoaded > 5) ) { // If if Fire button down, load up another GoToState('FireRockets'); } } function AnimEnd() { if ( bRotated ) { bRotated = false; PlayLoading(1.1, RocketsLoaded); } else { if ( RocketsLoaded == 6 ) { GotoState('FireRockets'); return; } RocketsLoaded++; AmmoType.UseAmmo(1); if ( (PlayerPawn(Owner) == None) && ((FRand() > 0.5) || (Pawn(Owner).Enemy == None)) ) Pawn(Owner).bAltFire = 0; bPointing = true; Owner.MakeNoise(0.6 * Pawn(Owner).SoundDampening); RotateRocket(); } } function RotateRocket() { if (AmmoType.AmmoAmount<=0) { GotoState('FireRockets'); return; } PlayRotating(RocketsLoaded-1); bRotated = true; } function BeginState() { if( SuperEightBallMode == SEBS_Faecher ) { GotoState('AltFiringSerie'); } else { Super.BeginState(); } } Begin: bLockedOn = False; } /////////////////////////////////////////////////////// state FiringSerie { function Timer() { local rocketmk2 r; local SchlonzSuperSeekingRocket s; local vector FireLocation, X,Y,Z; local pawn PawnOwner; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; if( PawnOwner.bFire==0 ) { //GotoState( 'Idle' ); Finish(); return; } if( PawnOwner.bFire!=0 && PawnOwner.bAltFire!=0 ) { changeSuperEightBallMode(); return; } if( AmmoType.AmmoAmount > 0 ) { if( altFireCounter >= 10 ) { AmmoType.UseAmmo(1); altFireCounter = 0; } else { altFireCounter++; } // +++++++++++++++++++++++++++++++++++++++ GetAxes(PawnOwner.ViewRotation,X,Y,Z); FireLocation = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; AdjustedAim = PawnOwner.AdjustToss(AltProjectileSpeed, FireLocation, AimError, True, bAltWarnTarget); spawnRocket( FireLocation, AdjustedAim ); pickNextTarget( FireLocation, AdjustedAim ); } else { //GotoState( 'Idle' ); Finish(); } } function addShotTarget() { if( ShotTargetCnt < 5 ) { ShotTarget[ShotTargetCnt] = LockedTarget; ShotTargetCnt++; } else { ShotTarget[0] = ShotTarget[1]; ShotTarget[1] = ShotTarget[2]; ShotTarget[2] = ShotTarget[3]; ShotTarget[3] = ShotTarget[4]; ShotTarget[4] = LockedTarget; } } function pickNextTarget( vector FireLocation, rotator FireAim ) { local float detectionRadius; local pawn PawnOwner; local Pawn p; local int i; local vector FireDirection; local float cosine; local float targetCosine; local pawn targetPawn; detectionRadius = 10000.0; PawnOwner = Pawn(Owner); FireDirection = Normal( vector( FireAim ) ); targetPawn = None; targetCosine = 0.9; foreach VisibleActors( class 'Pawn', p, detectionRadius ) { if( p != PawnOwner && p.Health > 0 && ( !Level.Game.bTeamGame || p.PlayerReplicationInfo == None || Instigator.PlayerReplicationInfo.Team != p.PlayerReplicationInfo.Team ) ) { cosine = FireDirection Dot Normal( p.Location - FireLocation ); if( cosine > targetCosine ) { for( i=0; i 0 ) { if( altFireCounter >= 10 ) { AmmoType.UseAmmo(1); altFireCounter = 0; } else { altFireCounter++; } GetAxes(PawnOwner.ViewRotation,X,Y,Z); FireLocation = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; AdjustedAim = PawnOwner.AdjustToss(AltProjectileSpeed, FireLocation, AimError, True, bAltWarnTarget); g = Spawn( class 'ut_grenade',, '', FireLocation,AdjustedAim); g.NumExtraGrenades = 0; } else { //GotoState( 'Idle' ); Finish(); } } function AnimEnd() { } function RotateRocket() { } function BeginState() { SetTimer( SeriePeriod, true ); } simulated function EndState() { ClientRocketsLoaded = 0; bClientDone = false; bRotated = false; bForceFire = false; bForceAltFire = false; SetTimer( 0.1, false ); } Begin: bLockedOn = False; } /////////////////////////////////////////////////////// state SuperEightBallModeChanged { function Tick( float DeltaTime ) { local ut_grenade g; local vector FireLocation, X,Y,Z; local pawn PawnOwner; PawnOwner = Pawn(Owner); if ( PawnOwner == None ) return; if( PawnOwner.bFire==0 && PawnOwner.bAltFire==0 ) { Finish(); } } } defaultproperties { SeriePeriod=0.150000 NameColor=(R=0,G=255,B=64) }