Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.setGameTime(3,true)
- roles={0,1}
- maps={7489629}
- data={}
- text={}
- lang={}
- players={}
- alive=0
- lang.en={
- menu="Menu",
- profile2="Profile",
- help2="Help",
- 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.",
- wins="Total Wins",
- wins_Bomber="Wins As Bomber",
- wins_Protector="Wins As Protector",
- close="Close",
- health=100,
- bomber_Wins="Bomber Wins!",
- protector_Wins="Protectors Win!",
- powerups2="Powerups",
- 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.",
- powerup2="[Mega Jump]</J> Is activated by the down arrow."
- }
- for _, s in next, {'AutoTimeLeft', 'PhysicalConsumables', 'AfkDeath', 'AutoShaman', 'AutoNewGame'} do
- tfm.exec['disable' .. s]()
- end
- function particles(x,y)
- tfm.exec.displayParticle(9,x,y+10,-0.4,0.1,0.2,0.3,nil)
- tfm.exec.displayParticle(9,x,y+10,-0.6,0.2,0.6,0.2,nil)
- tfm.exec.displayParticle(9,x,y+10,-0.8,0.3,0.8,0.1,nil)
- tfm.exec.displayParticle(9,x,y+10,0.4,0.4,-0.4,0.3,nil)
- tfm.exec.displayParticle(9,x,y+10,0.6,0.5,-0.6,0.2,nil)
- tfm.exec.displayParticle(9,x,y+10,0.8,0.6,-0.8,0.1,nil)
- end
- function bigJump(n,x,y)
- tfm.exec.movePlayer(n,0,0,false,0,-80,true)
- tfm.exec.displayParticle(3,x-5,y+10,-0.8,0,0,0,n)
- tfm.exec.displayParticle(3,x+5,y+10,0.8,0,0,0,n)
- tfm.exec.displayParticle(3,x-10,y+10,-1.7,0,0,0,n)
- tfm.exec.displayParticle(3,x+10,y+10,1.7,0,0,0,n)
- particles(x,y)
- end
- function identifyBomber(n)
- if data[n].role==0 then
- tfm.exec.setNameColor(n,0x00FF00)
- tfm.exec.movePlayer(n,1023,432,false,0,50,false)
- elseif data[n].role==1 then
- tfm.exec.setNameColor(n,0xFF0000)
- end
- end
- function countAlive()
- alive=0
- for n,player in pairs(tfm.get.room.playerList) do
- if tfm.get.room.playerList[n].isDead==false then
- alive=alive+1
- end
- end
- end
- function removeWinner()
- ui.removeTextArea(20,nil)
- ui.removeTextArea(30,nil)
- ui.removeTextArea(40,nil)
- ui.removeTextArea(50,nil)
- ui.removeTextArea(60,nil)
- ui.removeTextArea(19,nil)
- end
- function win(n)
- if tfm.get.room.playerList[n].isDead==false and data[n].role==0 then
- data[n].wins=data[n].wins+1
- data[n].wins_Protector=data[n].wins_Protector+1
- end
- end
- function insertName(n)
- table.insert(players,n)
- end
- function setLang(n)
- text[n]=lang[tfm.get.room.playerList[n].community] or lang.en
- end
- function setData(n)
- data[n]=
- {
- wins=0,
- role=0,
- health=100,
- spawn=1,
- wins_Protector=0,
- wins_Bomber=0
- }
- end
- function chooseRole()
- for n,player in pairs(tfm.get.room.playerList) do
- data[n].role=0
- end
- player=players[math.random(#players)]
- data[player].role=1
- player=""..player
- end
- function bindKeyboard(n)
- for i=0,100 do
- tfm.exec.bindKeyboard(n,i,true,true)
- end
- end
- function showMenu(n)
- 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)
- end
- function showMenu2(n)
- 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)
- end
- function showHealth(n)
- ui.addTextArea(-3, "", n, 319, 27, 100, 18, 0xffffff, 0xffffff, 1, true)
- ui.addTextArea(-1, "", n, 319, 27, data[n].health, 18, 0x1aff00, 0x1aff00, 1, true)
- ui.addTextArea(-2, "<p align='center'><b><font color='#000000'>"..data[n].health.."%", n, 345, 27, 54, 18, 0x324650, 0x000000, 0, true)
- end
- function displayTab(n,info,subject)
- ui.addTextArea(2, "", n, 262, 72, 360, 290, 0x331f15, 0x331f15, 1, true)
- ui.addTextArea(3, "", n, 262, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(5, "", n, 295, 72, 290, 4, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(4, "", n, 618, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(6, "", n, 295, 358, 295, 4, 0x6b4231, 0x6b4231, 1, true)
- 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)
- 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)
- end
- function profile(n,info)
- ui.addTextArea(2, "", n, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
- ui.addTextArea(3, "", n, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(5, "", n, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(4, "", n, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(6, "", n, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
- 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)
- 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)
- end
- function close(n)
- for i=1,7 do
- ui.removeTextArea(i,n)
- end
- end
- function nearBomber(n,x,y,p)
- if ((tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x+180 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+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 tfm.get.room.playerList[n].isFacingRight==true then
- tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
- data[p].health=data[p].health-12.5
- tfm.exec.displayParticle(1,x,y,0.2,0,0.2,0,nil)
- tfm.exec.displayParticle(1,x,y,0.4,0,0.4,0,nil)
- tfm.exec.displayParticle(1,x,y,0.6,0,0.6,0,nil)
- tfm.exec.displayParticle(1,x,y,0.8,0,0.8,0,nil)
- tfm.exec.displayParticle(1,x,y,1,0,1,0,nil)
- tfm.exec.displayParticle(1,x,y-10,0.2,0,0.2,0,nil)
- tfm.exec.displayParticle(1,x,y-10,0.4,0,0.4,0,nil)
- tfm.exec.displayParticle(1,x,y-10,0.6,0,0.6,0,nil)
- tfm.exec.displayParticle(1,x,y-10,0.8,0,0.8,0,nil)
- tfm.exec.displayParticle(1,x,y-10,1,0,1,0,nil)
- tfm.exec.displayParticle(1,x,y+10,0.2,0,0.2,0,nil)
- tfm.exec.displayParticle(1,x,y+10,0.4,0,0.4,0,nli)
- tfm.exec.displayParticle(1,x,y+10,0.6,0,0.6,0,nil)
- tfm.exec.displayParticle(1,x,y+10,0.8,0,0.8,0,nil)
- tfm.exec.displayParticle(1,x,y+10,1,0,1,0,nil)
- end
- if ((tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x-180 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+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 tfm.get.room.playerList[n].isFacingRight==false then
- tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
- data[p].health=data[p].health-10
- tfm.exec.displayParticle(1,x,y,-0.2,0,-0.2,0,nil)
- tfm.exec.displayParticle(1,x,y,-0.4,0,-0.4,0,nil)
- tfm.exec.displayParticle(1,x,y,-0.6,0,-0.6,0,nil)
- tfm.exec.displayParticle(1,x,y,-0.8,0,-0.8,0,nil)
- tfm.exec.displayParticle(1,x,y,-1,0,-1,0,nil)
- tfm.exec.displayParticle(1,x,y-10,-0.2,0,-0.2,0,nil)
- tfm.exec.displayParticle(1,x,y-10,-0.4,0,-0.4,0,nil)
- tfm.exec.displayParticle(1,x,y-10,-0.6,0,-0.6,0,nil)
- tfm.exec.displayParticle(1,x,y-10,-0.8,0,-0.8,0,nil)
- tfm.exec.displayParticle(1,x,y-10,-1,0,-1,0,nil)
- tfm.exec.displayParticle(1,x,y+10,-0.2,0,-0.2,0,nil)
- tfm.exec.displayParticle(1,x,y+10,-0.4,0,-0.4,0,nli)
- tfm.exec.displayParticle(1,x,y+10,-0.6,0,-0.6,0,nil)
- tfm.exec.displayParticle(1,x,y+10,-0.8,0,-0.8,0,nil)
- tfm.exec.displayParticle(1,x,y+10,-1,0,-1,0,nil)
- end
- if data[p].health<1 then
- tfm.exec.killPlayer(p)
- end
- end
- operation={-110,110}
- function nearProtector(n,p,x,y)
- if not (n==p) and data[p].health>0 and data[n].health>0 then
- tfm.exec.displayParticle(13,x,y,-0.2,0.1,-0.2,0.1,nil)
- tfm.exec.displayParticle(13,x,y,-0.4,0,-0.4,0,nil)
- tfm.exec.displayParticle(13,x,y,-0.6,0,-0.6,0,nil)
- tfm.exec.displayParticle(3,x,y,-0.8,0,-0.8,0,nil)
- tfm.exec.displayParticle(3,x,y,-8,0,-1,0,nil)
- tfm.exec.displayParticle(3,x,y-10,-0.2,0.1,-0.2,0.1,nil)
- tfm.exec.displayParticle(13,x,y-10,-0.4,0,-0.4,0,nil)
- tfm.exec.displayParticle(13,x,y-10,-0.6,0,-0.6,0,nil)
- tfm.exec.displayParticle(13,x,y-10,-0.8,0,-0.8,0,nil)
- tfm.exec.displayParticle(13,x,y-10,-1,0,-1,0,nil)
- tfm.exec.displayParticle(13,x,y+10,-0.2,0.1,-0.2,0.1,nil)
- tfm.exec.displayParticle(13,x,y+10,-0.4,0,-0.4,0,nli)
- tfm.exec.displayParticle(13,x,y+10,-0.6,0,-0.6,0,nil)
- tfm.exec.displayParticle(13,x,y+10,-0.8,-0.1,-0.8,-0.1,nil)
- tfm.exec.displayParticle(13,x,y+10,-1,0,-1,0,nil)
- tfm.exec.displayParticle(13,x,y,0.2,0,0.2,0,nil)
- tfm.exec.displayParticle(13,x,y,0.4,0,0.4,0,nil)
- tfm.exec.displayParticle(13,x,y,0.6,0,0.6,0,nil)
- tfm.exec.displayParticle(13,x,y,0.8,0,0.8,0,nil)
- tfm.exec.displayParticle(13,x,y,1,0,1,0,nil)
- tfm.exec.displayParticle(13,x,y-10,0.2,0.1,0.2,0.1,nil)
- tfm.exec.displayParticle(13,x,y-10,0.4,0,0.4,0,nil)
- tfm.exec.displayParticle(13,x,y-10,0.6,0,0.6,0,nil)
- tfm.exec.displayParticle(13,x,y-10,0.8,0,0.8,0,nil)
- tfm.exec.displayParticle(13,x,y-10,1,0,1,0,nil)
- tfm.exec.displayParticle(13,x,y+10,0.2,0,0.2,0,nil)
- tfm.exec.displayParticle(13,x,y+10,0.4,0,0.4,0,nli)
- tfm.exec.displayParticle(13,x,y+10,0.6,0,0.6,0,nil)
- tfm.exec.displayParticle(3,x,y+10,0.8,0,0.8,0,nil)
- tfm.exec.displayParticle(3,x,y+10,8,0,1,0,nil)
- end
- 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
- data[n].health=data[n].health-10
- tfm.exec.movePlayer(n,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
- end
- if data[n].health<1 then
- tfm.exec.killPlayer(n)
- end
- end
- for n,player in pairs(tfm.get.room.playerList) do
- bindKeyboard(n)
- setLang(n)
- insertName(n)
- setData(n)
- showMenu(n)
- end
- chooseRole()
- for n,player in pairs(tfm.get.room.playerList) do
- identifyBomber(n)
- end
- function allInfo(n)
- bindKeyboard(n)
- setLang(n)
- insertName(n)
- setData(n)
- showMenu(n)
- identifyBomber(n)
- end
- function eventNewGame()
- players={}
- for n,player in pairs(tfm.get.room.playerList) do
- insertName(n)
- end
- chooseRole()
- countAlive()
- removeWinner()
- for n,player in pairs(tfm.get.room.playerList) do
- identifyBomber(n)
- data[n].health=100
- end
- end
- function eventTextAreaCallback(txt, n, a)
- if a=="Menu" then
- showMenu(n)
- elseif a=="menu2" then
- showMenu2(n)
- elseif a=="Help" then
- displayTab(n,text[n].help,text[n].help2)
- elseif a=="close" then
- close(n)
- elseif a=="Profile" then
- 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)
- elseif a=="Powerups" then
- displayTab(n,"<J>"..text[n].powerup1.."\n\n<J>"..text[n].powerup2,text[n].powerups2)
- end
- end
- function eventNewPlayer(n)
- allInfo(n)
- end
- function eventLoop(time,timeRemaining)
- for n,player in pairs(tfm.get.room.playerList) do
- data[n].spawn=data[n].spawn+0.5
- showHealth(n)
- end
- if timeRemaining<=0 then
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- end
- function eventKeyboard(n, k, d, x, y)
- if k==32 and data[n].role==0 and data[n].spawn>0 then
- nearBomber(n,x,y,player)
- data[n].spawn=-1
- elseif k==32 and data[n].role==1 and data[n].spawn>0 then
- data[n].spawn=-1.5
- player=player
- for n in pairs(tfm.get.room.playerList) do
- nearProtector(n,player,tfm.get.room.playerList[player].x,tfm.get.room.playerList[player].y)
- end
- elseif k==3 and data[n].spawn>0 then
- data[n].spawn=-2
- player=player
- bigJump(n,x,y)
- end
- end
- function eventPlayerDied(n)
- for n,player in pairs(tfm.get.room.playerList) do
- win(n)
- end
- countAlive()
- data[n].health=0
- if data[n].role==1 then
- for n,player in pairs(tfm.get.room.playerList) do
- ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
- ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(19, "<p align='center'><font size='20'><VP>"..text[n].protector_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
- tfm.exec.setGameTime(5,true)
- end
- end
- end
- function eventMouse(playerName,x,y)
- print("<VP>X</VP><N>:</N><J> "..x.."</J><VP> Y</VP><N>:</N><J> "..y)
- end
- system.bindMouse("Fuzzyfirsdog#0000", true)
- function eventPlayerGetCheese(n)
- for n,player in pairs(tfm.get.room.playerList) do
- win(n)
- end
- if data[n].role==1 then
- data[n].wins=data[n].wins+1
- data[n].wins_Bomber=data[n].wins_Bomber+1
- tfm.exec.setGameTime(10,true)
- for n,player in pairs(tfm.get.room.playerList) do
- ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
- ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
- ui.addTextArea(19, "<p align='center'><font size='20'><R>"..text[n].bomber_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
- if not (data[n].role==1) then
- tfm.exec.killPlayer(n)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement