Advertisement
Chronos_Ouroboros

Cyann3 zscript

May 13th, 2019
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. class OlympiaMag : Ammo { // This ammo will be used as the magazine
  2. default {
  3. // This is just for example; if you use an image here, the amount of this ammo will be visible in the HUD
  4. Inventory.Icon "SHOTA0";
  5. Inventory.Amount 1;
  6. Inventory.MaxAmount 2;
  7. Ammo.BackpackAmount 0;
  8. Ammo.BackpackMaxAmount 8;
  9. }
  10. }
  11.  
  12. class Olympia : Weapon {
  13. default {
  14. Inventory.PickupMessage "Picked up a Rottweil Skeet Olympia";
  15. Weapon.AmmoType "OlympiaMag";
  16. Weapon.AmmoUse 1;
  17. // The weapon shouldn't refill the magazine when it's picked up, hence this is 0
  18. Weapon.AmmoGive 0;
  19. // This is the reserve ammo; in this case this is regular Doom Shell
  20. Weapon.AmmoType2 "Shell";
  21. Weapon.AmmoGive2 16;
  22. Inventory.Pickupsound "weapons/olympia/pickup";
  23. // See here: https://zdoom.org/wiki/Actor_properties#Obituaries
  24. Obituary "%o was blasted apart by %k's Olympia";
  25.  
  26. // Without this flag the weapon will be automatically deselected when we run out of magazine ammo, so we need this
  27. +WEAPON.AMMO_OPTIONAL
  28. }
  29.  
  30. states {
  31. Spawn:
  32. SHOT A -1;
  33. Stop;
  34.  
  35. Ready:
  36. // Without this flag you won't be able to reload at all
  37. OLYM A 1 A_WeaponReady (WRF_ALLOWRELOAD);
  38. Loop;
  39.  
  40. Select:
  41. OLYM A 1 A_Raise;
  42. Loop;
  43. Deselect:
  44. OLYM A 1 A_Lower;
  45. Loop;
  46.  
  47. Fire:
  48. TNT1 A 0 A_JumpIfNoAmmo ("Reload"); // There's a special function that checks primary ammo and performs the jump
  49. OLYM B 1 A_FireBullets (1, 1, 10, 6, "BulletPuff", FBF_USEAMMO);
  50. OLYM B 1 Offset ( 4, 40); // It might be better to use https://zdoom.org/wiki/A_WeaponOffset, but this will work for now
  51. OLYM B 3 Offset (12, 48);
  52. OLYM B 1 Offset (10, 44);
  53. OLYM B 1 Offset ( 8, 40);
  54. OLYM B 1 Offset ( 6, 37);
  55. OLYM A 1 Offset ( 4, 35);
  56. OLYM A 1 Offset ( 2, 33);
  57. OLYM A 15;
  58. Goto Ready;
  59.  
  60. // This is activated by the player pressing Reload button
  61. Reload:
  62. // This starts an anonymous function — a little block where several things can happen at once
  63. TNT1 A 0 {
  64. // Check if we already have full magazine (OlympiaMag == 2) OR (||) if we don't have any Shell (Shell < 1)
  65. if (CountInv ("OlympiaMag") == 2 || CountInv ("Shell") < 1)
  66. return ResolveState ("Ready"); // If ANY of the above is true — go back to Ready state and don't try to reload
  67.  
  68. return ResolveState (null); // OTHERWISE continue
  69. }
  70. OLYM A 1 Offset (0, 35) A_PlaySound ("weapons/shotgr", 5); // You don't really need A_PlayWeaponSound, you can use a soundslot to make sure sounds don't overlap; here I use slot 5
  71. OLYM A 1 Offset (0, 38);
  72. OLYM A 1 Offset (0, 44);
  73. OLYM A 1 Offset (0, 52);
  74. OLYM A 1 Offset (0, 62);
  75. OLYM A 1 Offset (0, 72);
  76. OLYM A 1 Offset (0, 82);
  77. TNT1 A 8 { // Here we'll perform the actual reload
  78. while (CountInv ("OlympiaMag") < 2 && CountInv ("Shell") > 0) { // WHILE we have less than 2 ammo in our magazine AND we have more than 0 Shell...
  79. TakeInventory ("Shell", 1); // ... Take 1 ammo from reserves
  80. GiveInventory ("OlympiaMag", 1); // ... And give 1 ammo into magazine
  81. }
  82. }
  83. OLYM A 1 Offset (0, 82);
  84. OLYM A 1 Offset (0, 72);
  85. OLYM A 1 Offset (0, 62);
  86. OLYM A 1 Offset (0, 52);
  87. OLYM A 1 Offset (0, 44);
  88. OLYM A 1 Offset (0, 38);
  89. OLYM A 1 Offset (0, 35);
  90. OLYM A 1 Offset (0, 32);
  91. Goto Ready;
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement