Advertisement
Guest User

Autoshotgun code

a guest
Jul 27th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. actor AutoShotgun : Weapon
  2. {
  3. obituary "%o got blasted away by %k's Auto-shotgun."
  4. radius 20
  5. height 16
  6. +WEAPON.NOAUTOFIRE //this flag makes sure that the gun won't repeatedly click when you hold down the trigger on an empty gun
  7. +WEAPON.NOALERT //this flag makes sure that an empty gun clicking or an ejecting casing will not alert monsters
  8. +WEAPON.AMMO_OPTIONAL //this flag makes sure that there's an empty state for the gun
  9. +WEAPON.ALT_AMMO_OPTIONAL //this as well
  10. Inventory.Pickupmessage "You got the Automatic shotgun!"
  11. weapon.selectionorder 700
  12. Weapon.AmmoType1 "ASGClip"
  13. Weapon.AmmoType2 "Shell"
  14. Weapon.AmmoGive1 0
  15. Weapon.AmmoUse1 1
  16. Weapon.AmmoGive2 12
  17. Weapon.AmmoUse2 0
  18. AttackSound "weapons/HS_FIRE1"
  19. states
  20. {
  21. Spawn:
  22. WASG A -1
  23. stop
  24. Ready:
  25. ASGG A 1 A_WeaponReady
  26. NULL A 0 A_JumpIfInventory("IsReloading",1,"Reload")
  27. loop
  28. Deselect:
  29. ASGG A 1 A_Lower
  30. loop
  31. Select:
  32. ASGG A 1 A_Raise
  33. loop
  34. Reload:
  35. NULL A 0 A_JumpIfInventory("ASGClip",12,2) //this jumps to the 3rd NULL (which goes to Ready) if you don't need to reload
  36. NULL A 0 A_JumpIfInventory("Shell",1,2) //this jumps to KALL A 2 if you have bullets to reload with
  37. NULL A 0
  38. Goto Ready
  39. ASGG A 2
  40. ASGG B 2
  41. ASGG C 2
  42. ASGG D 4
  43. ASGG E 2 A_PlaySound("weapons/HS_COUT") //this refers to the soundfile labeled under weapons/akout in SNDINFO, change as needed
  44. ASGG F 4
  45. ASGG Q 12
  46. NULL A 0 //this is the frame the gun will jump to after a round has been taken from your inventory and inserted into the mag
  47. NULL A 0 A_JumpIfInventory("ASGClip",12,2)
  48. NULL A 0 A_JumpIfInventory("Shell",1,2)
  49. NULL A 0 //if the mag is full, or there are no more bullets, it will jump to the end of the reload state
  50. Goto Reload+18
  51. NULL A 0 A_JumpIfInventory("ASGClip",12,5)
  52. NULL A 0 A_TakeInventory("Shell",1) //remove one round from your stockpile
  53. NULL A 0 A_GiveInventory("ASGClip",1) //create a new round in your magazine
  54. NULL A 0 A_JumpIfInventory("ASGClip",12,2)
  55. Goto Reload+10
  56. NULL A 0 //from here on, the end of the reload animation plays (inserting the magazine and pulling the charging handle)
  57. ASGG G 4 //needless to say, you can alter these numbers and frames to your liking
  58. ASGG H 2 A_PlaySound("weapons/HS_CIN") //but remember that when you change these things, state jumps would need to be recalculated
  59. ASGG I 4 //as in, if I add an extra frame here now, I would have to add one each to Goto Reload+18 and Goto Reload+10
  60. ASGG J 3
  61. ASGG K 2 //so they would now be Goto Reload+19 and Goto Reload+11
  62. Goto Ready
  63. Fire:
  64. NULL A 0 A_JumpIfInventory("ASGClip", 1, 3)
  65. ASGG A 0
  66. ASGG A 1
  67. Goto Reload
  68. ASGG L 0 A_GunFlash
  69. ASGG A 0 A_FireCustomMissile("CheapAlert",0,0,0,0)
  70. ASGG L 0 Bright A_FireBullets(5,3,7,5,"BulletPuff")
  71. ASGG L 2 Bright
  72. ASGG M 2 Bright
  73. ASGG N 2 Bright
  74. ASGG A 5
  75. ASGG A 0
  76. Goto Ready
  77. Flash:
  78. NULL A 4 bright A_Light1
  79. NULL A 3 bright A_Light2
  80. NULL A 0 bright A_Light0
  81. stop
  82. }
  83. }
  84.  
  85. ACTOR ASGClip: Ammo
  86. {
  87. Inventory.MaxAmount 12
  88. Ammo.BackpackAmount 0
  89. Ammo.BackpackMaxAmount 12
  90. }
  91.  
  92. ACTOR CheapAlert
  93. {
  94. Health 1000
  95. Radius 1
  96. Height 1
  97. Speed 0
  98. Damage 0
  99. Mass 1
  100.  
  101. PROJECTILE
  102. +NOCLIP
  103. States
  104. {
  105. Spawn:
  106. NULL A 0
  107. NULL A 1 A_AlertMonsters
  108. Stop //this would spawn with every gunshot, and alert any monster that would be able to hear the gun fire
  109. } //needless to say, if you're making a silenced weapon or a melee weapon, you can make the weapon just not spawn this actor
  110. }
  111.  
  112. ACTOR IsReloading : Inventory
  113. {
  114. Inventory.MaxAmount 1
  115. -COUNTITEM
  116. }
  117.  
  118. ACTOR Action_Reload : CustomInventory
  119. {
  120. Inventory.Amount 1
  121. Inventory.MaxAmount 1
  122. -INVBAR
  123. -COUNTITEM
  124.  
  125. States
  126. {
  127. Use:
  128. TNT1 A 0 A_GiveInventory("IsReloading",1)
  129. Fail
  130. }
  131. }
  132.  
  133. ACTOR Action_ReloadCancel : CustomInventory
  134. {
  135. Inventory.Amount 1
  136. Inventory.MaxAmount 1
  137. -INVBAR
  138. -COUNTITEM
  139.  
  140. States
  141. {
  142. Use:
  143. TNT1 A 0 A_TakeInventory("IsReloading",1)
  144. Fail
  145. }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement