Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- npcs={}
- time_spawn = os.time();
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- function eventNewGame()
- tfm.exec.setGameTime(9999999)
- end
- p = {}
- images={
- {"15922b9ad4d.png",130,23,93,"Zombie"},{"159237ccbfd.png",130,23,93,"Zombie"},{"159237ce30f.png",130,23,93,"Zombie"},{"159238d77a9.png",65,17,31,"Drekkem"}
- }
- function eventNewPlayer(name)
- p[name]={
- damage=5,
- delete="",
- delete2="",
- tempo = os.time(),
- life = 50,
- maxLife = 50
- }
- tfm.exec.bindKeyboard(name,32,true)
- end
- function eventKeyboard(name,key,down,x,y)
- if key == 32 and p[name].tempo < os.time()-800 then
- for n,v in pairs(npcs) do
- 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
- v.life = v.life-p[name].damage
- p[name].tempo = os.time();
- if v.life < 1 then
- p[name].delete = v.id
- p[name].delete2 = n
- end
- end
- end
- end
- if p[name].delete ~= '' then
- ui.removeTextArea(p[name].delete,nil)
- table.remove(npcs,p[name].delete2)
- tfm.exec.removeObject(p[name].delete)
- p[name].delete = ''
- end
- end
- function eventLoop()
- if time_spawn < os.time()-15000 then
- monster = tfm.exec.addShamanObject(6300,math.random(20,3000)+math.random(-60,60),math.random(20,360))
- vida = math.random(10,80)
- imagem = images[math.random(#images)]
- image = tfm.exec.addImage(imagem[1], "#"..monster, -imagem[3], -imagem[4])
- table.insert(npcs,{id=monster,maxLife=vida,life=vida,damage=math.random(3,8),img=image,textareaHeight=imagem[2],name=imagem[5]})
- time_spawn = os.time();
- end
- for i,v in pairs(npcs) do
- for n,pi in pairs(tfm.get.room.playerList) do
- 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
- p[n].life = p[n].life-v.damage
- if p[n].life < 1 then
- p[n].life = 0
- tfm.exec.killPlayer(n)
- end
- end
- 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
- if pi.x > tfm.get.room.objectList[v.id].x then
- tfm.exec.moveObject(v.id,0,0,false,10,0,true)
- else
- tfm.exec.moveObject(v.id,0,0,false,-10,0,true)
- end
- if pi.x < tfm.get.room.objectList[v.id].y then
- tfm.exec.moveObject(v.id,0,0,false,0,-15,true)
- end
- pular = math.random(0,5)
- if pular == 2 then
- tfm.exec.moveObject(v.id,0,0,false,0,-30,true)
- end
- 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)
- else
- ui.removeTextArea(v.id,n)
- end
- end
- end
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- 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