Advertisement
Guest User

Resurgence Razik

a guest
Jun 25th, 2014
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Razik
  3. // TO DO: get impact marks for hitting level geometry with melee, fix online problems
  4. //=============================================================================
  5. class Razik extends TournamentWeapon;
  6.  
  7. var Pickup Amp;
  8. var() float Range;
  9. var() sound HitSound, DownSound;
  10. var Playerpawn LastHit;
  11. var() byte ClawDamage, HeavyClawDamage;
  12. var travel int PowerLevel;
  13. var() bool bBodyCinematic, bStabCinematic;
  14. var() sound ClawSounds[3];
  15. var() sound ClawHitSounds[2];
  16. var() sound PowerUpSound;
  17. var() sound GrowlSound;
  18. var() name ClawAnims[12];
  19. var int LastAnim;
  20.  
  21. function float RateSelf( out int bUseAltMode )
  22. {
  23.     local float rating;
  24.  
  25.     if ( Amp != None )
  26.         rating = 6 * AIRating;
  27.     else
  28.         rating = AIRating;
  29.  
  30.     if ( AmmoType.AmmoAmount <=0 )
  31.         return 0.05;
  32.     if ( Pawn(Owner).Enemy == None )
  33.     {
  34.         bUseAltMode = 0;
  35.         return rating * (PowerLevel + 1);
  36.     }
  37.  
  38.     bUseAltMode = int( FRand() < 0.3 );
  39.     return rating * (PowerLevel + 1);
  40. }
  41.  
  42. function float SuggestAttackStyle()
  43. {
  44.     if ( !Pawn(Owner).bIsPlayer || (PowerLevel > 0) )
  45.         return 0;
  46.  
  47.     return -0.3;
  48. }
  49.  
  50. function BecomePickup()
  51. {
  52.     Amp = None;
  53.     Super.BecomePickup();
  54. }
  55.  
  56.  
  57.  
  58. function setHand(float Hand)
  59. {
  60.     if ( Hand == 2 )
  61.     {
  62.         PlayerViewOffset.Y = 0;
  63.         FireOffset.Y = 0;
  64.         bHideWeapon = true;
  65.         return;
  66.     }
  67.     else
  68.         bHideWeapon = false;
  69.  
  70.  
  71.     PlayerViewOffset.X = Default.PlayerViewOffset.X;
  72.     PlayerViewOffset.Y = Default.PlayerViewOffset.Y;
  73.     PlayerViewOffset.Z = Default.PlayerViewOffset.Z;
  74.    
  75.     PlayerViewOffset *= 100; //scale since network passes vector components as ints
  76.     FireOffset.Y = Default.FireOffset.Y;
  77. }
  78.  
  79. function inventory SpawnCopy( pawn Other )
  80. {
  81.     local inventory Copy;
  82.     local Inventory I;
  83.  
  84.     Copy = Super.SpawnCopy(Other);
  85.     I = Other.FindInventoryType(class'Amplifier');
  86.     if ( Amplifier(I) != None )
  87.         Razik(Copy).Amp = Amplifier(I);
  88.  
  89.     return Copy;
  90. }
  91.  
  92. function bool HandlePickupQuery( inventory Item )
  93. {
  94.     if ( Item.IsA('RazikPowerup') )
  95.     {
  96.         AmmoType.AddAmmo(AmmoType.MaxAmmo);
  97.         Pawn(Owner).ClientMessage(Item.PickupMessage, 'Pickup');
  98.         Item.PlaySound (PickupSound);
  99.         if ( PowerLevel<4 )
  100.         {
  101.             ShakeVert = Default.ShakeVert + PowerLevel;
  102.             PowerUpSound = Item.ActivateSound;
  103.             if ( Pawn(Owner).Weapon == self )
  104.             {
  105.                 PowerLevel++;
  106.                 GotoState('PowerUp');
  107.             }
  108.             else if ( (Pawn(Owner).Weapon != Self) && !Pawn(Owner).bNeverSwitchOnPickup )
  109.             {
  110.                 Pawn(Owner).Weapon.PutDown();
  111.                 Pawn(Owner).PendingWeapon = self;
  112.                 GotoState('PowerUp', 'Waiting');
  113.             }
  114.             else
  115.             {
  116.                 PowerLevel++;
  117.                 AmmoType.MaxAmmo += 10;
  118.                 AmmoType.AddAmmo(10);
  119.             }
  120.  
  121.         }
  122.         Item.SetRespawn();
  123.         return true;
  124.     }
  125.     else
  126.         return Super.HandlePickupQuery(Item);
  127. }
  128.  
  129. simulated function PlayFiringTest()
  130. {
  131.    
  132.    
  133.  
  134.     Owner.PlaySound(FireSound, SLOT_None,2.0*Pawn(Owner).SoundDampening);
  135.     if ( (AnimSequence == 'FireLoop') || (AnimSequence == 'FireStart') )       
  136.         PlayAnim( 'FireLoop');
  137.     else
  138.         PlayAnim( 'FireStart' );
  139.    
  140. }
  141.  
  142. function PlayFiring()
  143. {
  144.     Owner.PlaySound(FireSound, SLOT_None,2.0*Pawn(Owner).SoundDampening);
  145.     PlayAnim('Fire',1.0,0.1);
  146. }
  147.  
  148.  
  149. function Projectile ProjectileFire(class<projectile> ProjClass, float ProjSpeed, bool bWarn)
  150. {
  151.     local Vector Start, X,Y,Z;
  152.     local RazikProjectile rp;
  153.     local float Mult;
  154.  
  155.     Owner.MakeNoise(Pawn(Owner).SoundDampening);
  156.  
  157.     if (Amp!=None) Mult = Amp.UseCharge(80);
  158.     else Mult=1.0;
  159.  
  160.     GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
  161.     Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
  162.     AdjustedAim = pawn(owner).AdjustAim(ProjSpeed, Start, AimError, True, (3.5*FRand()-1<PowerLevel));
  163.     if ( (PowerLevel == 0) || (AmmoType.AmmoAmount < 10) )
  164.     {
  165.        
  166.         rp = RazikProjectile(Spawn(ProjClass,,, Start,AdjustedAim));
  167.         if ( (AmmoType.AmmoAmount < 1) && Level.Game.bDeathMatch )
  168.             AmmoType.AmmoAmount = 1;
  169.     }
  170.     else
  171.     {
  172.         if ( (PowerLevel==1) && AmmoType.UseAmmo(1) )
  173.             rp = Spawn(class'RazikProjectileA',,, Start,AdjustedAim);
  174.         if ( (PowerLevel==2) && AmmoType.UseAmmo(1) )
  175.             rp = Spawn(class'RazikProjectileB',,, Start,AdjustedAim);
  176.         if ( (PowerLevel==3) && AmmoType.UseAmmo(1) )
  177.             rp = Spawn(class'RazikProjectileC',,, Start ,AdjustedAim);
  178.         if ( (PowerLevel>=4) && AmmoType.UseAmmo(1) )
  179.             rp = Spawn(class'RazikProjectileD',,, Start,AdjustedAim);
  180.     }
  181.     if ( (rp != None) && (Mult>1.0) )
  182.         rp.InitSplash(Mult);
  183.     Return rp;
  184. }
  185.  
  186. function PlayAltFiring()
  187. {
  188.     local int randclaw;
  189.  
  190.     do
  191.         randclaw = Rand(12);
  192.     until (randclaw != lastanim);
  193.    
  194.     PlayAnim(ClawAnims[randclaw],1.0,0.1);
  195.  
  196.     //log("Randclaw is "$randclaw);
  197.     LastAnim = randclaw;
  198.     //log("LastAnim is "$LastAnim);
  199. }
  200.  
  201.  
  202.  
  203.  
  204. function Slash()
  205. {
  206.     local vector HitLocation, HitNormal, EndTrace, X, Y, Z, Start;
  207.     local actor Other;
  208.  
  209.     Owner.MakeNoise(Pawn(Owner).SoundDampening);
  210.     GetAxes(Pawn(owner).ViewRotation, X, Y, Z);
  211.     Start =  Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;
  212.     AdjustedAim = pawn(owner).AdjustAim(1000000, Start, AimError, False, False);   
  213.     EndTrace = Owner.Location + (Range * vector(AdjustedAim));
  214.     Other = Pawn(Owner).TraceShot(HitLocation, HitNormal, EndTrace, Start);
  215.  
  216.     if (PowerLevel==1)
  217.         ClawDamage = 25;
  218.     else if (PowerLevel==2)
  219.         ClawDamage = 28;
  220.     else if (PowerLevel==3)
  221.         ClawDamage = 30;
  222.     else if (PowerLevel==4)
  223.         ClawDamage = 32;
  224.  
  225.     if ( (Other == None) || (Other == Owner) || (Other == self) )
  226.         return;
  227.  
  228.     if ( PlayerPawn(Owner) != None )
  229.         PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
  230.     Other.TakeDamage(ClawDamage, Pawn(Owner), HitLocation, -10000.0 * Y, AltDamageType);
  231.     if ( Other == Level || (!Other.bIsPawn && !Other.IsA('Carcass')) )
  232.         PlaySound(ClawHitSounds[0], SLOT_Interact);
  233.     else
  234.     {
  235.         PlaySound(ClawHitSounds[1], SLOT_Interact);
  236.         spawn(class'SawHit',,,HitLocation+HitNormal, rotator(HitNormal));
  237.     }
  238. }
  239.  
  240. function PlaySlashSound()
  241. {
  242.     local int randsound;
  243.  
  244.     randsound = Rand(3);
  245.     PlaySound(ClawSounds[randsound], SLOT_None,2.0*Pawn(Owner).SoundDampening);
  246. }
  247.  
  248. function PlaySlashSoundDouble()
  249. {
  250.     local int randsound;
  251.  
  252.     randsound = Rand(3);
  253.     PlaySound(ClawSounds[randsound], SLOT_None,2.0*Pawn(Owner).SoundDampening);
  254.     PlaySound(ClawSounds[randsound], SLOT_None,2.0*Pawn(Owner).SoundDampening);
  255. }
  256.  
  257. function TraceFire(float accuracy)
  258. {
  259.     local vector HitLocation, HitNormal, EndTrace, X, Y, Z, Start;
  260.     local actor Other;
  261.  
  262.     LastHit = None;
  263.     Owner.MakeNoise(Pawn(Owner).SoundDampening);
  264.     GetAxes(Pawn(owner).ViewRotation, X, Y, Z);
  265.     Start =  Owner.Location + CalcDrawOffset() + FireOffset.Y * Y + FireOffset.Z * Z;
  266.     AdjustedAim = pawn(owner).AdjustAim(1000000, Start, 2 * AimError, False, False);   
  267.     EndTrace = Owner.Location + (10 + Range) * vector(AdjustedAim);
  268.     Other = Pawn(Owner).TraceShot(HitLocation, HitNormal, EndTrace, Start);
  269.  
  270.     if ( (Other == None) || (Other == Owner) || (Other == self) )
  271.         return;
  272.  
  273.     Other.TakeDamage(20.0, Pawn(Owner), HitLocation, -15000 * X, MyDamageType);
  274.     //if ( !Other.bIsPawn && !Other.IsA('Carcass') )
  275.     //  spawn(class'SawHit',,,HitLocation+HitNormal, Rotator(HitNormal));
  276.        
  277.     /*else*/ if ( Other.IsA('PlayerPawn') && (Pawn(Other).Health > 0) )
  278.         LastHit = PlayerPawn(Other);
  279. }
  280.  
  281. function Fire( float Value )
  282. {
  283.     if ( AmmoType == None )
  284.     {
  285.         // ammocheck
  286.         GiveAmmo(Pawn(Owner));
  287.     }
  288.     if (AmmoType.UseAmmo(2))
  289.     {
  290.         GotoState('NormalFire');
  291.         if ( PlayerPawn(Owner) != None )
  292.         {
  293.             //PlayerPawn(Owner).ClientInstantFlash( -0.4, vect(0, 0, 800));
  294.             PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
  295.         }
  296.         if ( FiringSpeed>0 )
  297.             Pawn(Owner).PlayRecoil(FiringSpeed);
  298.         bPointing=True;
  299.         PlayFiring();
  300.         if ( Owner.bHidden )
  301.             CheckVisibility();
  302.     }
  303.  
  304.  
  305. }
  306.  
  307. function AltFire( float Value )
  308. {
  309.  
  310.     GotoState('AltFiring');
  311.     if ( PlayerPawn(Owner) != None )
  312.         PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
  313.     bPointing=True;
  314.     PlayAltFiring();
  315.     if ( !bRapidFire && (FiringSpeed > 0) )
  316.         Pawn(Owner).PlayRecoil(FiringSpeed);
  317.     if ( Owner.bHidden )
  318.         CheckVisibility();
  319.  
  320. }
  321.  
  322. simulated function TweenDown()
  323. {
  324.     PlayClawDownSound();
  325.     Super.TweenDown();
  326. }
  327.  
  328. function PlayClawDownSound()
  329. {
  330.     Owner.PlaySound(DownSound, SLOT_Misc, Pawn(Owner).SoundDampening);
  331. }
  332.  
  333. function PlayClawSelectSound()
  334. {
  335.     Owner.PlaySound(SelectSound, SLOT_Misc, Pawn(Owner).SoundDampening);
  336. }
  337.  
  338. function PlayGrowlSound()
  339. {
  340.     Owner.PlaySound(GrowlSound, SLOT_Misc, Pawn(Owner).SoundDampening);
  341. }
  342. ///////////////////////////////////////////////////////
  343.  
  344. state NormalFire
  345. {
  346.  
  347.     ignores Fire, AltFire;
  348.  
  349.  
  350.     function EndState()
  351.     {
  352.         FireOffset.X=Default.FireOffset.X;
  353.         FireOffset.Y=Default.FireOffset.Y;
  354.         FireOffset.Z=Default.FireOffset.Z;
  355.         Super.EndState();
  356.     }  
  357.  
  358. Begin:
  359.  
  360.  
  361.     Sleep(0.35);
  362.     ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
  363.     FireOffset.Y=-20.0000;
  364.     ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
  365.     FireOffset.Y=Default.FireOffset.Y;
  366.     PlayerPawn(Owner).ClientInstantFlash( -0.4, vect(0, 0, 800));
  367.  
  368.     FinishAnim();
  369.     Finish();
  370.    
  371.     GotoState('Idle');
  372.  
  373. }
  374.  
  375. state AltFiring
  376. {
  377.  
  378.     ignores Fire, AltFire;
  379.  
  380.     function EndState()
  381.     {
  382.         FireOffset.X=Default.FireOffset.X;
  383.         FireOffset.Y=Default.FireOffset.Y;
  384.         FireOffset.Z=Default.FireOffset.Z;
  385.         Super.EndState();
  386.     }
  387.  
  388. Begin:
  389.     FireOffset.X=0.0;
  390.     FireOffset.Y=0.0;
  391.    
  392.  
  393.    
  394.     FinishAnim();
  395.     //FireOffset.X=Default.FireOffset.X;
  396.     //FireOffset.Y=Default.FireOffset.Y;
  397.     GotoState('Idle');
  398. }
  399.  
  400.  
  401.  
  402. state Idle
  403. {
  404.     function AnimEnd()
  405.     {
  406.         PlayIdleAnim();
  407.     }
  408.  
  409.     function bool PutDown()
  410.     {
  411.         GotoState('DownWeapon');
  412.         return True;
  413.     }
  414.  
  415.     function Timer()
  416.     {
  417.        
  418.         if (FRand()>0.65) PlayAnim('Twiddle');
  419.         else if (AnimSequence == 'Twiddle') LoopAnim('Sway',0.02, 0.3);
  420.     }
  421.  
  422. Begin:
  423.     bPointing=False;
  424.     LoopAnim('Sway',0.02, 0.1);
  425.     SetTimer(1.5,True);
  426.     if ( /*bFireMem ||*/ Pawn(Owner).bFire!=0 ) Global.Fire(0.0);
  427.     if ( /*bAltFireMem ||*/ Pawn(Owner).bAltFire!=0 ) Global.AltFire(0.0);
  428. }
  429.  
  430. state PowerUp
  431. {
  432.     ignores fire, altfire;
  433.  
  434.     function BringUp()
  435.     {
  436.         bWeaponUp = false;
  437.         PlaySelect();
  438.         GotoState('Powerup', 'Raising');
  439.     }
  440.  
  441.     function bool PutDown()
  442.     {
  443.         bChangeWeapon = true;
  444.         return True;
  445.     }
  446.  
  447.     function BeginState()
  448.     {
  449.         bChangeWeapon = false;
  450.     }
  451.  
  452. Raising:
  453.     FinishAnim();
  454.     PowerLevel++;
  455. Begin:
  456.     if (PowerLevel<5)
  457.     {
  458.         AmmoType.MaxAmmo += 20;
  459.         AmmoType.AddAmmo(20);
  460.         if ( PowerLevel < 5 )
  461.         {
  462.             Owner.PlaySound(PowerUpSound, SLOT_None, Pawn(Owner).SoundDampening);
  463.             PlayAnim('PowerUp');
  464.         }
  465.  
  466.         if (PowerLevel==1)
  467.             ClawDamage = 25;
  468.         else if (PowerLevel==2)
  469.             ClawDamage = 28;
  470.         else if (PowerLevel==3)
  471.             ClawDamage = 30;
  472.         else if (PowerLevel==4)
  473.             ClawDamage = 32;
  474.  
  475.         FinishAnim();
  476.         if ( bChangeWeapon )
  477.             GotoState('DownWeapon');
  478.         Finish();
  479.     }
  480. Waiting:
  481. }
  482.  
  483.  
  484. defaultproperties
  485. {
  486.      range=70.000000
  487.      DownSound=Sound'SkCampMeshes.Razik.blade1r'
  488.      ClawDamage=20
  489.      AmmoName=Class'SkCampClasses.SCDefaultAmmo'
  490.      PickupAmmoCount=100
  491.      bAltInstantHit=True
  492.      bWarnTarget=True
  493.      bCanThrow=False
  494.      FiringSpeed=10.000000
  495.      FireOffset=(X=20.000000,Y=20.000000,Z=-15.000000)
  496.      ProjectileClass=Class'SkCampClasses.RazikProjectile'
  497.      MyDamageType="Jolted"
  498.      AltDamageType="Hacked"
  499.      shakemag=200.000000
  500.      shaketime=0.130000
  501.      shakevert=2.000000
  502.      RefireRate=0.990000
  503.      AltRefireRate=1.000000
  504.      FireSound=None
  505.      AltFireSound=Sound'UnrealShare.Skaarj.claw2s'
  506.      SelectSound=Sound'UnrealShare.Skaarj.blade1s'
  507.      Misc1Sound=Sound'UnrealShare.Dispersion.PowerUp3'
  508.      DeathMessage="%o was gutted by %k's raziks."
  509.      PickupMessage="You got the Raziks"
  510.      ItemName="Raziks"
  511.      PlayerViewOffset=(X=0.75000,Y=0.000000,Z=-2.000000)//x=1
  512.      PlayerViewMesh=SkeletalMesh'SkCampMeshes.Razik1stMesh'
  513.      Mesh=SkeletalMesh'SkCampMeshes.Razik1stMesh'
  514.      PickupViewMesh=SkeletalMesh'SkCampMeshes.RazikPickMesh'
  515.      ThirdPersonMesh=SkeletalMesh'SkCampMeshes.Razik3rdMesh'
  516.      PickupSound=Sound'UnrealShare.Pickups.WeaponPickup'
  517.      Texture=None
  518.      Mesh=SkeletalMesh'SkCampMeshes.RazikPickMesh'
  519.      bNoSmooth=False
  520.      CollisionRadius=28.000000
  521.      CollisionHeight=8.000000
  522.      Mass=15.000000
  523.      ClawAnims(0)=Claw1
  524.      ClawAnims(1)=Claw2
  525.      ClawAnims(2)=Claw3
  526.      ClawAnims(3)=Claw4
  527.      ClawAnims(4)=Claw5
  528.      ClawAnims(5)=Claw6
  529.      ClawAnims(6)=Claw7
  530.      ClawAnims(7)=Claw8
  531.      ClawAnims(8)=Claw9
  532.      ClawAnims(9)=Claw10
  533.      ClawAnims(10)=Claw11
  534.      ClawAnims(11)=Claw12
  535.      ClawSounds(0)=Sound'SkCampMeshes.Razik.Slash1'
  536.      ClawSounds(1)=Sound'SkCampMeshes.Razik.Slash2'
  537.      ClawSounds(2)=Sound'SkCampMeshes.Razik.Slash3'
  538.      ClawHitSounds(0)=Sound'SkCampMeshes.Razik.ClawHit1'
  539.      ClawHitSounds(1)=Sound'SkCampMeshes.Razik.ClawHit2'
  540.      GrowlSound=Sound'UnrealShare.Skaarj.roam11s'
  541.      LastAnim=9
  542. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement