Guest User

Pandemic Legacy scripts

a guest
Apr 29th, 2020
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. --[[ Script for clearing the board after a game --]]
  2.  
  3. function onLoad(save_state)
  4. local button = {index = 0, click_function = 'returnAllCubes', function_owner = self,
  5. label = 'Clear Board', position = {x = 0, y = 1, z = 0}, rotation = {x = 0, y = 0, z = 0},
  6. scale = {x = 2, y = 1, z = 2}, width = 3100, height = 500, font_size = 350,
  7. font_color = {r = 0, g = 0, b = 0, a = 1}}
  8.  
  9. button.color = self.getColorTint()
  10. self.createButton(button)
  11. end
  12.  
  13. local bigYellow = '7add2e'
  14. local bigRed = '9aa8c4'
  15. local bigBlue = '3cff2e'
  16. local bigBlack = 'e4fe2d'
  17. local bigFaded = 'd7cdee'
  18.  
  19. function returnAllCubes()
  20. returnCubes(bigYellow,'yell')
  21. returnCubes(bigRed,'red0')
  22. returnCubes(bigBlue,'blue')
  23. returnCubes(bigBlack,'blac')
  24. returnCubes(bigFaded,'fade')
  25. end
  26.  
  27.  
  28. function returnCubes(bigCubeGUID,colour)
  29. bigCube = getObjectFromGUID(bigCubeGUID)
  30. if colour == 'fade' then
  31. j = 37
  32. else
  33. j = 24
  34. end
  35.  
  36. for i=1,j do
  37. if i < 10 then
  38. guid = colour..'0'..i
  39. else
  40.  
  41. guid = colour..i
  42. end
  43. local obj = getObjectFromGUID(guid)
  44. if obj != null then
  45. bigCube.putObject(obj)
  46. end
  47.  
  48.  
  49. end
  50.  
  51. end
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. --[[ Script for getting the bottom card --]]
  61.  
  62. function onLoad(save_state)
  63. local button = {index = 0, click_function = 'drawBottomCard', function_owner = self,
  64. label = 'Draw Bottom Card', position = {x = 0, y = 1, z = 0}, rotation = {x = 0, y = 0, z = 0},
  65. scale = {x = 2, y = 1, z = 2}, width = 3100, height = 500, font_size = 350,
  66. font_color = {r = 0, g = 0, b = 0, a = 1}}
  67.  
  68. button.color = self.getColorTint()
  69. self.createButton(button)
  70. end
  71.  
  72. function drawBottomCard()
  73. deck = getObjectFromGUID('d69851')
  74. num = deck.getQuantity()
  75. deck.takeObject({
  76. index = num -1,
  77. flip = true,
  78. position = {35, 1.5, 22}
  79. })
  80. end
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. --[[ Script for setting up the deck --]]
  89.  
  90.  
  91. function onLoad(save_state)
  92. local button = {index = 0, click_function = 'SetupPlayerDeck', function_owner = self,
  93. label = 'Setup Deck', position = {x = 0, y = 1, z = 0}, rotation = {x = 0, y = 0, z = 0},
  94. scale = {x = 2, y = 1, z = 2}, width = 3100, height = 500, font_size = 350,
  95. font_color = {r = 0, g = 0, b = 0, a = 1}}
  96.  
  97. button.color = self.getColorTint()
  98. self.createButton(button)
  99. end
  100.  
  101. function SetupPlayerDeck()
  102. playerDeckZone = getObjectFromGUID('zone02')
  103.  
  104. for a,b in pairs(playerDeckZone.getObjects()) do
  105. playerDeck=b
  106. end
  107. epidemicDeckZone = getObjectFromGUID('zone03')
  108.  
  109. for a,b in pairs(epidemicDeckZone.getObjects()) do
  110. epidemicDeck=b
  111. end
  112. playerDeck.shuffle()
  113.  
  114. players = getSeatedPlayers()
  115. if players == 2 then
  116. playerDeck.deal(4)
  117. end
  118. if players == 3 then
  119. playerDeck.deal(3)
  120. end
  121. if players == 4 then
  122. playerDeck.deal(2)
  123. end
  124.  
  125. if epidemicDeck then
  126. deck1split=playerDeck.split(5)
  127. Wait.frames(function() stage1() end,10)
  128. else
  129. broadcastToAll("Place all epidemic cards on the discard pile")
  130. end
  131. end
  132.  
  133.  
  134.  
  135. function stage1()
  136. for i=1, 5 do
  137. deck1split[i].setPosition({-40+(8*i), -28, -20})
  138. deck1split[i].setRotation({0,180,180})
  139. end
  140. for i=1, 5 do
  141. epidemic=epidemicDeck.takeObject({position={25.00, -10, -20.00}})
  142. deck1split[i].putObject(epidemic)
  143. end
  144. Wait.frames(function() stage2() end,40)
  145. end
  146.  
  147.  
  148. function stage2()
  149.  
  150. for i=1, 5 do
  151. deck1split[i].shuffle()
  152. end
  153. Wait.frames(function() stage3() end,40)
  154. end
  155.  
  156. function stage3()
  157. for i=1, 5 do
  158. deck1split[i].setPosition({21.8, 2+(i*2), -20})
  159. end
  160. end
Advertisement
Add Comment
Please, Sign In to add comment