Advertisement
antonsavov

Untitled

Mar 9th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.92 KB | None | 0 0
  1. --THIS SCRIPT CONTROLS THE ARRIVAL OF PLAYERS TO THE SERVER BY TELEPORTING THEM TO THE RIGHT LOCATIONS
  2. --DEPENDING ON THEIR EXPERIENCE: COMPLETED TUTORIAL OR NOT, PLAYED AT LEAST ONE GAME OR NOT, PLAYED MORE THAN 5 GAMES, ETC.
  3. local VERSION = '1.0.0 - Public Release'
  4.  
  5. commands.gamerule("doDaylightCycle",false)
  6. commands.gamerule("doTileDrops",false)
  7. commands.gamerule("logAdminCommands",false)
  8. commands.gamerule("commandBlockOutput",false)
  9. commands.gamerule("showDeathMessages",false)
  10. commands.scoreboard("objectives","add","tut_state","dummy")
  11. --tut_state 0 : havent started tutorial
  12. --tut_state 1 : started tutorial
  13. --tut_state 2 : finished tutorial
  14. commands.scoreboard("objectives","add","not_first_login","dummy")
  15. commands.scoreboard("objectives","add","left_game","stat.leaveGame")
  16. commands.scoreboard("objectives","add","lifetime","stat.timeSinceDeath")
  17. commands.time("set",6000)
  18.  
  19. print("Starting Spawn Controller")
  20.  
  21. WELCOME_AREA = {
  22. x=12477,
  23. y=87,
  24. z=-1826,
  25. r1=0,
  26. r2=0
  27. }
  28. PLAY_AREA = {
  29. x=12113,
  30. y=57,
  31. z=-1777,
  32. r1=90,
  33. r2=0
  34. }
  35. TUT_WAIT_AREA = {
  36. x=12381,
  37. y=69,
  38. z=-1716,
  39. r1=115,
  40. r2=0
  41. }
  42. -- set team names and colors. Players will never see their team name
  43. TEAMS = {
  44. {name="new_players",color="red",title="New Players"},
  45. {name="middle_players",color="blue",title="Players"},
  46. {name="pro_players",color="green",title="Epic Builders"}
  47. }
  48.  
  49. PRO_TRESHOLD = 5 --number of games a player needs to play in order to become a PRO player
  50.  
  51. --messages for players. Change them here.
  52.  
  53. --- messsage to brand new players and players who join after they logged off without completing the tutorial
  54. WELCOME_MESSAGE_EN = "WELCOME TO IBA_GAME | 20.000 BLOCKS!\n This is the INTRODUCTION TOUR. You need to complete it in one go and reach the play area."
  55. WELCOME_MESSAGE_DE = "WILLKOMMEN ZUM IBA_GAME | 20.000 BLOCKS!\n Dies ist die EINFÜHRUNGSRUNDE. Du musst sie durchlaufen um das Spielfeld betreten zu können."
  56. -- message to players who died before completing the tutorial
  57. DEATH_NEW_MSG_EN = "Death has no consequence in IBA_GAME, we have put you back at the welcome area.\n COMPLETE THE INTRODUCTION TOUR and reach the play area."
  58. DEATH_NEW_MSG_DE = "Der Tod hat im IBA_GAME keine Konsequenz. Er wird dich lediglich zurück in den Willkommens-Bereich bringen.\n ABSOLVIERE DIE EINFÜHRUNGSRUNDE und erreiche das Spielfeld."
  59.  
  60.  
  61. WELCOME_LINK_TEXT_EN = "\n VIEW YOUR WORK and discover what others have built at www.20000blocks.com"
  62. WELCOME_LINK_TEXT_DE = "\n Schau dir an was du und viele andere Spieler gebaut haben auf www.20000blocks.com"
  63. WELCOME_LINK = "https://20000blocks.com/"
  64. WELCOME_HOVER_TEXT_EN = "Open the website of IBA_GAME | 20.000 BLOCKS"
  65. WELCOME_HOVER_TEXT_DE = "Öffne die Internetseite vom IBA_GAME | 20.000 BLOCKS"
  66.  
  67. BACK_MESSAGE_EN = "Welcome back!\n COMPLETE THE TUTORIAL and then move on to the play area for your first game."
  68. BACK_MESSAGE_DE = "Willkommen zurück!\n ABSOLVIERE DIE EINFÜHRUNG und gehe dann weiter zum Spielfeld deines ersten Spiels."
  69.  
  70. PLAY_MESSAGE_EN = "Welcome back!\n Walk into the yellow cube to PLAY YOUR FIRST GAME and help build Heidelberg's new city quarter!"
  71. PLAY_MESSAGE_DE = "Willkommen zurück!\n Betrete den gelben Würfel um dein ERSTES SPIEL zu beginnen und damit Heidelbergs neues Stadtquartier zu entwerfen!"
  72.  
  73. --message to returning older players
  74. VIEW_MESSAGE_EN = "Welcome back!\n Play to create the GREENEST, the TALLEST, the DENSEST or the MOST DIVERSE NEIGHBOURHOOD."
  75. VIEW_MESSAGE_DE = "Willkommen zurück!\n Spiele um das GRÜNSTE, das HÖCHSTE, das DICHTESTE oder die VIELSEITIGSTE NACHBARSCHAFT zu bauen."
  76.  
  77. PRO_MESSAGE_EN = "Welcome back, Master Builder!\n Thanks for your contribution to Heidelberg's new city quarter! KEEP PLAYING and finding new ways to combine buildings into a neighbourhood!"
  78. PRO_MESSAGE_DE = "Willkommen zurück!\n Danke für deinen Beitrag zum neuen Heidelberger Stadtquartier! SPIELE WEITER und finde spannende Wege um Gebäude in der Nachbarschaft zu kombinieren!"
  79.  
  80.  
  81.  
  82. --
  83. DEATH_TUT_MSG_EN = "Don't worry about that!\n Try completing the tutorial again."
  84. DEATH_TUT_MSG_DE = "Kein Grund zur Sorge!\n Versuch die Einführung einfach noch einmal."
  85.  
  86. --
  87. DEATH_NORMAL_MSG_EN = "No worries.\n Someone probably placed a building on top of you or you fell from a high place.\n Let's put you back in the game."
  88. DEATH_NORMAL_MSG_DE = "Keine Sorge.\n Eventuell hat jemand ein Gebäude auf dich drauf gesetzt oder du bist gestürzt.\n Wir bringen dich einfach zurück ins Spiel."
  89.  
  90.  
  91. --tellraw commands, dont touch these. They are made up from the messages above.
  92. --mesasge to Pro Players / Master Builders
  93. PRO_TELLRAW_EN = '["",{"text":"'..PRO_MESSAGE_EN..'","color":"white","bold":false},{"text":"'..WELCOME_LINK_TEXT_EN..'","color":"blue","underlined":true,"clickEvent":{"action":"open_url","value":"'..WELCOME_LINK..'"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"'..WELCOME_HOVER_TEXT_EN..'","color":"yellow"}]}},"bold":false}]'
  94.  
  95. PRO_TELLRAW_DE = '["",{"text":"'..PRO_MESSAGE_DE..'","color":"gold","bold":false},{"text":"'..WELCOME_LINK_TEXT_DE..'","color":"blue","underlined":true,"clickEvent":{"action":"open_url","value":"'..WELCOME_LINK..'"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"'..WELCOME_HOVER_TEXT_DE..'","color":"yellow"}]}},"bold":false}]'
  96.  
  97. --message to Medium Players
  98. VIEW_TELLRAW_EN = '["",{"text":"'..VIEW_MESSAGE_EN..'","color":"white","bold":false},{"text":"'..WELCOME_LINK_TEXT_EN..'","color":"blue","underlined":true,"clickEvent":{"action":"open_url","value":"'..WELCOME_LINK..'"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"'..WELCOME_HOVER_TEXT_EN..'","color":"yellow"}]}},"bold":false}]'
  99.  
  100. VIEW_TELLRAW_DE = '["",{"text":"'..VIEW_MESSAGE_DE..'","color":"gold","bold":false},{"text":"'..WELCOME_LINK_TEXT_DE..'","color":"blue","underlined":true,"clickEvent":{"action":"open_url","value":"'..WELCOME_LINK..'"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"'..WELCOME_HOVER_TEXT_DE..'","color":"yellow"}]}},"bold":false}]'
  101.  
  102. --message to new players who completed tutorial but didn't play a game
  103. PLAY_TELLRAW_EN = '["",{"text":"'..PLAY_MESSAGE_EN..'","color":"white","bold":false}]'
  104. PLAY_TELLRAW_DE = '["",{"text":"'..PLAY_MESSAGE_DE..'","color":"gold","bold":false}]'
  105.  
  106. --message to players who left in the middle of the tutorial
  107. BACK_TELLRAW_EN = '["",{"text":"'..BACK_MESSAGE_EN..'","color":"white","bold":false}]'
  108. BACK_TELLRAW_DE = '["",{"text":"'..BACK_MESSAGE_DE..'","color":"gold","bold":false}]'
  109.  
  110. --message to players who join for first time or didnt complete the intro tour
  111. WELCOME_TELLRAW_EN = '["",{"text":"'..WELCOME_MESSAGE_EN..'","color":"white","bold":false}]'
  112. WELCOME_TELLRAW_DE = '["",{"text":"'..WELCOME_MESSAGE_DE..'","color":"gold","bold":false}]'
  113.  
  114. --message to player who died in the Intro Tour
  115. DEATH_NEW_TELLRAW_EN = '["",{"text":"'..DEATH_NEW_MSG_EN..' ","color":"white","bold":false}]'
  116. DEATH_NEW_TELLRAW_DE = '["",{"text":"'..DEATH_NEW_MSG_DE..' ","color":"gold","bold":false}]'
  117. --message to players who died during the tutorial
  118. DEATH_TUT_TELLRAW_EN = '["",{"text":"'..DEATH_TUT_MSG_EN..' ","color":"white","bold":false}]'
  119. DEATH_TUT_TELLRAW_DE = '["",{"text":"'..DEATH_TUT_MSG_DE..' ","color":"gold","bold":false}]'
  120.  
  121. --message to players who died during a game
  122. DEATH_NORMAL_TELLRAW_EN = '["",{"text":"'..DEATH_NORMAL_MSG_EN..' ","color":"white","bold":false}]'
  123. DEATH_NORMAL_TELLRAW_DE = '["",{"text":"'..DEATH_NORMAL_MSG_DE..' ","color":"gold","bold":false}]'
  124.  
  125.  
  126. --setup teams
  127. commands.scoreboard("teams","add",TEAMS[1].name,TEAMS[1].title)
  128. commands.scoreboard("teams","add",TEAMS[2].name,TEAMS[2].title)
  129. commands.scoreboard("teams","add",TEAMS[3].name,TEAMS[3].title)
  130. commands.scoreboard("teams","option",TEAMS[1].name,"color",TEAMS[1].color)
  131. commands.scoreboard("teams","option",TEAMS[2].name,"color",TEAMS[2].color)
  132. commands.scoreboard("teams","option",TEAMS[3].name,"color",TEAMS[3].color)
  133.  
  134. local symbols = {
  135. "-X- ",
  136. "-+- "
  137. }
  138.  
  139. local spin = 1
  140.  
  141. while true do
  142.  
  143. term.clear()
  144. print("Controlling Spawns "..symbols[spin])
  145. spin = spin +1
  146. if spin > #symbols then spin = 1 end
  147.  
  148. --if the "played" score is minimum 1 and player has completed the tutorial put players in team 2 - middle players
  149. local playersForTeam2 = '@a[m=2,team='..TEAMS[1].name..',score_tut_state=2,score_tut_state_min=2,score_played_min=1]'
  150. commands.scoreboard("teams","join",TEAMS[2].name,playersForTeam2)
  151.  
  152. --if the "played" score is more than the treshold put players in team 3 - pro players
  153. local playersForTeam3 = '@a[m=2,team='..TEAMS[2].name..',score_played_min='..PRO_TRESHOLD..']'
  154. commands.scoreboard("teams","join",TEAMS[3].name,playersForTeam3)
  155.  
  156. --deal with returning players with tut_state 0
  157. local returning_new_players = '@a[m=2,team='..TEAMS[1].name..',score_tut_state=0,score_left_game_min=1]'
  158. commands.spawnpoint(returning_new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  159. commands.tp(returning_new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  160. commands.tellraw(returning_new_players,WELCOME_TELLRAW_EN)
  161. commands.tellraw(returning_new_players,WELCOME_TELLRAW_DE)
  162. commands.scoreboard("players","set",returning_new_players,"left_game",0)
  163.  
  164. --deal with returning players with tut_state 1
  165. local returning_tut_players = '@a[m=2,team='..TEAMS[1].name..',score_tut_state=1,score_tut_state_min=1,score_left_game_min=1]'
  166. commands.spawnpoint(returning_tut_players,TUT_WAIT_AREA.x,TUT_WAIT_AREA.y,TUT_WAIT_AREA.z,TUT_WAIT_AREA.r1,TUT_WAIT_AREA.r2)
  167. commands.tp(returning_tut_players,TUT_WAIT_AREA.x,TUT_WAIT_AREA.y,TUT_WAIT_AREA.z,TUT_WAIT_AREA.r1,TUT_WAIT_AREA.r2)
  168. commands.tellraw(returning_tut_players,BACK_TELLRAW_EN)
  169. commands.tellraw(returning_tut_players,BACK_TELLRAW_DE)
  170. commands.scoreboard("players","set",returning_tut_players,"left_game",0)
  171.  
  172. --deal with returning players with tut_state 2
  173. local returning_players = '@a[m=2,team='..TEAMS[1].name..',score_tut_state=2,score_tut_state_min=2,score_left_game_min=1]'
  174. commands.spawnpoint(returning_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  175. commands.tp(returning_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  176. commands.tellraw(returning_players,PLAY_TELLRAW_EN)
  177. commands.tellraw(returning_players,PLAY_TELLRAW_DE)
  178. commands.scoreboard("players","set",returning_players,"left_game",0)
  179.  
  180. --deal with returning older players
  181. local returning_old_players = '@a[m=2,team='..TEAMS[2].name..',score_left_game_min=1]'
  182. commands.spawnpoint(returning_old_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  183. commands.tp(returning_old_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  184. commands.tellraw(returning_old_players,VIEW_TELLRAW_EN)
  185. commands.tellraw(returning_old_players,VIEW_TELLRAW_DE)
  186. commands.scoreboard("players","set",returning_old_players,"left_game",0)
  187.  
  188. --deal with returning pro players
  189. local returning_pro_players = '@a[m=2,team='..TEAMS[3].name..',score_left_game_min=1]'
  190. commands.spawnpoint(returning_pro_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  191. commands.tp(returning_pro_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  192. commands.tellraw(returning_pro_players,PRO_TELLRAW_EN)
  193. commands.tellraw(returning_pro_players,PRO_TELLRAW_DE)
  194. commands.scoreboard("players","set",returning_pro_players,"left_game",0)
  195.  
  196. --deal with brand new players
  197. local new_players = "@a[m=2,team=]"
  198. commands.scoreboard("players","set",new_players,"lifetime",1500)
  199. commands.scoreboard("players","set",new_players,"not_first_login",0)
  200. commands.scoreboard("players","set",new_players,"left_game",0)
  201. commands.scoreboard("players","set",new_players,"tut_state",0)
  202. commands.tellraw(new_players,WELCOME_TELLRAW_EN)
  203. commands.tellraw(new_players,WELCOME_TELLRAW_DE)
  204. commands.spawnpoint(new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  205. commands.tp(new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  206. commands.scoreboard("teams","join",TEAMS[1].name,new_players)
  207.  
  208. --deal with dead players with tut_state 0
  209. local dead_newbies = '@a[m=2,score_lifetime=20,score_lifetime_min=1,score_tut_state_min=0,score_tut_state=0]'
  210. commands.tellraw(dead_newbies,DEATH_NEW_TELLRAW_EN)
  211. commands.tellraw(dead_newbies,DEATH_NEW_TELLRAW_DE)
  212.  
  213. --deal with dead players with tut_state 1
  214. local dead_tut_players = '@a[m=2,score_lifetime=20,score_lifetime_min=1,score_tut_state_min=1,score_tut_state=1]'
  215. commands.tellraw(dead_tut_players,DEATH_TUT_TELLRAW_EN)
  216. commands.tellraw(dead_tut_players,DEATH_TUT_TELLRAW_DE)
  217.  
  218. --deal with dead players and with other dead players who probably died in a campaign
  219. local dead_players = '@a[m=2,score_lifetime=20,score_lifetime_min=1,score_tut_state_min=2,score_tut_state=2]'
  220. commands.tellraw(dead_players,DEATH_NORMAL_TELLRAW_EN)
  221. commands.tellraw(dead_players,DEATH_NORMAL_TELLRAW_DE)
  222.  
  223. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement