Advertisement
Boeing747-8

Untitled

Aug 8th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.04 KB | None | 0 0
  1. tfm.exec.setGameTime(3,true)
  2. roles={0,1}
  3. maps={7489629}
  4. data={}
  5. text={}
  6. lang={}
  7. players={}
  8. alive=0
  9. lang.en={
  10. menu="Menu",
  11. profile2="Profile",
  12. help2="Help",
  13. help="In #bombdeliver the goal of the game is for protectors to catch the mouse with the bomb before the mouse gets to the hole. The mouse with the bomb can use attacks to shield off protectors.",
  14. wins="Total Wins",
  15. wins_Bomber="Wins As Bomber",
  16. wins_Protector="Wins As Protector",
  17. close="Close",
  18. health=100,
  19. bomber_Wins="Bomber Wins!",
  20. protector_Wins="Protectors Win!",
  21. powerups2="Powerups",
  22. powerup1="[Normal Attack]</J> Is activated by pressing space. Only works for Protectors when they are near the bomber, but works for Bombers at any time.",
  23. powerup2="[Mega Jump]</J> Is activated by the down arrow."
  24. }
  25. for _, s in next, {'AutoTimeLeft', 'PhysicalConsumables', 'AfkDeath', 'AutoShaman', 'AutoNewGame'} do
  26. tfm.exec['disable' .. s]()
  27. end
  28. function particles(x,y)
  29. tfm.exec.displayParticle(9,x,y+10,-0.4,0.1,0.2,0.3,nil)
  30. tfm.exec.displayParticle(9,x,y+10,-0.6,0.2,0.6,0.2,nil)
  31. tfm.exec.displayParticle(9,x,y+10,-0.8,0.3,0.8,0.1,nil)
  32. tfm.exec.displayParticle(9,x,y+10,0.4,0.4,-0.4,0.3,nil)
  33. tfm.exec.displayParticle(9,x,y+10,0.6,0.5,-0.6,0.2,nil)
  34. tfm.exec.displayParticle(9,x,y+10,0.8,0.6,-0.8,0.1,nil)
  35. end
  36. function bigJump(n,x,y)
  37. tfm.exec.movePlayer(n,0,0,false,0,-80,true)
  38. tfm.exec.displayParticle(3,x-5,y+10,-0.8,0,0,0,n)
  39. tfm.exec.displayParticle(3,x+5,y+10,0.8,0,0,0,n)
  40. tfm.exec.displayParticle(3,x-10,y+10,-1.7,0,0,0,n)
  41. tfm.exec.displayParticle(3,x+10,y+10,1.7,0,0,0,n)
  42. particles(x,y)
  43. end
  44. function identifyBomber(n)
  45. if data[n].role==0 then
  46. tfm.exec.setNameColor(n,0x00FF00)
  47. tfm.exec.movePlayer(n,1023,432,false,0,50,false)
  48. elseif data[n].role==1 then
  49. tfm.exec.setNameColor(n,0xFF0000)
  50. end
  51. end
  52. function countAlive()
  53. alive=0
  54. for n,player in pairs(tfm.get.room.playerList) do
  55. if tfm.get.room.playerList[n].isDead==false then
  56. alive=alive+1
  57. end
  58. end
  59. end
  60. function removeWinner()
  61. ui.removeTextArea(20,nil)
  62. ui.removeTextArea(30,nil)
  63. ui.removeTextArea(40,nil)
  64. ui.removeTextArea(50,nil)
  65. ui.removeTextArea(60,nil)
  66. ui.removeTextArea(19,nil)
  67. end
  68.  
  69. function win(n)
  70. if tfm.get.room.playerList[n].isDead==false and data[n].role==0 then
  71. data[n].wins=data[n].wins+1
  72. data[n].wins_Protector=data[n].wins_Protector+1
  73. end
  74. end
  75. function insertName(n)
  76. table.insert(players,n)
  77. end
  78. function setLang(n)
  79. text[n]=lang[tfm.get.room.playerList[n].community] or lang.en
  80. end
  81. function setData(n)
  82. data[n]=
  83. {
  84. wins=0,
  85. role=0,
  86. health=100,
  87. spawn=1,
  88. wins_Protector=0,
  89. wins_Bomber=0
  90. }
  91. end
  92. function chooseRole()
  93. for n,player in pairs(tfm.get.room.playerList) do
  94. data[n].role=0
  95. end
  96. player=players[math.random(#players)]
  97. data[player].role=1
  98. player=""..player
  99. end
  100. function bindKeyboard(n)
  101. for i=0,100 do
  102. tfm.exec.bindKeyboard(n,i,true,true)
  103. end
  104. end
  105. function showMenu(n)
  106. ui.addTextArea(0, "<p align='center'><font face='calibri'><a href='event:menu2'>"..text[n].menu, n, 10, 30, 42, 20, 0x000001, 0xFFFFFF, 1, true)
  107. end
  108. function showMenu2(n)
  109. ui.addTextArea(0, "<p align='center'><font face='calibri'><a href='event:Menu'>"..text[n].menu.." </a>| <a href='event:Help'>"..text[n].help2.."</a> | <a href='event:Profile'>"..text[n].profile2.."</a> | <a href='event:Powerups'>"..text[n].powerups2, n, 10, 30, 190, 20, 0x000001, 0xffffff, 1, true)
  110. end
  111. function showHealth(n)
  112. ui.addTextArea(-3, "", n, 319, 27, 100, 18, 0xffffff, 0xffffff, 1, true)
  113. ui.addTextArea(-1, "", n, 319, 27, data[n].health, 18, 0x1aff00, 0x1aff00, 1, true)
  114. ui.addTextArea(-2, "<p align='center'><b><font color='#000000'>"..data[n].health.."%", n, 345, 27, 54, 18, 0x324650, 0x000000, 0, true)
  115. end
  116. function displayTab(n,info,subject)
  117. ui.addTextArea(2, "", n, 262, 72, 360, 290, 0x331f15, 0x331f15, 1, true)
  118. ui.addTextArea(3, "", n, 262, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  119. ui.addTextArea(5, "", n, 295, 72, 290, 4, 0x6b4231, 0x6b4231, 1, true)
  120. ui.addTextArea(4, "", n, 618, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  121. ui.addTextArea(6, "", n, 295, 358, 295, 4, 0x6b4231, 0x6b4231, 1, true)
  122. ui.addTextArea(1, "<p align='center'><font face='calibri'><font size='17'><b>#BOMBDELIVER - "..subject.."</b></font></font><font size='14'>\n\n"..info, n, 271, 80, 342, 270, 0x1b262b, 0x131c21, 1, true)
  123. ui.addTextArea(7, "<p align='center'><font size='13'><a href='event:close'>"..text[n].close.."</a></font>", n, 272, 330, 339, 20, 0x324650, 0x324650, 1, true)
  124. end
  125. function profile(n,info)
  126. ui.addTextArea(2, "", n, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  127. ui.addTextArea(3, "", n, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  128. ui.addTextArea(5, "", n, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  129. ui.addTextArea(4, "", n, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  130. ui.addTextArea(6, "", n, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  131. ui.addTextArea(1, "<p align='center'><font face='calibri'><font size='17'><b>"..n.."</b></font></font></p><font size='14'>\n<font face='calibri'>\n"..info, n, 270, 82, 252, 270, 0x1b262b, 0x131c21, 1, true)
  132. ui.addTextArea(7, "<p align='center'><font size='13'><a href='event:close'>"..text[n].close.."</a></font>", n, 272, 330, 248, 20, 0x324650, 0x324650, 1, true)
  133. end
  134. function close(n)
  135. for i=1,7 do
  136. ui.removeTextArea(i,n)
  137. end
  138. end
  139. function nearBomber(n,x,y,p)
  140. if ((tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x+130 and tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x) and tfm.get.room.playerList[n].y<tfm.get.room.playerList[p].y+50 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-50) and not (n==p) and data[p].health>0 and tfm.get.room.playerList[n].isFacingRight==true then
  141. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  142. data[p].health=data[p].health-12.5
  143. tfm.exec.displayParticle(1,x,y,0.2,0,0.2,0,nil)
  144. tfm.exec.displayParticle(1,x,y,0.4,0,0.4,0,nil)
  145. tfm.exec.displayParticle(1,x,y,0.6,0,0.6,0,nil)
  146. tfm.exec.displayParticle(1,x,y,0.8,0,0.8,0,nil)
  147. tfm.exec.displayParticle(1,x,y,1,0,1,0,nil)
  148. tfm.exec.displayParticle(1,x,y-10,0.2,0,0.2,0,nil)
  149. tfm.exec.displayParticle(1,x,y-10,0.4,0,0.4,0,nil)
  150. tfm.exec.displayParticle(1,x,y-10,0.6,0,0.6,0,nil)
  151. tfm.exec.displayParticle(1,x,y-10,0.8,0,0.8,0,nil)
  152. tfm.exec.displayParticle(1,x,y-10,1,0,1,0,nil)
  153. tfm.exec.displayParticle(1,x,y+10,0.2,0,0.2,0,nil)
  154. tfm.exec.displayParticle(1,x,y+10,0.4,0,0.4,0,nli)
  155. tfm.exec.displayParticle(1,x,y+10,0.6,0,0.6,0,nil)
  156. tfm.exec.displayParticle(1,x,y+10,0.8,0,0.8,0,nil)
  157. tfm.exec.displayParticle(1,x,y+10,1,0,1,0,nil)
  158. end
  159. if ((tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x-130 and tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x) and tfm.get.room.playerList[n].y<tfm.get.room.playerList[p].y+50 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-50) and not (n==p) and data[p].health>0 and tfm.get.room.playerList[n].isFacingRight==false then
  160. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  161. data[p].health=data[p].health-12.5
  162. tfm.exec.displayParticle(1,x,y,-0.2,0,-0.2,0,nil)
  163. tfm.exec.displayParticle(1,x,y,-0.4,0,-0.4,0,nil)
  164. tfm.exec.displayParticle(1,x,y,-0.6,0,-0.6,0,nil)
  165. tfm.exec.displayParticle(1,x,y,-0.8,0,-0.8,0,nil)
  166. tfm.exec.displayParticle(1,x,y,-1,0,-1,0,nil)
  167. tfm.exec.displayParticle(1,x,y-10,-0.2,0,-0.2,0,nil)
  168. tfm.exec.displayParticle(1,x,y-10,-0.4,0,-0.4,0,nil)
  169. tfm.exec.displayParticle(1,x,y-10,-0.6,0,-0.6,0,nil)
  170. tfm.exec.displayParticle(1,x,y-10,-0.8,0,-0.8,0,nil)
  171. tfm.exec.displayParticle(1,x,y-10,-1,0,-1,0,nil)
  172. tfm.exec.displayParticle(1,x,y+10,-0.2,0,-0.2,0,nil)
  173. tfm.exec.displayParticle(1,x,y+10,-0.4,0,-0.4,0,nli)
  174. tfm.exec.displayParticle(1,x,y+10,-0.6,0,-0.6,0,nil)
  175. tfm.exec.displayParticle(1,x,y+10,-0.8,0,-0.8,0,nil)
  176. tfm.exec.displayParticle(1,x,y+10,-1,0,-1,0,nil)
  177. end
  178. if data[p].health<1 then
  179. tfm.exec.killPlayer(p)
  180. end
  181. end
  182. operation={-110,110}
  183. function nearProtector(n,p,x,y)
  184. if not (n==p) and data[p].health>0 and data[n].health>0 then
  185. tfm.exec.displayParticle(13,x,y,-0.2,0.1,-0.2,0.1,nil)
  186. tfm.exec.displayParticle(13,x,y,-0.4,0,-0.4,0,nil)
  187. tfm.exec.displayParticle(13,x,y,-0.6,0,-0.6,0,nil)
  188. tfm.exec.displayParticle(3,x,y,-0.8,0,-0.8,0,nil)
  189. tfm.exec.displayParticle(3,x,y,-8,0,-1,0,nil)
  190. tfm.exec.displayParticle(3,x,y-10,-0.2,0.1,-0.2,0.1,nil)
  191. tfm.exec.displayParticle(13,x,y-10,-0.4,0,-0.4,0,nil)
  192. tfm.exec.displayParticle(13,x,y-10,-0.6,0,-0.6,0,nil)
  193. tfm.exec.displayParticle(13,x,y-10,-0.8,0,-0.8,0,nil)
  194. tfm.exec.displayParticle(13,x,y-10,-1,0,-1,0,nil)
  195. tfm.exec.displayParticle(13,x,y+10,-0.2,0.1,-0.2,0.1,nil)
  196. tfm.exec.displayParticle(13,x,y+10,-0.4,0,-0.4,0,nli)
  197. tfm.exec.displayParticle(13,x,y+10,-0.6,0,-0.6,0,nil)
  198. tfm.exec.displayParticle(13,x,y+10,-0.8,-0.1,-0.8,-0.1,nil)
  199. tfm.exec.displayParticle(13,x,y+10,-1,0,-1,0,nil)
  200. tfm.exec.displayParticle(13,x,y,0.2,0,0.2,0,nil)
  201. tfm.exec.displayParticle(13,x,y,0.4,0,0.4,0,nil)
  202. tfm.exec.displayParticle(13,x,y,0.6,0,0.6,0,nil)
  203. tfm.exec.displayParticle(13,x,y,0.8,0,0.8,0,nil)
  204. tfm.exec.displayParticle(13,x,y,1,0,1,0,nil)
  205. tfm.exec.displayParticle(13,x,y-10,0.2,0.1,0.2,0.1,nil)
  206. tfm.exec.displayParticle(13,x,y-10,0.4,0,0.4,0,nil)
  207. tfm.exec.displayParticle(13,x,y-10,0.6,0,0.6,0,nil)
  208. tfm.exec.displayParticle(13,x,y-10,0.8,0,0.8,0,nil)
  209. tfm.exec.displayParticle(13,x,y-10,1,0,1,0,nil)
  210. tfm.exec.displayParticle(13,x,y+10,0.2,0,0.2,0,nil)
  211. tfm.exec.displayParticle(13,x,y+10,0.4,0,0.4,0,nli)
  212. tfm.exec.displayParticle(13,x,y+10,0.6,0,0.6,0,nil)
  213. tfm.exec.displayParticle(3,x,y+10,0.8,0,0.8,0,nil)
  214. tfm.exec.displayParticle(3,x,y+10,8,0,1,0,nil)
  215. end
  216. if (tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x+50 and tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x-50 and tfm.get.room.playerList[n].y<tfm.get.room.playerList[p].y+30 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-30) and not (n==p) and data[p].health>0 and data[n].health>0 then
  217. data[n].health=data[n].health-10
  218. tfm.exec.movePlayer(n,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  219. end
  220. if data[n].health<1 then
  221. tfm.exec.killPlayer(n)
  222. end
  223. end
  224.  
  225. for n,player in pairs(tfm.get.room.playerList) do
  226. bindKeyboard(n)
  227. setLang(n)
  228. insertName(n)
  229. setData(n)
  230. showMenu(n)
  231. end
  232. chooseRole()
  233. for n,player in pairs(tfm.get.room.playerList) do
  234. identifyBomber(n)
  235. end
  236. function allInfo(n)
  237. bindKeyboard(n)
  238. setLang(n)
  239. insertName(n)
  240. setData(n)
  241. showMenu(n)
  242. identifyBomber(n)
  243. end
  244. function eventNewGame()
  245. players={}
  246. for n,player in pairs(tfm.get.room.playerList) do
  247. insertName(n)
  248. end
  249. chooseRole()
  250. countAlive()
  251. removeWinner()
  252. for n,player in pairs(tfm.get.room.playerList) do
  253. identifyBomber(n)
  254. data[n].health=100
  255. end
  256. end
  257. function eventTextAreaCallback(txt, n, a)
  258. if a=="Menu" then
  259. showMenu(n)
  260. elseif a=="menu2" then
  261. showMenu2(n)
  262. elseif a=="Help" then
  263. displayTab(n,text[n].help,text[n].help2)
  264. elseif a=="close" then
  265. close(n)
  266. elseif a=="Profile" then
  267. profile(n,text[n].wins..": <J>"..data[n].wins.."\n\n</J>"..text[n].wins_Bomber..": <J>"..data[n].wins_Bomber.."\n\n</J>"..text[n].wins_Protector..": <J>"..data[n].wins_Protector)
  268. elseif a=="Powerups" then
  269. displayTab(n,"<J>"..text[n].powerup1.."\n\n<J>"..text[n].powerup2,text[n].powerups2)
  270. end
  271. end
  272. function eventNewPlayer(n)
  273. allInfo(n)
  274. end
  275. function eventLoop(time,timeRemaining)
  276. for n,player in pairs(tfm.get.room.playerList) do
  277. data[n].spawn=data[n].spawn+0.5
  278. showHealth(n)
  279. end
  280. if timeRemaining<=0 then
  281. tfm.exec.newGame(maps[math.random(#maps)])
  282. end
  283. end
  284.  
  285. function eventKeyboard(n, k, d, x, y)
  286. if k==32 and data[n].role==0 and data[n].spawn>0 then
  287. nearBomber(n,x,y,player)
  288. data[n].spawn=-1
  289. elseif k==32 and data[n].role==1 and data[n].spawn>0 then
  290. data[n].spawn=-1.5
  291. player=player
  292. for n in pairs(tfm.get.room.playerList) do
  293. nearProtector(n,player,tfm.get.room.playerList[player].x,tfm.get.room.playerList[player].y)
  294. end
  295. elseif k==3 and data[n].spawn>0 then
  296. data[n].spawn=-2
  297. player=player
  298. bigJump(n,x,y)
  299. end
  300. end
  301. function eventPlayerDied(n)
  302. for n,player in pairs(tfm.get.room.playerList) do
  303. win(n)
  304. end
  305. countAlive()
  306. data[n].health=0
  307. if data[n].role==1 then
  308. for n,player in pairs(tfm.get.room.playerList) do
  309. ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
  310. ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  311. ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  312. ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  313. ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  314. ui.addTextArea(19, "<p align='center'><font size='20'><VP>"..text[n].protector_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
  315. tfm.exec.setGameTime(5,true)
  316. end
  317. end
  318. end
  319.  
  320. function eventMouse(playerName,x,y)
  321. print("<VP>X</VP><N>:</N><J> "..x.."</J><VP> Y</VP><N>:</N><J> "..y)
  322. end
  323. system.bindMouse("Fuzzyfirsdog#0000", true)
  324. function eventPlayerGetCheese(n)
  325. for n,player in pairs(tfm.get.room.playerList) do
  326. win(n)
  327. end
  328. if data[n].role==1 then
  329. data[n].wins=data[n].wins+1
  330. data[n].wins_Bomber=data[n].wins_Bomber+1
  331. tfm.exec.setGameTime(10,true)
  332. for n,player in pairs(tfm.get.room.playerList) do
  333. ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
  334. ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  335. ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  336. ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  337. ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  338. ui.addTextArea(19, "<p align='center'><font size='20'><R>"..text[n].bomber_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
  339. if not (data[n].role==1) then
  340. tfm.exec.killPlayer(n)
  341. end
  342. end
  343. end
  344. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement