Advertisement
antonsavov

Untitled

Mar 9th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.28 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 = '0.0.2 - fixed english messages'
  4.  
  5. commands.gamerule("doDaylightCycle",false)
  6. commands.gamerule("doTileDrops",true)
  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. --messages for players. Change them here.
  50.  
  51. --- messsage to brand new players and players who join after they logged off without completing the tutorial
  52. 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."
  53. 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."
  54. -- message to players who died before completing the tutorial
  55. 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."
  56. 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."
  57.  
  58.  
  59. WELCOME_LINK_TEXT_EN = "\n VIEW YOUR WORK and discover what others have built at www.20000blocks.com"
  60. WELCOME_LINK_TEXT_DE = "\n Schau dir an was du und viele andere Spieler gebaut haben auf www.20000blocks.com"
  61. WELCOME_LINK = "https://20000blocks.com/"
  62. WELCOME_HOVER_TEXT_EN = "Open the website of IBA_GAME | 20.000 BLOCKS"
  63. WELCOME_HOVER_TEXT_DE = "Öffne die Internetseite vom IBA_GAME | 20.000 BLOCKS"
  64.  
  65. BACK_MESSAGE_EN = "Welcome back!\n COMPLETE THE TUTORIAL and then move on to the play area for your first game."
  66. BACK_MESSAGE_DE = "Willkommen zurück!\n ABSOLVIERE DIE EINFÜHRUNG und gehe dann weiter zum Spielfeld deines ersten Spiels."
  67.  
  68. PLAY_MESSAGE_EN = "Welcome back!\n Walk into the yellow cube to PLAY YOUR FIRST GAME and help build Heidelberg's new city quarter!"
  69. 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!"
  70.  
  71. --message to returning older players
  72. VIEW_MESSAGE_EN = "Welcome back!\n Play to create the GREENEST, the TALLEST, the DENSEST or the MOST DIVERSE NEIGHBOURHOOD."
  73. VIEW_MESSAGE_DE = "Willkommen zurück!\n Spiele um das GRÜNSTE, das HÖCHSTE, das DICHTESTE oder die VIELSEITIGSTE NACHBARSCHAFT zu bauen."
  74.  
  75. 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!"
  76. 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!"
  77.  
  78.  
  79.  
  80. --
  81. DEATH_TUT_MSG_EN = "Don't worry about that!\n Try completing the tutorial again."
  82. DEATH_TUT_MSG_DE = "Kein Grund zur Sorge!\n Versuch die Einführung einfach noch einmal."
  83.  
  84. --
  85. 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."
  86. 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."
  87.  
  88.  
  89. --tellraw commands, dont touch these. They are made up from the messages above.
  90. --mesasge to Pro Players / Master Builders
  91. 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}]'
  92.  
  93. 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}]'
  94.  
  95. --message to Medium Players
  96. 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}]'
  97.  
  98. 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}]'
  99.  
  100. --message to new players who completed tutorial but didn't play a game
  101. PLAY_TELLRAW_EN = '["",{"text":"'..PLAY_MESSAGE_EN..'","color":"white","bold":false}]'
  102. PLAY_TELLRAW_DE = '["",{"text":"'..PLAY_MESSAGE_DE..'","color":"gold","bold":false}]'
  103.  
  104. --message to players who left in the middle of the tutorial
  105. BACK_TELLRAW_EN = '["",{"text":"'..BACK_MESSAGE_EN..'","color":"white","bold":false}]'
  106. BACK_TELLRAW_DE = '["",{"text":"'..BACK_MESSAGE_DE..'","color":"gold","bold":false}]'
  107.  
  108. --message to players who join for first time or didnt complete the intro tour
  109. WELCOME_TELLRAW_EN = '["",{"text":"'..WELCOME_MESSAGE_EN..'","color":"white","bold":false}]'
  110. WELCOME_TELLRAW_DE = '["",{"text":"'..WELCOME_MESSAGE_DE..'","color":"gold","bold":false}]'
  111.  
  112. --message to player who died in the Intro Tour
  113. DEATH_NEW_TELLRAW_EN = '["",{"text":"'..DEATH_NEW_MSG_EN..' ","color":"white","bold":false}]'
  114. DEATH_NEW_TELLRAW_DE = '["",{"text":"'..DEATH_NEW_MSG_DE..' ","color":"gold","bold":false}]'
  115. --message to players who died during the tutorial
  116. DEATH_TUT_TELLRAW_EN = '["",{"text":"'..DEATH_TUT_MSG_EN..' ","color":"white","bold":false}]'
  117. DEATH_TUT_TELLRAW_DE = '["",{"text":"'..DEATH_TUT_MSG_DE..' ","color":"gold","bold":false}]'
  118.  
  119. --message to players who died during a game
  120. DEATH_NORMAL_TELLRAW_EN = '["",{"text":"'..DEATH_NORMAL_MSG_EN..' ","color":"white","bold":false}]'
  121. DEATH_NORMAL_TELLRAW_DE = '["",{"text":"'..DEATH_NORMAL_MSG_DE..' ","color":"gold","bold":false}]'
  122.  
  123.  
  124. --setup teams
  125. commands.scoreboard("teams","add",TEAMS[1].name,TEAMS[1].title)
  126. commands.scoreboard("teams","add",TEAMS[2].name,TEAMS[2].title)
  127. commands.scoreboard("teams","add",TEAMS[3].name,TEAMS[3].title)
  128. commands.scoreboard("teams","option",TEAMS[1].name,"color",TEAMS[1].color)
  129. commands.scoreboard("teams","option",TEAMS[2].name,"color",TEAMS[2].color)
  130. commands.scoreboard("teams","option",TEAMS[3].name,"color",TEAMS[3].color)
  131.  
  132. local symbols = {
  133. "-X- ",
  134. "-+- "
  135. }
  136.  
  137. local spin = 1
  138.  
  139. while true do
  140.  
  141. term.clear()
  142. print("Controlling Spawns "..symbols[spin])
  143. spin = spin +1
  144. if spin > #symbols then spin = 1 end
  145.  
  146. --deal with returning players with tut_state 0
  147. local returning_new_players = '@a[m=2,team='..TEAMS[1].name..',score_tut_state=0,score_left_game_min=1]'
  148. commands.spawnpoint(returning_new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  149. commands.tp(returning_new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  150. commands.tellraw(returning_new_players,WELCOME_TELLRAW_EN)
  151. commands.tellraw(returning_new_players,WELCOME_TELLRAW_DE)
  152. commands.scoreboard("players","set",returning_new_players,"left_game",0)
  153.  
  154. --deal with returning players with tut_state 1
  155. 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]'
  156. 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)
  157. 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)
  158. commands.tellraw(returning_tut_players,BACK_TELLRAW_EN)
  159. commands.tellraw(returning_tut_players,BACK_TELLRAW_DE)
  160. commands.scoreboard("players","set",returning_tut_players,"left_game",0)
  161.  
  162. --deal with returning players with tut_state 2
  163. local returning_players = '@a[m=2,team='..TEAMS[1].name..',score_tut_state=2,score_tut_state_min=2,score_left_game_min=1]'
  164. commands.spawnpoint(returning_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  165. commands.tp(returning_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  166. commands.tellraw(returning_players,PLAY_TELLRAW_EN)
  167. commands.tellraw(returning_players,PLAY_TELLRAW_DE)
  168. commands.scoreboard("players","set",returning_players,"left_game",0)
  169.  
  170. --deal with returning older players
  171. local returning_old_players = '@a[m=2,team='..TEAMS[2].name..',score_left_game_min=1]'
  172. commands.spawnpoint(returning_old_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  173. commands.tp(returning_old_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  174. commands.tellraw(returning_old_players,VIEW_TELLRAW_EN)
  175. commands.tellraw(returning_old_players,VIEW_TELLRAW_DE)
  176. commands.scoreboard("players","set",returning_old_players,"left_game",0)
  177.  
  178. --deal with returning pro players
  179. local returning_pro_players = '@a[m=2,team='..TEAMS[3].name..',score_left_game_min=1]'
  180. commands.spawnpoint(returning_pro_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  181. commands.tp(returning_pro_players,PLAY_AREA.x,PLAY_AREA.y,PLAY_AREA.z,PLAY_AREA.r1,PLAY_AREA.r2)
  182. commands.tellraw(returning_pro_players,PRO_TELLRAW_EN)
  183. commands.tellraw(returning_pro_players,PRO_TELLRAW_DE)
  184. commands.scoreboard("players","set",returning_pro_players,"left_game",0)
  185.  
  186. --deal with brand new players
  187. local new_players = "@a[m=2,team=]"
  188. commands.scoreboard("players","set",new_players,"lifetime",1500)
  189. commands.scoreboard("players","set",new_players,"not_first_login",0)
  190. commands.scoreboard("players","set",new_players,"left_game",0)
  191. commands.scoreboard("players","set",new_players,"tut_state",0)
  192. commands.tellraw(new_players,WELCOME_TELLRAW_EN)
  193. commands.tellraw(new_players,WELCOME_TELLRAW_DE)
  194. commands.spawnpoint(new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  195. commands.tp(new_players,WELCOME_AREA.x,WELCOME_AREA.y,WELCOME_AREA.z,WELCOME_AREA.r1,WELCOME_AREA.r2)
  196. commands.scoreboard("teams","join",TEAMS[1].name,new_players)
  197.  
  198. --deal with dead players with tut_state 0
  199. local dead_newbies = '@a[m=2,score_lifetime=20,score_lifetime_min=1,score_tut_state_min=0,score_tut_state=0]'
  200. commands.tellraw(dead_newbies,DEATH_NEW_TELLRAW_EN)
  201. commands.tellraw(dead_newbies,DEATH_NEW_TELLRAW_DE)
  202.  
  203. --deal with dead players with tut_state 1
  204. local dead_tut_players = '@a[m=2,score_lifetime=20,score_lifetime_min=1,score_tut_state_min=1,score_tut_state=1]'
  205. commands.tellraw(dead_tut_players,DEATH_TUT_TELLRAW_EN)
  206. commands.tellraw(dead_tut_players,DEATH_TUT_TELLRAW_DE)
  207.  
  208. --deal with dead players and with other dead players who probably died in a campaign
  209. local dead_players = '@a[m=2,score_lifetime=20,score_lifetime_min=1,score_tut_state_min=2,score_tut_state=2]'
  210. commands.tellraw(dead_players,DEATH_NORMAL_TELLRAW_EN)
  211. commands.tellraw(dead_players,DEATH_NORMAL_TELLRAW_DE)
  212.  
  213. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement