Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Razik
- // TO DO: get impact marks for hitting level geometry with melee, fix online problems
- //=============================================================================
- class Razik extends TournamentWeapon;
- var Pickup Amp;
- var() float Range;
- var() sound HitSound, DownSound;
- var Playerpawn LastHit;
- var() byte ClawDamage, HeavyClawDamage;
- var travel int PowerLevel;
- var() bool bBodyCinematic, bStabCinematic;
- var() sound ClawSounds[3];
- var() sound ClawHitSounds[2];
- var() sound PowerUpSound;
- var() sound GrowlSound;
- var() name ClawAnims[12];
- var int LastAnim;
- function float RateSelf( out int bUseAltMode )
- {
- local float rating;
- if ( Amp != None )
- rating = 6 * AIRating;
- else
- rating = AIRating;
- if ( AmmoType.AmmoAmount <=0 )
- return 0.05;
- if ( Pawn(Owner).Enemy == None )
- {
- bUseAltMode = 0;
- return rating * (PowerLevel + 1);
- }
- bUseAltMode = int( FRand() < 0.3 );
- return rating * (PowerLevel + 1);
- }
- function float SuggestAttackStyle()
- {
- if ( !Pawn(Owner).bIsPlayer || (PowerLevel > 0) )
- return 0;
- return -0.3;
- }
- function BecomePickup()
- {
- Amp = None;
- Super.BecomePickup();
- }
- function setHand(float Hand)
- {
- if ( Hand == 2 )
- {
- PlayerViewOffset.Y = 0;
- FireOffset.Y = 0;
- bHideWeapon = true;
- return;
- }
- else
- bHideWeapon = false;
- PlayerViewOffset.X = Default.PlayerViewOffset.X;
- PlayerViewOffset.Y = Default.PlayerViewOffset.Y;
- PlayerViewOffset.Z = Default.PlayerViewOffset.Z;
- PlayerViewOffset *= 100; //scale since network passes vector components as ints
- FireOffset.Y = Default.FireOffset.Y;
- }
- function inventory SpawnCopy( pawn Other )
- {
- local inventory Copy;
- local Inventory I;
- Copy = Super.SpawnCopy(Other);
- I = Other.FindInventoryType(class'Amplifier');
- if ( Amplifier(I) != None )
- Razik(Copy).Amp = Amplifier(I);
- return Copy;
- }
- function bool HandlePickupQuery( inventory Item )
- {
- if ( Item.IsA('RazikPowerup') )
- {
- AmmoType.AddAmmo(AmmoType.MaxAmmo);
- Pawn(Owner).ClientMessage(Item.PickupMessage, 'Pickup');
- Item.PlaySound (PickupSound);
- if ( PowerLevel<4 )
- {
- ShakeVert = Default.ShakeVert + PowerLevel;
- PowerUpSound = Item.ActivateSound;
- if ( Pawn(Owner).Weapon == self )
- {
- PowerLevel++;
- GotoState('PowerUp');
- }
- else if ( (Pawn(Owner).Weapon != Self) && !Pawn(Owner).bNeverSwitchOnPickup )
- {
- Pawn(Owner).Weapon.PutDown();
- Pawn(Owner).PendingWeapon = self;
- GotoState('PowerUp', 'Waiting');
- }
- else
- {
- PowerLevel++;
- AmmoType.MaxAmmo += 10;
- AmmoType.AddAmmo(10);
- }
- }
- Item.SetRespawn();
- return true;
- }
- else
- return Super.HandlePickupQuery(Item);
- }
- simulated function PlayFiringTest()
- {
- Owner.PlaySound(FireSound, SLOT_None,2.0*Pawn(Owner).SoundDampening);
- if ( (AnimSequence == 'FireLoop') || (AnimSequence == 'FireStart') )
- PlayAnim( 'FireLoop');
- else
- PlayAnim( 'FireStart' );
- }
- function PlayFiring()
- {
- Owner.PlaySound(FireSound, SLOT_None,2.0*Pawn(Owner).SoundDampening);
- PlayAnim('Fire',1.0,0.1);
- }
- function Projectile ProjectileFire(class<projectile> ProjClass, float ProjSpeed, bool bWarn)
- {
- local Vector Start, X,Y,Z;
- local RazikProjectile rp;
- local float Mult;
- Owner.MakeNoise(Pawn(Owner).SoundDampening);
- if (Amp!=None) Mult = Amp.UseCharge(80);
- else Mult=1.0;
- GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
- Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
- AdjustedAim = pawn(owner).AdjustAim(ProjSpeed, Start, AimError, True, (3.5*FRand()-1<PowerLevel));
- if ( (PowerLevel == 0) || (AmmoType.AmmoAmount < 10) )
- {
- rp = RazikProjectile(Spawn(ProjClass,,, Start,AdjustedAim));
- if ( (AmmoType.AmmoAmount < 1) && Level.Game.bDeathMatch )
- AmmoType.AmmoAmount = 1;
- }
- else
- {
- if ( (PowerLevel==1) && AmmoType.UseAmmo(1) )
- rp = Spawn(class'RazikProjectileA',,, Start,AdjustedAim);
- if ( (PowerLevel==2) && AmmoType.UseAmmo(1) )
- rp = Spawn(class'RazikProjectileB',,, Start,AdjustedAim);
- if ( (PowerLevel==3) && AmmoType.UseAmmo(1) )
- rp = Spawn(class'RazikProjectileC',,, Start ,AdjustedAim);
- if ( (PowerLevel>=4) && AmmoType.UseAmmo(1) )
- rp = Spawn(class'RazikProjectileD',,, Start,AdjustedAim);
- }
- if ( (rp != None) && (Mult>1.0) )
- rp.InitSplash(Mult);
- Return rp;
- }
- function PlayAltFiring()
- {
- local int randclaw;
- do
- randclaw = Rand(12);
- until (randclaw != lastanim);
- PlayAnim(ClawAnims[randclaw],1.0,0.1);
- //log("Randclaw is "$randclaw);
- LastAnim = randclaw;
- //log("LastAnim is "$LastAnim);
- }
- function Slash()
- {
- local vector HitLocation, HitNormal, EndTrace, X, Y, Z, Start;
- local actor Other;
- Owner.MakeNoise(Pawn(Owner).SoundDampening);
- GetAxes(Pawn(owner).ViewRotation, X, Y, Z);
- Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
- AdjustedAim = pawn(owner).AdjustAim(1000000, Start, AimError, False, False);
- EndTrace = Owner.Location + (Range * vector(AdjustedAim));
- Other = Pawn(Owner).TraceShot(HitLocation, HitNormal, EndTrace, Start);
- if (PowerLevel==1)
- ClawDamage = 25;
- else if (PowerLevel==2)
- ClawDamage = 28;
- else if (PowerLevel==3)
- ClawDamage = 30;
- else if (PowerLevel==4)
- ClawDamage = 32;
- if ( (Other == None) || (Other == Owner) || (Other == self) )
- return;
- if ( PlayerPawn(Owner) != None )
- PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
- Other.TakeDamage(ClawDamage, Pawn(Owner), HitLocation, -10000.0 * Y, AltDamageType);
- if ( Other == Level || (!Other.bIsPawn && !Other.IsA('Carcass')) )
- PlaySound(ClawHitSounds[0], SLOT_Interact);
- else
- {
- PlaySound(ClawHitSounds[1], SLOT_Interact);
- spawn(class'SawHit',,,HitLocation+HitNormal, rotator(HitNormal));
- }
- }
- function PlaySlashSound()
- {
- local int randsound;
- randsound = Rand(3);
- PlaySound(ClawSounds[randsound], SLOT_None,2.0*Pawn(Owner).SoundDampening);
- }
- function PlaySlashSoundDouble()
- {
- local int randsound;
- randsound = Rand(3);
- PlaySound(ClawSounds[randsound], SLOT_None,2.0*Pawn(Owner).SoundDampening);
- PlaySound(ClawSounds[randsound], SLOT_None,2.0*Pawn(Owner).SoundDampening);
- }
- function TraceFire(float accuracy)
- {
- local vector HitLocation, HitNormal, EndTrace, X, Y, Z, Start;
- local actor Other;
- LastHit = None;
- Owner.MakeNoise(Pawn(Owner).SoundDampening);
- GetAxes(Pawn(owner).ViewRotation, X, Y, Z);
- Start = Owner.Location + CalcDrawOffset() + FireOffset.Y * Y + FireOffset.Z * Z;
- AdjustedAim = pawn(owner).AdjustAim(1000000, Start, 2 * AimError, False, False);
- EndTrace = Owner.Location + (10 + Range) * vector(AdjustedAim);
- Other = Pawn(Owner).TraceShot(HitLocation, HitNormal, EndTrace, Start);
- if ( (Other == None) || (Other == Owner) || (Other == self) )
- return;
- Other.TakeDamage(20.0, Pawn(Owner), HitLocation, -15000 * X, MyDamageType);
- //if ( !Other.bIsPawn && !Other.IsA('Carcass') )
- // spawn(class'SawHit',,,HitLocation+HitNormal, Rotator(HitNormal));
- /*else*/ if ( Other.IsA('PlayerPawn') && (Pawn(Other).Health > 0) )
- LastHit = PlayerPawn(Other);
- }
- function Fire( float Value )
- {
- if ( AmmoType == None )
- {
- // ammocheck
- GiveAmmo(Pawn(Owner));
- }
- if (AmmoType.UseAmmo(2))
- {
- GotoState('NormalFire');
- if ( PlayerPawn(Owner) != None )
- {
- //PlayerPawn(Owner).ClientInstantFlash( -0.4, vect(0, 0, 800));
- PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
- }
- if ( FiringSpeed>0 )
- Pawn(Owner).PlayRecoil(FiringSpeed);
- bPointing=True;
- PlayFiring();
- if ( Owner.bHidden )
- CheckVisibility();
- }
- }
- function AltFire( float Value )
- {
- GotoState('AltFiring');
- if ( PlayerPawn(Owner) != None )
- PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
- bPointing=True;
- PlayAltFiring();
- if ( !bRapidFire && (FiringSpeed > 0) )
- Pawn(Owner).PlayRecoil(FiringSpeed);
- if ( Owner.bHidden )
- CheckVisibility();
- }
- simulated function TweenDown()
- {
- PlayClawDownSound();
- Super.TweenDown();
- }
- function PlayClawDownSound()
- {
- Owner.PlaySound(DownSound, SLOT_Misc, Pawn(Owner).SoundDampening);
- }
- function PlayClawSelectSound()
- {
- Owner.PlaySound(SelectSound, SLOT_Misc, Pawn(Owner).SoundDampening);
- }
- function PlayGrowlSound()
- {
- Owner.PlaySound(GrowlSound, SLOT_Misc, Pawn(Owner).SoundDampening);
- }
- ///////////////////////////////////////////////////////
- state NormalFire
- {
- ignores Fire, AltFire;
- function EndState()
- {
- FireOffset.X=Default.FireOffset.X;
- FireOffset.Y=Default.FireOffset.Y;
- FireOffset.Z=Default.FireOffset.Z;
- Super.EndState();
- }
- Begin:
- Sleep(0.35);
- ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
- FireOffset.Y=-20.0000;
- ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
- FireOffset.Y=Default.FireOffset.Y;
- PlayerPawn(Owner).ClientInstantFlash( -0.4, vect(0, 0, 800));
- FinishAnim();
- Finish();
- GotoState('Idle');
- }
- state AltFiring
- {
- ignores Fire, AltFire;
- function EndState()
- {
- FireOffset.X=Default.FireOffset.X;
- FireOffset.Y=Default.FireOffset.Y;
- FireOffset.Z=Default.FireOffset.Z;
- Super.EndState();
- }
- Begin:
- FireOffset.X=0.0;
- FireOffset.Y=0.0;
- FinishAnim();
- //FireOffset.X=Default.FireOffset.X;
- //FireOffset.Y=Default.FireOffset.Y;
- GotoState('Idle');
- }
- state Idle
- {
- function AnimEnd()
- {
- PlayIdleAnim();
- }
- function bool PutDown()
- {
- GotoState('DownWeapon');
- return True;
- }
- function Timer()
- {
- if (FRand()>0.65) PlayAnim('Twiddle');
- else if (AnimSequence == 'Twiddle') LoopAnim('Sway',0.02, 0.3);
- }
- Begin:
- bPointing=False;
- LoopAnim('Sway',0.02, 0.1);
- SetTimer(1.5,True);
- if ( /*bFireMem ||*/ Pawn(Owner).bFire!=0 ) Global.Fire(0.0);
- if ( /*bAltFireMem ||*/ Pawn(Owner).bAltFire!=0 ) Global.AltFire(0.0);
- }
- state PowerUp
- {
- ignores fire, altfire;
- function BringUp()
- {
- bWeaponUp = false;
- PlaySelect();
- GotoState('Powerup', 'Raising');
- }
- function bool PutDown()
- {
- bChangeWeapon = true;
- return True;
- }
- function BeginState()
- {
- bChangeWeapon = false;
- }
- Raising:
- FinishAnim();
- PowerLevel++;
- Begin:
- if (PowerLevel<5)
- {
- AmmoType.MaxAmmo += 20;
- AmmoType.AddAmmo(20);
- if ( PowerLevel < 5 )
- {
- Owner.PlaySound(PowerUpSound, SLOT_None, Pawn(Owner).SoundDampening);
- PlayAnim('PowerUp');
- }
- if (PowerLevel==1)
- ClawDamage = 25;
- else if (PowerLevel==2)
- ClawDamage = 28;
- else if (PowerLevel==3)
- ClawDamage = 30;
- else if (PowerLevel==4)
- ClawDamage = 32;
- FinishAnim();
- if ( bChangeWeapon )
- GotoState('DownWeapon');
- Finish();
- }
- Waiting:
- }
- defaultproperties
- {
- range=70.000000
- DownSound=Sound'SkCampMeshes.Razik.blade1r'
- ClawDamage=20
- AmmoName=Class'SkCampClasses.SCDefaultAmmo'
- PickupAmmoCount=100
- bAltInstantHit=True
- bWarnTarget=True
- bCanThrow=False
- FiringSpeed=10.000000
- FireOffset=(X=20.000000,Y=20.000000,Z=-15.000000)
- ProjectileClass=Class'SkCampClasses.RazikProjectile'
- MyDamageType="Jolted"
- AltDamageType="Hacked"
- shakemag=200.000000
- shaketime=0.130000
- shakevert=2.000000
- RefireRate=0.990000
- AltRefireRate=1.000000
- FireSound=None
- AltFireSound=Sound'UnrealShare.Skaarj.claw2s'
- SelectSound=Sound'UnrealShare.Skaarj.blade1s'
- Misc1Sound=Sound'UnrealShare.Dispersion.PowerUp3'
- DeathMessage="%o was gutted by %k's raziks."
- PickupMessage="You got the Raziks"
- ItemName="Raziks"
- PlayerViewOffset=(X=0.75000,Y=0.000000,Z=-2.000000)//x=1
- PlayerViewMesh=SkeletalMesh'SkCampMeshes.Razik1stMesh'
- Mesh=SkeletalMesh'SkCampMeshes.Razik1stMesh'
- PickupViewMesh=SkeletalMesh'SkCampMeshes.RazikPickMesh'
- ThirdPersonMesh=SkeletalMesh'SkCampMeshes.Razik3rdMesh'
- PickupSound=Sound'UnrealShare.Pickups.WeaponPickup'
- Texture=None
- Mesh=SkeletalMesh'SkCampMeshes.RazikPickMesh'
- bNoSmooth=False
- CollisionRadius=28.000000
- CollisionHeight=8.000000
- Mass=15.000000
- ClawAnims(0)=Claw1
- ClawAnims(1)=Claw2
- ClawAnims(2)=Claw3
- ClawAnims(3)=Claw4
- ClawAnims(4)=Claw5
- ClawAnims(5)=Claw6
- ClawAnims(6)=Claw7
- ClawAnims(7)=Claw8
- ClawAnims(8)=Claw9
- ClawAnims(9)=Claw10
- ClawAnims(10)=Claw11
- ClawAnims(11)=Claw12
- ClawSounds(0)=Sound'SkCampMeshes.Razik.Slash1'
- ClawSounds(1)=Sound'SkCampMeshes.Razik.Slash2'
- ClawSounds(2)=Sound'SkCampMeshes.Razik.Slash3'
- ClawHitSounds(0)=Sound'SkCampMeshes.Razik.ClawHit1'
- ClawHitSounds(1)=Sound'SkCampMeshes.Razik.ClawHit2'
- GrowlSound=Sound'UnrealShare.Skaarj.roam11s'
- LastAnim=9
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement