Advertisement
Guest User

Untitled

a guest
Oct 28th, 2015
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. -- bomb, code for inventory
  2. local bombLoc = "Bomb AoE"
  3. bombDC = Deaths( )
  4. bombDC:SetUnit( "Terran Missile Turret" )
  5. bombDC:SetPlayer( 8 )
  6.  
  7. local bombCountDC = Deaths( )
  8. bombCountDC:SetUnit( "Terran Nuclear Silo" )
  9. bombCountDC:SetPlayer( 8 )
  10.  
  11. -- TESTING PURPOSES
  12. -- start the player out with some bombs
  13. p1:Conditions( )
  14. Always( )
  15. p1:Actions( )
  16. bombCountDC:SetCount( 3 )
  17. bombCountDC:SetTo( )
  18.  
  19. -- if player has bombs (bombCountDC), then setup bombDC and play effects
  20. p1:Conditions( )
  21. BringExactly( Player1, "Gui Montag (Firebat)", "Bomb", 0 )
  22. bombCountDC:SetCount( 1 )
  23. bombCountDC:AtLeast( )
  24. p1:Actions( )
  25. MoveUnit( Player1, "Gui Montag (Firebat)", 1, "Anywhere", "Bomb" )
  26. PlayWAV( "staredit/wav/LTTP_Bomb_Drop.wav" )
  27. Text( "<4>Bomb" )
  28. bombDC:SetCount( 12 * 5 )
  29. bombDC:Add( )
  30. bombCountDC:SetCount( 1 )
  31. bombCountDC:Subtract( )
  32. Preserve( )
  33.  
  34. -- else player does NOT have bombs (bombCountDC)
  35. p1:Conditions( )
  36. BringExactly( Player1, "Gui Montag (Firebat)", "Bomb", 0 )
  37. bombCountDC:SetCount( 0 )
  38. bombCountDC:Exactly( )
  39. p1:Actions( )
  40. MoveUnit( Player1, "Gui Montag (Firebat)", 1, "Anywhere", "Bomb" )
  41. Text( "<4>Out of bombs" )
  42. PlayWAV( "staredit/wav/LTTP_Error.wav" )
  43. Preserve( )
  44.  
  45. -- detect if player tried to spawn 2 bombs at once
  46. -- do this by subtracting the timer counter (implements a modulo)
  47. p8:Conditions( )
  48. bombDC:SetCount( 12 * 5 + 1 )
  49. bombDC:AtLeast( )
  50. p8:Actions( )
  51. bombDC:SetCount( 12 * 5 )
  52. bombDC:Subtract( )
  53. Preserve( )
  54.  
  55. -- detect if no bomb exists, if so create one
  56. p8:Conditions( )
  57. bombDC:SetCount( 1 )
  58. bombDC:AtLeast( )
  59. BringExactly( 8, "Magellan (Science Vessel)", "Anywhere", 0 )
  60. p8:Actions( )
  61. CenterLocation( bombLoc, 1, LINK, "Anywhere" )
  62. CreateUnit( 8, "Magellan (Science Vessel)", count, bombLoc )
  63. SetInvincibility( 8, "Magellan (Science Vessel)", bombLoc, "enabled" )
  64. Preserve( )
  65.  
  66. -- explode the bomb
  67. -- this should signify when to kill enemies and watnot
  68. p8:Conditions( )
  69. bombDC:SetCount( 1 )
  70. bombDC:Exactly( )
  71. p8:Actions( )
  72. KillUnit( 8, "Magellan (Science Vessel)" )
  73. Preserve( )
  74.  
  75. -- play the bomb sound for player 1
  76. p1:Conditions( )
  77. bombDC:SetCount( 1 )
  78. bombDC:Exactly( )
  79. p1:Actions( )
  80. PlayWAV( "staredit/wav/LTTP_Bomb_Blow.wav" )
  81. Preserve( )
  82.  
  83. -- blow up any rhynadons
  84. -- Rhynadon (Badlands)
  85. p8:Conditions( )
  86. bombDC:SetCount( 1 )
  87. bombDC:Exactly( )
  88. BringAtLeast( 8, "Rhynadon (Badlands)", bombLoc, 1 )
  89. p8:Actions( )
  90. KillUnitAt( 8, "Rhynadon (Badlands)", 1, bombLoc )
  91. Preserve( )
  92.  
  93. -- blow up scantids
  94. p8:Conditions( )
  95. bombDC:SetCount( 1 )
  96. bombDC:Exactly( )
  97. BringAtLeast( 8, "Scantid (Desert)", bombLoc, 1 )
  98. p8:Actions( )
  99. KillUnitAt( 8, "Scantid (Desert)", 0, bombLoc )
  100. Preserve( )
  101.  
  102. -- countdown the bomb dc
  103. p8:Conditions( )
  104. bombDC:SetCount( 1 )
  105. bombDC:AtLeast( )
  106. p8:Actions( )
  107. bombDC:Subtract( )
  108. Preserve( )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement