inkoalawetrust

UAC Mech ZScript

Dec 31st, 2020 (edited)
1,414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.45 KB | None | 0 0
  1. Class UACMech : Actor
  2. {
  3.     Default
  4.     {
  5.         //$Category Monsters
  6.         //$Title UAC-93 Combat Mech
  7.         Health 3500;
  8.         Radius 40;
  9.         Height 110;
  10.         Mass 4000;
  11.         Speed 24;
  12.         MaxTargetRange 8192;
  13.         SeeSound "mech/see";
  14.         ActiveSound "mech/active";
  15.         DropItem "ClipBox"; DropItem "ClipBox"; DropItem "ClipBox";
  16.         Obituary "%o was mowed down by the UAC Mech";
  17.         Monster;
  18.         +NoBlood;
  19.         +Boss;
  20.         +FloorClip;
  21.         +MissileMore;
  22.         +Telestomp;
  23.         +NoPain;
  24.         +AvoidMelee;
  25.     }
  26.     int bulletsfired;
  27.     override void Tick()
  28.     {
  29.         Super.Tick();
  30.         if (health <= 1200)
  31.         {
  32.             //If at 1200 health, turn the frightened flag on to back away more from enemies.
  33.             bFrightened = True;
  34.             //Increase the chance of attacking to account for above flag technically making the mech scared
  35.             MinMissileChance = 50;
  36.             bMissileEvenMore = True;
  37.         }
  38.         if (health >= 1200)
  39.         {
  40.             //If at more than 1200 health, turn the frightened flag off. This is in case something heals the mech.
  41.             bFrightened = False;
  42.             //Reset the chance of attacking to the default
  43.             MinMissileChance = 200;
  44.             bMissileEvenMore = False;
  45.         }
  46.     }
  47.     States
  48.     {
  49.         Spawn:
  50.             UACB G 8 A_LookEx (maxseedist:8192,4096);
  51.             Loop;
  52.         See:
  53.             UACB ABCDEF 4 A_Chase (null,"DecideAttack");
  54.             TNT1 A 0 A_StartSound ("spider/walk",CHAN_AUTO);
  55.             Loop;
  56.         DecideAttack:
  57.             TNT1 A 0
  58.             {
  59.                 if (Distance3D (target) > 1024) //If too far, fire the chaingun
  60.                 {
  61.                     SetStateLabel ("ChaingunFire",False);
  62.                 }
  63.                 if (Distance3D (target) < 1024) //If close enough, deploy grenades
  64.                 {
  65.                     SetStateLabel ("LaunchGrenades",False);
  66.                 }
  67.             }
  68.             Goto See;
  69.         LaunchGrenades:
  70.             TNT1 A 0 A_Jump (96,"ChaingunFire"); //May just gun you down instead.
  71.             UACB G 6
  72.             {//I'd add the A_Jump here, but it doesn't seem to work in anonymous functions
  73.                 if (target.pos.z - GetZAt() >= 128) //Will definitely mow you down if you are too high.
  74.                 {
  75.                     SetStateLabel ("ChaingunFire",False);
  76.                 }
  77.             }
  78.             UACB H 3 A_StartSound ("mech/deploy",CHAN_AUTO);
  79.             UACB IJ 3 A_FaceTarget();
  80.             //First grenade
  81.             UACB K 6 Bright
  82.             {
  83.                 A_StartSound ("gren",CHAN_AUTO);
  84.                 A_SpawnProjectile ("MechGrenade",106);
  85.             }
  86.             UACB J 6 A_FaceTarget();
  87.             //Second grenade
  88.             UACB K 6 Bright
  89.             {
  90.                 A_StartSound ("gren",CHAN_AUTO);
  91.                 A_SpawnProjectile ("MechGrenade",106);
  92.             }
  93.             UACB J 6 A_FaceTarget();
  94.             //Third grenade
  95.             UACB K 6 Bright
  96.             {
  97.                 A_StartSound ("gren",CHAN_AUTO);
  98.                 A_SpawnProjectile ("MechGrenade",106);
  99.             }
  100.             UACB J 0 A_StartSound ("mech/deploy",CHAN_AUTO);
  101.             UACB JIG 3;
  102.             Goto See;
  103.         ChainGunFire:
  104.             TNT1 A 0 //Checks if 40 or more bullets have been fired before stopping.
  105.             {
  106.                 if (bulletsfired > 40)
  107.                 {
  108.                     bulletsfired = 0;
  109.                     SetStateLabel ("See",False);
  110.                 }
  111.                 Return;
  112.             }
  113.             UACB G 1
  114.             {
  115.                 A_FaceTarget();
  116.             }
  117.             UACB H 1 Bright
  118.             {
  119.                 A_CustomBulletAttack (3.0,3.0,2,3,range:8192*2);
  120.                 A_StartSound ("weapons/chngun",CHAN_AUTO);
  121.                 A_MonsterRefire (128,"AbortAttack");
  122.             }
  123.             UACB G 1
  124.             {
  125.                 bulletsfired++;
  126.             }
  127.             Loop;
  128.         AbortAttack:
  129.             TNT1 A 0
  130.             {
  131.                 bulletsfired = 0;
  132.             }
  133.             Goto See;
  134.         Death:
  135.             UACD K 4 Bright
  136.             {
  137.                 A_NoBlocking();
  138.                 A_StartSound ("mech/explode",50,CHANF_OVERLAP,attenuation:0.7);
  139.                 A_Explode (32,96);
  140.             }
  141.             UACD LMNOPQRS 4;
  142.             UACD T 4 Bright
  143.             {
  144.                 A_StartSound ("mech/explode",50,attenuation:0.7);
  145.                 A_Explode (32,96);
  146.             }
  147.             UACD UVW 4 ;
  148.             UACD XYZAB 4;
  149.             UACD C -1;
  150.             Stop;
  151.     }
  152. }
  153.  
Add Comment
Please, Sign In to add comment