Advertisement
mmmm123m

Untitled

Jan 31st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. owner = "Mmmm123" -- replace with your username
  2.  
  3. interval = 10
  4. cannonInfo = {}
  5. difficulty = 8
  6.  
  7. maps = {7370927,7370942,7370944}
  8.  
  9. function main()
  10. tfm.exec.disableAutoNewGame(true)
  11. tfm.exec.disableAutoShaman(true)
  12. tfm.exec.disableAutoTimeLeft(true)
  13. tfm.exec.newGame(maps[math.random(#maps)])
  14. end
  15.  
  16. function eventNewGame()
  17. interval = 10
  18. end
  19.  
  20. function eventNewPlayer(name)
  21. end
  22.  
  23. function eventTextAreaCallback(id, name, cb)
  24. if (owner==name or owner=="nobody") and interval > 6 then
  25.  
  26. end
  27. end
  28.  
  29. function eventLoop(time, remaining)
  30. if time>3000 then
  31. interval = interval - 1
  32. if interval == difficulty then
  33. ui.removeTextArea(4)
  34. local users = {}
  35. for name,p in pairs(tfm.get.room.playerList) do
  36. if not p.isDead then
  37. users[#users+1] = name
  38. end
  39. end
  40. cannonInfo = spawnCannon(users[math.random(#users)])
  41. interval = 11
  42. elseif interval<=5 then
  43. if interval == 0 then
  44. tfm.exec.newGame(maps[math.random(#maps)])
  45. end
  46. elseif interval == 10 then
  47. tfm.exec.addShamanObject(17, cannonInfo[1], cannonInfo[2], cannonInfo[3]-90)
  48. cannonInfo={}
  49. end
  50. end
  51. if remaining<=0 then
  52. ui.addTextArea(4, "<VP><p align='center'><B>CONGRATULATIONS</B>\n\n<CH><i>you beat the CPU!", nil, 290, 22, 180, nil, 0x000001, 0xCA0805, 0.8)
  53. tfm.exec.newGame(maps[math.random(#maps)])
  54. end
  55. end
  56.  
  57. function eventPlayerDied(name)
  58. if playerCount() < 1 then
  59. interval = 6
  60. end
  61. end
  62.  
  63. function playerCount()
  64. local n=0
  65. for name, player in pairs(tfm.get.room.playerList) do
  66. if not player.isDead then
  67. n=n+1
  68. end
  69. end
  70. return n
  71. end
  72.  
  73. function spawnCannon(name)
  74. local info = {}
  75. local px = tfm.get.room.playerList[name].x
  76. local py = tfm.get.room.playerList[name].y
  77. local cnnx = math.random()*800
  78. local cnny = math.random()*400
  79. if cnny > py then
  80. cnny = py-math.random(50)-20
  81. end
  82. if math.abs(cnnx-px) > 300 then
  83. cnnx = px + math.random(-50, 50)
  84. end
  85. local ang = math.deg(math.atan2(cnny-py, cnnx-px))
  86. tfm.exec.addShamanObject(0, cnnx, cnny, ang+90)
  87. info[1] = cnnx
  88. info[2] = cnny
  89. info[3] = ang
  90. return info
  91. end
  92.  
  93. for name in pairs(tfm.get.room.playerList) do
  94. eventNewPlayer(name)
  95. end
  96.  
  97. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement