Advertisement
chatasma

Three | V2

Mar 3rd, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.45 KB | None | 0 0
  1. on load:
  2. set {spawn} to location (479, 121, 473) in world "ul_void"
  3. set {spawn}'s yaw to 298.2
  4. set {spawn}'s pitch to -0.03
  5. resetGameCore(2, 6)
  6. initModes("elimination", 23)
  7. loop all players:
  8. resetPlayerData(loop-player)
  9.  
  10. on join:
  11. resetPlayerData(player)
  12. send ""
  13. send "&7Welcome! Do &a/games &7to join a game!"
  14. send ""
  15. toSpawn(player)
  16.  
  17. on quit:
  18. removeFromAllQueues(player)
  19.  
  20.  
  21. on damage:
  22. set {_matchnum} to {player::%victim%::ingame}
  23. if {_matchnum} < 0:
  24. cancel event
  25. else if {games::match%{_matchnum}%::state} < 3:
  26. cancel event
  27. else if {games::match%{_matchnum}%::state} >= 3:
  28. if {player::%attacker%::ingame} = {_matchnum}:
  29. set {_gamer} to whatTeamIsThePlayerOn(victim, {_matchnum})
  30. set {_gamer2} to whatTeamIsThePlayerOn(attacker, {_matchnum})
  31. if {_gamer} = {_gamer2}:
  32. cancel event
  33.  
  34.  
  35. function toSpawn(p: player):
  36. set {_loc} to the location (479, 121, 473) in world "ul_void"
  37. set {_loc}'s yaw to 270
  38. set {_loc}'s pitch to 0.001
  39. teleport {_p} to {_loc}
  40.  
  41. function whatTeamIsThePlayerOn(p: player, match: number) :: text:
  42. if {games::match%{_match}%::team1::*} contains {_p}:
  43. return "team1"
  44. else if {games::match%{_match}%::team2::*} contains {_p}:
  45. return "team2"
  46. else:
  47. return "none"
  48.  
  49. function generalReadyPlayer(p: player):
  50. wait 2 ticks
  51. heal {_p}
  52. clear the inventory of {_p}
  53. set {_p}'s gamemode to adventure
  54.  
  55. function resetPlayerData(p: player):
  56. set {_uuid} to uuid of {_p}
  57. if {player::%{_p}%} is not set:
  58. set {player::%{_p}%} to {_uuid}
  59. if {uplayer::%{_uuid}%} is not set:
  60. set {uplayer::%{_uuid}%} to {_p}
  61. set {player::%{_p}%::ingame} to -1
  62. set {_p} tab name to "&7%{_p}%"
  63. resetTabList({_p})
  64. resetSidebar({_p})
  65.  
  66. function resetTabList(p: player):
  67. set tab header to "\n&6&lTHREE\n" and footer to "&73v3" for {_p}
  68.  
  69. function resetSidebar(p: player):
  70. wipe {_p}'s sidebar
  71. set name of sidebar of {_p} to "&6&lTHREE"
  72. set score "&a" in sidebar of {_p} to 30
  73. set score "&73v3? You bet" in sidebar of {_p} to 20
  74. set score "&b" in sidebar of {_p} to 10
  75.  
  76. function resetGameCore(minnum: number, maxnum: number):
  77. delete {games::*}
  78. set {games::properties} to true
  79. set {games::properties::maxqueue} to {_maxnum}
  80. set {games::properties::minqueue} to {_minnum}
  81. set {games::properties::basex} to 450000
  82. set {games::properties::basey} to 4
  83. set {games::properties::basez} to 0
  84.  
  85. set {games::maps} to true
  86.  
  87. set {games::maps::tdm2} to true
  88. set {games::maps::tdm2::a} to true
  89. set {games::maps::tdm2::b} to true
  90. set {games::maps::tdm2::a::xoff} to -9
  91. set {games::maps::tdm2::a::yoff} to 9
  92. set {games::maps::tdm2::a::zoff} to -42
  93. set {games::maps::tdm2::b::xoff} to -27
  94. set {games::maps::tdm2::b::yoff} to 9
  95. set {games::maps::tdm2::b::zoff} to -8
  96.  
  97. set {games::maps::tdm3} to true
  98. set {games::maps::tdm3::a} to true
  99. set {games::maps::tdm3::b} to true
  100. set {games::maps::tdm3::a::xoff} to -9
  101. set {games::maps::tdm3::a::yoff} to 8
  102. set {games::maps::tdm3::a::zoff} to -42
  103. set {games::maps::tdm3::b::xoff} to -27
  104. set {games::maps::tdm3::b::yoff} to 8
  105. set {games::maps::tdm3::b::zoff} to -8
  106.  
  107.  
  108. function initModes(gametype: text, amount: number):
  109. set {_start} to 1
  110. while {_start} <= {_amount}:
  111. set {games::match%{_start}%} to true
  112. set {games::match%{_start}%::type} to {_gametype}
  113. set {games::match%{_start}%::label} to {_start}
  114. set {games::match%{_start}%::state} to 0
  115.  
  116. set {games::match%{_start}%::queued} to true
  117. set {games::match%{_start}%::team1} to true
  118. set {games::match%{_start}%::team2} to true
  119. set {games::match%{_start}%::team1color} to "&c"
  120. set {games::match%{_start}%::team2color} to "&9"
  121. set {games::match%{_start}%::countdown} to -1
  122.  
  123. add 1 to {_start}
  124.  
  125. function singleSound(sound: text, p: player, pitch: number, volume: number):
  126. play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at location of {_p} for {_p}
  127.  
  128. function multiSound(sound: text, p: objects, pitch: number, volume: number):
  129. loop {_p::*}:
  130. play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at location of loop-value for loop-value
  131.  
  132.  
  133.  
  134. command /games:
  135. trigger:
  136. openQueueMenu(player)
  137.  
  138. function openQueueMenu(p: player):
  139. open virtual chest inventory with 6 rows named "&6Three &8- &eMatches" for {_p}
  140. set {_slot} to 10
  141. sortGreatToLow({_p}, {_slot})
  142.  
  143.  
  144. function sortGreatToLow(p: player, slot: number):
  145. set {_start} to 1
  146. loop {games::*}:
  147. if {games::%loop-index%::state} is set:
  148. set {_yeet} to size of {games::%loop-index%::queued::*}
  149. set {_great::%{_start}%::id} to {games::%loop-index%::label}
  150. set {_great::%{_start}%::theval} to {_yeet}
  151. set {_great::%{_start}%::state} to {games::%loop-index%::state}
  152. add 1 to {_start}
  153. set {_bubble} to size of {_great::*}
  154. while {_bubble} >= 1:
  155. set {_j} to 2
  156. while {_j} <= {_bubble}:
  157. set {_hmm} to {_j} - 1
  158. if {_great::%{_hmm}%::theval} > {_great::%{_j}%::theval}:
  159. set {_temp} to {_great::%{_hmm}%::theval}
  160. set {_temp2} to {_great::%{_hmm}%::id}
  161. set {_temp3} to {_great::%{_hmm}%::state}
  162. set {_great::%{_hmm}%::theval} to {_great::%{_j}%::theval}
  163. set {_great::%{_hmm}%::id} to {_great::%{_j}%::id}
  164. set {_great::%{_hmm}%::state} to {_great::%{_j}%::state}
  165. set {_great::%{_j}%::theval} to {_temp}
  166. set {_great::%{_j}%::id} to {_temp2}
  167. set {_great::%{_j}%::state} to {_temp3}
  168. add 1 to {_j}
  169. remove 1 from {_bubble}
  170. set {_init} to size of {_great::*}
  171. while {_init} >= 1:
  172. if {_great::%{_init}%::state} < 2:
  173. set {_itemp} to firework named "&6Match %{_great::%{_init}%::id}%" with lore "&7Players: &e%{_great::%{_init}%::theval}%/%{games::properties::maxqueue}% ||&7Status: &aOpen"
  174. else:
  175. set {_itemp} to firework named "&6Match %{_great::%{_init}%::id}%" with lore "&7Players: &e%{_great::%{_init}%::theval}%/%{games::properties::maxqueue}% ||&7Status: &cIngame"
  176. enchant {_itemp} with protection 1
  177. add "{HideFlags:63}" to {_itemp}'s item-nbt
  178. format gui slot {_slot} of {_p} with {_itemp} to close then run function queue({_p}, {_great::%{_init}%::id})
  179. add 1 to {_slot}
  180. if mod(({_slot} + 1), 9) = 0:
  181. add 2 to {_slot}
  182. remove 1 from {_init}
  183. set {_itemp} to diamond named "&6Join a match!"
  184. set line 1 of {_itemp}'s lore to "&7This will &aqueue &7you for the &emost popular match!"
  185. format gui slot 49 of {_p} with {_itemp} to close then run function queuePopular({_p})
  186.  
  187.  
  188. function queuePopular(p: player):
  189. set {_iter::val} to -1
  190. set {_iter::label} to 1
  191. loop {games::*}:
  192. if {games::%loop-index%::state} is set:
  193. if {games::%loop-index%::state} < 2:
  194. if size of {games::%loop-index%::queued::*} > {_iter::val}:
  195. set {_iter::val} to size of {games::%loop-index%::queued::*}
  196. set {_iter::label} to {games::%loop-index%::label}
  197. queue({_p}, {_iter::label})
  198.  
  199.  
  200. function queue(p: player, matchnum: number):
  201. if {games::match%{_matchnum}%::state} >= 2:
  202. send "&cThis match has already started!" to {_p}
  203. singleSound("entity.villager.no", {_p}, 1, 10)
  204. else:
  205. set {_max} to {games::properties::maxqueue}
  206. if size of {games::match%{_matchnum}%::queued::*} >= {_max}:
  207. send "&cThe queue is full!" to {_p}
  208. singleSound("entity.villager.no", {_p}, 1, 10)
  209. else:
  210. set {_currentcache} to {player::%{_p}%::ingame}
  211. if {_currentcache} = {_matchnum}:
  212. send "&cYou are already in this queue!" to {_p}
  213. singleSound("entity.villager.no", {_p}, 1, 10)
  214. else:
  215. removeFromAllQueues({_p})
  216. add {_p} to {games::match%{_matchnum}%::queued::*}
  217. set {player::%{_p}%::ingame} to {_matchnum}
  218. determineTeam({_p}, {_matchnum})
  219. generalReadyPlayer({_p})
  220. teleport {_p} to calculateOffsets({_matchnum}, -17.5, 30, -24.5, 90, 90, true)
  221. if size of {games::match%{_matchnum}%::queued::*} > 0:
  222. loop {games::match%{_matchnum}%::queued::*}:
  223. send "&e%{_p}% &7has joined the queue &8(&e%size of {games::match%{_matchnum}%::queued::*}%/%{games::properties::maxqueue}%&8)" to loop-value
  224. singleSound("entity.player.levelup", loop-value, 1, 10)
  225. if {games::match%{_matchnum}%::state} = 0:
  226. pingQueue({_matchnum})
  227.  
  228.  
  229. function determineTeam(p: player, matchnum: number):
  230. set {_size1} to size of {games::match%{_matchnum}%::team1::*}
  231. set {_size2} to size of {games::match%{_matchnum}%::team2::*}
  232. if {_size1} <= {_size2}:
  233. add {_p} to {games::match%{_matchnum}%::team1::*}
  234. set {_p} tab name to "%{games::match%{_matchnum}%::team1color}%%{_p}%"
  235. else:
  236. add {_p} to {games::match%{_matchnum}%::team2::*}
  237. set {_p} tab name to "%{games::match%{_matchnum}%::team2color}%%{_p}%"
  238.  
  239. function calculateOffsets(matchnum: number, dx: number, dy: number, dz: number, yawd: number, pitchd: number, rot: boolean) :: location:
  240. remove 1 from {_matchnum}
  241.  
  242. set {_x} to {games::properties::basex}
  243. set {_y} to {games::properties::basey}
  244. set {_z} to {games::properties::basez}
  245.  
  246. set {_matchnum} to {_matchnum} * 100
  247. add {_matchnum} to {_x}
  248.  
  249. add {_dx} to {_x}
  250. add {_dy} to {_y}
  251. add {_dz} to {_z}
  252.  
  253. set {_yeet} to location ({_x}, {_y}, {_z}) in world "ul_void"
  254. if {_rot} is true:
  255. set {_yeet}'s yaw to {_yawd}
  256. set {_yeet}'s pitch to {_pitchd}
  257. return {_yeet}
  258.  
  259.  
  260.  
  261. function pingQueue(matchnum: number):
  262. if {games::match%{_matchnum}%::state} = 0:
  263. if size of {games::match%{_matchnum}%::queued::*} >= {games::properties::minqueue}:
  264. set {games::match%{_matchnum}%::state} to 1
  265. startCountdown({_matchnum}, 20)
  266.  
  267. function startCountdown(matchnum: number, times: number):
  268. set {games::match%{_matchnum}%::countdown} to {_times}
  269. loop {_times} times:
  270. remove 1 from {games::match%{_matchnum}%::countdown}
  271. wait 1 second
  272. if size of {games::match%{_matchnum}%::queued::*} < {games::properties::minqueue}:
  273. loop {games::match%{_matchnum}%::queued::*}:
  274. send "&cThere was not enough people to start the game." to loop-value
  275. singleSound("entity.villager.no", loop-value, 1, 10)
  276. set {games::match%{_matchnum}%::state} to 0
  277. else:
  278. set {games::match%{_matchnum}%::state} to 2
  279. loop {games::match%{_matchnum}%::queued::*}:
  280. send "&eGame &7will now &abegin!" to loop-value
  281. singleSound("entity.player.levelup", loop-value, 1, 10)
  282. resetMap({_matchnum})
  283.  
  284. function resetMap(matchnum: number):
  285. set {_map} to 3
  286. set {_placeloc} to calculateOffsets({_matchnum}, -29, 4, -45, -1, -1, false)
  287. set {_x} to the x-coordinate of {_placeloc}
  288. set {_y} to the y-coordinate of {_placeloc}
  289. set {_z} to the z-coordinate of {_placeloc}
  290.  
  291. set {_locfill} to calculateOffsets({_matchnum}, -34, -4, -49, -1, -1, false)
  292. set {_x1} to the x-coordinate of {_locfill}
  293. set {_y1} to the y-coordinate of {_locfill}
  294. set {_z1} to the z-coordinate of {_locfill}
  295.  
  296. set {_locfill2} to calculateOffsets({_matchnum}, -2, 13, -1, -1, -1, false)
  297. set {_x2} to the x-coordinate of {_locfill2}
  298. set {_y2} to the y-coordinate of {_locfill2}
  299. set {_z2} to the z-coordinate of {_locfill2}
  300.  
  301. console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ fill %{_x1}% %{_y1}% %{_z1}% %{_x2}% %{_y2}% %{_z2}% air"
  302. add 14 to {_y2}
  303. add 18 to {_y1}
  304. console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ fill %{_x1}% %{_y1}% %{_z1}% %{_x2}% %{_y2}% %{_z2}% air"
  305. wait 2 ticks
  306. console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ setblock %{_x}% %{_y}% %{_z}% structure_block 0 0 {metadata:"""",mirror:""NONE"",ignoreEntities:1b,powered:0b,seed:0L,author:""ThatOneTqnk"",rotation:""NONE"",posX:0,mode:""LOAD"",posY:0,sizeX:23,posZ:1,integrity:1.0f,showair:0b,x:449971,name:""TDM%{_map}%-1"",y:4,z:-45,id:""minecraft:structure_block"",sizeY:10,sizeZ:32,showboundingbox:1b}"
  307. remove 1 from {_y}
  308. console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ setblock %{_x}% %{_y}% %{_z}% redstone_block 0 0"
  309. wait 2 ticks
  310. console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ fill %{_x}% %{_y}% %{_z}% %{_x}% %({_y} + 1)% %{_z}% air"
  311. wait 3 seconds
  312. set {games::match%{_matchnum}%::state} to 3
  313. set {_team1} to calculateOffsets({_matchnum}, {games::maps::tdm%{_map}%::a::xoff}, {games::maps::tdm%{_map}%::a::yoff}, {games::maps::tdm%{_map}%::a::zoff}, 0.001, 0.001, true)
  314. set {_team2} to calculateOffsets({_matchnum}, {games::maps::tdm%{_map}%::b::xoff}, {games::maps::tdm%{_map}%::b::yoff}, {games::maps::tdm%{_map}%::b::zoff}, 180, 0.001, true)
  315. loop {games::match%{_matchnum}%::queued::*}:
  316. getCommonKit(loop-value)
  317. loop {games::match%{_matchnum}%::team1::*}:
  318. teleport loop-value to {_team1}
  319. getArmor({games::match%{_matchnum}%::team1::*}, convertColorCode({games::match%{_matchnum}%::team1color}))
  320. loop {games::match%{_matchnum}%::team2::*}:
  321. teleport loop-value to {_team2}
  322. getArmor({games::match%{_matchnum}%::team2::*}, convertColorCode({games::match%{_matchnum}%::team2color}))
  323.  
  324.  
  325. function getCommonKit(person: player):
  326. clear the inventory of {_person}
  327. give 1 stone sword to {_person}
  328. give 1 bow to {_person}
  329. give 8 arrows to {_person}
  330. give 1 golden apple to {_person}
  331. give 32 oak planks to {_person}
  332. set {_person}'s gamemode to survival
  333.  
  334. function getArmor(people: objects, thedye: color):
  335. loop {_people::*}:
  336. if loop-value is online:
  337. equip loop-value with all leather armour
  338. dye loop-value's helmet {_thedye}
  339. dye loop-value's chestplate {_thedye}
  340. dye loop-value's leggings {_thedye}
  341. dye loop-value's boots {_thedye}
  342.  
  343. command /leave:
  344. trigger:
  345. set {_currentcache} to {player::%player%::ingame}
  346. if {_currentcache} > 0:
  347. set {_feedback} to "&7You were removed from the queue."
  348. teleport player to {spawn}
  349. else:
  350. set {_feedback} to "&cYou are not queued."
  351. removeFromAllQueues(player)
  352. resetPlayerData(player)
  353. send {_feedback}
  354.  
  355. function removeFromAllQueues(p: player):
  356. set {player::%{_p}%::ingame} to -1
  357. loop {games::*}:
  358. if {games::%loop-index%::queued::*} contains {_p}:
  359. remove {_p} from {games::%loop-index%::queued::*}
  360. remove {_p} from {games::%loop-index%::team1::*}
  361. remove {_p} from {games::%loop-index%::team2::*}
  362. teamCheck({games::%loop-index%::label})
  363. if {games::%loop-index%::state} < 2:
  364. loop {games::%loop-index%::queued::*}:
  365. send "&a%{_p}% &7has left the queue &8(&e%size of {games::%loop-index-1%::queued::*}%/%{games::properties::maxqueue}%&8)" to loop-value-2
  366.  
  367. on death:
  368. if {player::%player%::ingame} > 0:
  369. removeFromAllQueues(player)
  370. generalReadyPlayer(player)
  371. resetPlayerData(player)
  372.  
  373. on respawn:
  374. teleport player to {spawn}
  375.  
  376. function teamCheck(matchnum: number):
  377. if {games::match%{_matchnum}%::state} >= 3:
  378. if size of {games::match%{_matchnum}%::team1::*} = 0:
  379. set {_char} to "2"
  380. else if size of {games::match%{_matchnum}%::team2::*} = 0:
  381. set {_char} to "1"
  382. if {_char} is set:
  383. loop {games::match%{_matchnum}%::queued::*}:
  384. send "&6%{games::match%{_matchnum}%::team%{_char}%::*}% &7has won the match!" to loop-value
  385. singleSound("entity.player.levelup", loop-value, 1, 10)
  386. endGame({_matchnum})
  387.  
  388. function endGame(matchnum: number):
  389. loop {games::match%{_matchnum}%::queued::*}:
  390. generalReadyPlayer(loop-value)
  391. teleport loop-value to {spawn}
  392. removeFromAllQueues(loop-value)
  393. resetPlayerData(loop-value)
  394. set {games::match%{_matchnum}%::state} to 0
  395.  
  396. function convertColorCode(thecolor: text) :: color:
  397. if {_thecolor} is "&c":
  398. return red
  399. else if {_thecolor} is "&9":
  400. return blue
  401. else if {_thecolor} is "&a":
  402. return green
  403. else if {_thecolor} is "&e":
  404. return yellow
  405. else if {_thecolor} is "&6":
  406. return orange
  407. else:
  408. return white
  409.  
  410. every 1 second:
  411. loop all players:
  412. if {player::%loop-player%::ingame} > 0:
  413. set {_matchnum} to {player::%loop-player%::ingame}
  414. wipe loop-player's sidebar
  415. set name of sidebar of loop-player to "&6&lTHREE"
  416. set score "&e&nGame %{_matchnum}%" in sidebar of loop-player to 30
  417. set score "&o" in sidebar of loop-player to 29
  418. set {_currentstate} to {games::match%{_matchnum}%::state}
  419. if {_currentstate} = 0:
  420. set score "&7Waiting:" in sidebar of loop-player to 28
  421. set score "&e%size of {games::match%{_matchnum}%::queued::*}%/&e%{games::properties::minqueue}% players" in sidebar of loop-player to 27
  422. else if {_currentstate} = 1:
  423. if {games::match%{_matchnum}%::countdown} > 0:
  424. set {_postfix} to "s"
  425. if {games::match%{_matchnum}%::countdown} = 1:
  426. set {_postfix} to ""
  427. set score "&7Starting:" in sidebar of loop-player to 28
  428. set score "&e%{games::match%{_matchnum}%::countdown}% &esecond%{_postfix}%" in sidebar of loop-player to 27
  429. if mod({games::match%{_matchnum}%::countdown}, 5) = 0:
  430. singleSound("ui.button.click", loop-player, 1, 10)
  431. else if {_currentstate} is 3:
  432. set score "&6Three &8» &e3v3 PvP" in sidebar of loop-player to 28
  433. else if {_currentstate} is 2:
  434. set score "&cMap resetting..." in sidebar of loop-player to 28
  435. set score "&2" in sidebar of loop-player to 26
  436. set {_num} to 25
  437. set score "&7Team 1:" in sidebar of loop-player to {_num}
  438. loop {games::match%{_matchnum}%::team1::*}:
  439. remove 1 from {_num}
  440. set score "%{games::match%{_matchnum}%::team1color}%%loop-value-2%" in sidebar of loop-value-1 to {_num}
  441. remove 1 from {_num}
  442. set score "&3" in sidebar of loop-player to {_num}
  443. remove 1 from {_num}
  444. set score "&7Team 2:" in sidebar of loop-player to {_num}
  445. loop {games::match%{_matchnum}%::team2::*}:
  446. remove 1 from {_num}
  447. set score "%{games::match%{_matchnum}%::team2color}%%loop-value-2%" in sidebar of loop-value-1 to {_num}
  448. remove 1 from {_num}
  449. set score "&c" in sidebar of loop-player to {_num}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement