Advertisement
Dudugz-Contistente

Untitled

Dec 21st, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. npcs={}
  2.  
  3. time_spawn = os.time();
  4.  
  5. tfm.exec.disableAutoNewGame(true)
  6. tfm.exec.disableAutoShaman(true)
  7. tfm.exec.disableAutoTimeLeft(true)
  8.  
  9. function eventNewGame()
  10. tfm.exec.setGameTime(9999999)
  11. end
  12.  
  13. p = {}
  14.  
  15. images={
  16. {"15922b9ad4d.png",130,23,93,"Zombie"},{"159237ccbfd.png",130,23,93,"Zombie"},{"159237ce30f.png",130,23,93,"Zombie"},{"159238d77a9.png",65,17,31,"Drekkem"}
  17. }
  18.  
  19. function eventNewPlayer(name)
  20. p[name]={
  21. damage=5,
  22. delete="",
  23. delete2="",
  24. tempo = os.time(),
  25. life = 50,
  26. maxLife = 50
  27. }
  28.  
  29. tfm.exec.bindKeyboard(name,32,true)
  30. end
  31.  
  32. function eventKeyboard(name,key,down,x,y)
  33. if key == 32 and p[name].tempo < os.time()-800 then
  34. for n,v in pairs(npcs) do
  35. if x >= tfm.get.room.objectList[v.id].x - 25 and x <= tfm.get.room.objectList[v.id].x + 25 and y >= tfm.get.room.objectList[v.id].y - 25 and y <= tfm.get.room.objectList[v.id].y + 25 and not tfm.get.room.playerList[name].isDead then
  36. v.life = v.life-p[name].damage
  37. p[name].tempo = os.time();
  38.  
  39. if v.life < 1 then
  40. p[name].delete = v.id
  41. p[name].delete2 = n
  42. end
  43. end
  44. end
  45. end
  46.  
  47. if p[name].delete ~= '' then
  48. ui.removeTextArea(p[name].delete,nil)
  49. table.remove(npcs,p[name].delete2)
  50. tfm.exec.removeObject(p[name].delete)
  51. p[name].delete = ''
  52. end
  53. end
  54.  
  55. function eventLoop()
  56. if time_spawn < os.time()-15000 then
  57. monster = tfm.exec.addShamanObject(6300,math.random(20,3000)+math.random(-60,60),math.random(20,360))
  58.  
  59. vida = math.random(10,80)
  60.  
  61. imagem = images[math.random(#images)]
  62. image = tfm.exec.addImage(imagem[1], "#"..monster, -imagem[3], -imagem[4])
  63.  
  64. table.insert(npcs,{id=monster,maxLife=vida,life=vida,damage=math.random(3,8),img=image,textareaHeight=imagem[2],name=imagem[5]})
  65.  
  66. time_spawn = os.time();
  67. end
  68.  
  69. for i,v in pairs(npcs) do
  70. for n,pi in pairs(tfm.get.room.playerList) do
  71. if pi.x >= tfm.get.room.objectList[v.id].x - 12 and pi.x <= tfm.get.room.objectList[v.id].x + 12 and pi.y >= tfm.get.room.objectList[v.id].y - 25 and pi.y <= tfm.get.room.objectList[v.id].y + 25 and not tfm.get.room.playerList[n].isDead then
  72. p[n].life = p[n].life-v.damage
  73.  
  74. if p[n].life < 1 then
  75. p[n].life = 0
  76. tfm.exec.killPlayer(n)
  77. end
  78. end
  79.  
  80. if pi.x >= tfm.get.room.objectList[v.id].x - 100 and pi.x <= tfm.get.room.objectList[v.id].x + 100 and pi.y >= tfm.get.room.objectList[v.id].y - 50 and pi.y <= tfm.get.room.objectList[v.id].y + 50 and not tfm.get.room.playerList[n].isDead then
  81. if pi.x > tfm.get.room.objectList[v.id].x then
  82. tfm.exec.moveObject(v.id,0,0,false,10,0,true)
  83. else
  84. tfm.exec.moveObject(v.id,0,0,false,-10,0,true)
  85. end
  86.  
  87. if pi.x < tfm.get.room.objectList[v.id].y then
  88. tfm.exec.moveObject(v.id,0,0,false,0,-15,true)
  89. end
  90.  
  91. pular = math.random(0,5)
  92.  
  93. if pular == 2 then
  94. tfm.exec.moveObject(v.id,0,0,false,0,-30,true)
  95. end
  96.  
  97. ui.addTextArea(v.id,"<V>"..v.name.."<br><VI><font color='#FF0000'>♥ </font>"..v.life.."/"..v.maxLife.."</CR>",n,tfm.get.room.objectList[v.id].x-30,tfm.get.room.objectList[v.id].y-v.textareaHeight,50,nil,nil,0,70,false)
  98. else
  99. ui.removeTextArea(v.id,n)
  100. end
  101. end
  102. end
  103. end
  104.  
  105. for all in pairs(tfm.get.room.playerList) do
  106. eventNewPlayer(all)
  107. end
  108.  
  109. tfm.exec.newGame('<C><P L="3000" D="x_deadmeat/x_zone/x_200.jpg,1541,-461;x_deadmeat/x_campement/repos_fond.jpg,-378,-280" Ca="" /><Z><S><S L="3000" H="10" X="1457" Y="404" T="14" P="0,0,0.3,0.2,0,0,0,0" /><S L="3000" X="1" H="10" Y="316" T="14" P="0,0,0,0,90,0,0,0" /></S><D /><O /></Z></C>')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement