Bloonshack

[Tfm] Inverno (INCOMPLETO)

Aug 25th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. -- Crido por Bloonshack
  2. -- Vamp inverno
  3. -- 25/08/17
  4.  
  5. -- Mapas e inicio
  6.  
  7.  
  8. tfm.exec.disableAutoNewGame(true)
  9. tfm.exec.disableAutoShaman(true)
  10. players={}
  11. toDespawn={}
  12. maps={[[0]],[[1]],[[2]],[[3]],[[4]],[[5]],[[6]],[[7]],[[8]],[[9]],[[10]],[[11]],[[12]],[[13]],[[14]],[[15]],[[16]],[[17]],[[18]],[[19]],[[20]],[[21]],[[22]],[[23]],[[24]],[[25]],[[26]],[[27]],[[28]],[[29]],[[30]],[[31]],[[32]],[[33]],[[34]],[[35]],[[36]],[[37]],[[38]],[[39]],[[40]],[[41]],[[42]],[[43]],[[44]],[[45]],[[46]],[[47]],[[48]],[[49]],[[50]],[[51]],[[52]],[[53]],[[54]],[[55]],[[56]],[[57]],[[58]],[[59]],[[60]],[[61]],[[62]],[[63]],[[64]],[[65]],[[66]],[[67]],[[68]],[[69]],[[70]],[[71]],[[72]],[[73]],[[74]],[[75]],[[76]],[[77]],[[79]],[[80]],[[81]],[[82]],[[83]],[[84]],[[85]],[[86]],[[87]],[[88]],[[89]],[[90]],[[91]],[[92]],[[93]],[[94]],[[95]],[[96]],[[97]],[[98]],[[99]],[[100]],[[101]],[[102]],[[103]],[[104]],[[105]],[[106]],[[107]],[[115]],[[116]],[[117]],[[118]],[[119]],[[120]],[[121]],[[122]],[[123]],[[124]],[[125]],[[126]],[[127]],[[128]],[[129]],[[130]],[[131]]}
  13.  
  14. function eventNewPlayer(name)
  15. for i,key in ipairs({32,40,83}) do
  16. tfm.exec.bindKeyboard(name,key,true,true)
  17. end
  18. players[name]={
  19. timestamp=os.time(),
  20. offsets={x=2, y=10}
  21. }
  22. end
  23. conjurar={[[1]],[[2]],[[10]],[[17]],[[23]],[[24]],[[28]],[[33]],[[34]],[[35]],[[39]],[[40]],[[54]],[[57]],[[59]],[[65]],[[68]],[[70]],[[85]],[[89]],[[90]],[[95]],[[96]],[[97]],[[2814]]}
  24. function eventKeyboard(name,key,down,x,y)
  25. if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started then
  26. if players[name].timestamp < os.time()-600 then
  27. local id
  28. if tfm.get.room.playerList[name].isFacingRight then
  29. id=tfm.exec.addShamanObject(conjurar[math.random(#conjurar)],x+players[name].offsets.x,y+players[name].offsets.y,0,20,0)
  30. else
  31. id=tfm.exec.addShamanObject(conjurar[math.random(#conjurar)],x+players[name].offsets.x,y+players[name].offsets.y,0,-20,0)
  32. end
  33. players[name].timestamp=os.time()
  34. table.insert(toDespawn,{os.time(),id})
  35. end
  36. end
  37. end
  38.  
  39. function eventChatCommand(name,command)
  40. local arg={}
  41. for argument in command:gmatch("[^%s]+") do
  42. table.insert(arg,argument)
  43. end
  44. if arg[1]=="off" then
  45. if tonumber(arg[2]) and tonumber(arg[3]) then
  46. players[name].offsets.x=tonumber(arg[2])
  47. players[name].offsets.y=tonumber(arg[3])
  48. else
  49. players[name].offsets.x=2
  50. players[name].offsets.y=10
  51. end
  52. tfm.exec.chatMessage("Offsets changed to X:"..players[name].offsets.x.." Y:"..players[name].offsets.y,name)
  53. end
  54. end
  55.  
  56. function eventNewGame()
  57. started=false
  58. end
  59.  
  60. function eventLoop(time,remaining)
  61. if time >= 3000 and not started then
  62. started=true
  63. end
  64. if remaining<=0 then
  65. tfm.exec.newGame(maps[math.random(#maps)])
  66. end
  67. for i,cannon in ipairs(toDespawn) do
  68. if cannon[1] <= os.time()-3000 then
  69. tfm.exec.removeObject(conjurar[2])
  70. table.remove(toDespawn,i)
  71. end
  72. end
  73. end
  74.  
  75. function eventPlayerDied(name)
  76. local i=0
  77. local n
  78. for pname,player in pairs(tfm.get.room.playerList) do
  79. if not player.isDead then
  80. i=i+1
  81. n=pname
  82. end
  83. end
  84. if i==0 then
  85. tfm.exec.newGame(maps[math.random(#maps)])
  86. elseif i==1 then
  87. tfm.exec.giveCheese(n)
  88. tfm.exec.playerVictory(n)
  89. tfm.exec.setGameTime(0)
  90. end
  91. end
  92.  
  93. for name,player in pairs(tfm.get.room.playerList) do
  94. eventNewPlayer(name)
  95. end
  96.  
  97. tfm.exec.newGame(maps[math.random(#maps)])
  98.  
  99. -- Transformar player em vampiro
  100.  
  101. players = {}
  102. for name,player in pairs(tfm.get.room.playerList) do
  103. table.insert(players,name)
  104. end
  105. tfm.exec.setVampirePlayer(players[math.random(#players)])
  106.  
  107. -- Nevar
  108.  
  109. tfm.exec.snow()
  110.  
  111. local loopCount = 0
  112. function eventLoop()
  113. if loopCount == 0 then
  114. tfm.exec.snow()
  115. tfm.exec.snow()
  116. end
  117. loopCount = (loopCount + 1) % 100
  118. end
  119.  
  120. -- Nomes coloridos
  121. for i, v in pairs(tfm.get.room.playerList) do
  122. tfm.exec.setNameColor(v.playerName, math.random(0,0xffffff))
  123. end
Add Comment
Please, Sign In to add comment