SHOW:
|
|
- or go back to the newest paste.
| 1 | tfm.exec.disableAutoNewGame(true) | |
| 2 | tfm.exec.disableAfkDeath(true) | |
| 3 | tfm.exec.disableAutoShaman(false) | |
| 4 | maps={0,1,2,3,4,5,6,9,11,12,13,15,16,17,18,19,20,24,25}
| |
| 5 | tfm.exec.newGame(0) | |
| 6 | system.disableChatCommandDisplay("help",true)
| |
| 7 | ||
| 8 | - | ui.addPopup(1, 0, "Hello, welcome to the Haunted Game! The shaman can control mice by pressing I to jump, J to move left,K to move down , and L to move right! If you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! Feel free to change maps! Have fun! Type !help for this popup to pop again!", nil, 200,100,400,true) |
| 8 | + | local t=0 |
| 9 | local n=0 | |
| 10 | ui.addPopup(1, 0, "Hello, welcome to the Haunted Game created by Mousetat! \nThe shaman can control mice by pressing I to jump, J to move left, K to move down , and L to move right! \nIn short use IJKL to move. \nIf you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! \n\nFeel free to change maps! \nHave fun! \n\nType !help for this popup to pop again!", nil, 200,100,400,true) | |
| 11 | ||
| 12 | - | ui.addPopup(1, 0, "Hello, welcome to the Haunted Game! The shaman can control mice by pressing I to jump, J to move left,K to move down , and L to move right! If you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! Feel free to change maps! Have fun! Type !help for this popup to pop again!", name, 200,100,400,true) |
| 12 | + | |
| 13 | if message=="help" then | |
| 14 | ui.addPopup(1, 0, "Hello, welcome to the Haunted Game created by Mousetat! \nThe shaman can control mice by pressing I to jump, J to move left, K to move down , and L to move right! \nIn short use IJKL to move. \nIf you are uncomfortable with the 'I' button, you can alternatively press the 'Space' button to jump! \n\nFeel free to change maps! \nHave fun! \n\nType !help for this popup to pop again!", nil, 200,100,400,true) | |
| 15 | end | |
| 16 | end | |
| 17 | ||
| 18 | function eventLoop(time,remaining) | |
| 19 | if remaining<=0 then | |
| 20 | tfm.exec.newGame(maps[math.random(#maps)]) | |
| 21 | end | |
| 22 | end | |
| 23 | ||
| 24 | - | for keys, k in pairs({73, 74, 75, 76}) do
|
| 24 | + | function eventPlayerDied(playerName) |
| 25 | n=n-1 | |
| 26 | print(n) | |
| 27 | - | print(name) |
| 27 | + | |
| 28 | if n==t or n<=0 or playerName==player.isShaman then | |
| 29 | if player.isShaman then | |
| 30 | tfm.exec.giveCheese(name) | |
| 31 | tfm.exec.playerVictory(name) | |
| 32 | tfm.exec.newGame(maps[math.random(#maps)]) | |
| 33 | end | |
| 34 | end | |
| 35 | end | |
| 36 | end | |
| 37 | ||
| 38 | function eventPlayerWon(playerName,timeElapsed) | |
| 39 | t=t+1 | |
| 40 | print("t: " .. t)
| |
| 41 | for name, player in pairs(tfm.get.room.playerList) do | |
| 42 | if n==t then | |
| 43 | if player.isShaman then | |
| 44 | tfm.exec.giveCheese(name) | |
| 45 | tfm.exec.playerVictory(name) | |
| 46 | tfm.exec.newGame(maps[math.random(#maps)]) | |
| 47 | end | |
| 48 | end | |
| 49 | end | |
| 50 | end | |
| 51 | - | function eventPlayerDied() |
| 51 | + | |
| 52 | - | local i=0 |
| 52 | + | |
| 53 | - | for n,player in pairs(tfm.get.room.playerList) do |
| 53 | + | n=0 |
| 54 | - | if not player.isDead then |
| 54 | + | t=0 |
| 55 | - | i=i+1 |
| 55 | + | |
| 56 | for keys, k in pairs({32, 73, 74, 75, 76}) do
| |
| 57 | if player.isShaman then | |
| 58 | - | if i==0 then |
| 58 | + | |
| 59 | else | |
| 60 | tfm.exec.bindKeyboard(name, k, true, false) | |
| 61 | end | |
| 62 | ||
| 63 | end | |
| 64 | n=n+1 | |
| 65 | end | |
| 66 | n=n-1 | |
| 67 | print(n) | |
| 68 | end | |
| 69 | ||
| 70 | function eventKeyboard(name, key, down, x, y) | |
| 71 | for name, player in pairs(tfm.get.room.playerList) do | |
| 72 | if not player.isShaman then | |
| 73 | if key == 73 then | |
| 74 | tfm.exec.movePlayer(name, 0, 0, true, 0, -50, false) | |
| 75 | elseif key == 32 then | |
| 76 | tfm.exec.movePlayer(name, 0, 0, true, 0, -50, false) | |
| 77 | elseif key == 75 then | |
| 78 | tfm.exec.movePlayer(name, 0, 0, true, 0, 40, false) | |
| 79 | elseif key == 74 then | |
| 80 | tfm.exec.movePlayer(name, 0, 0, true, -40, 0, false) | |
| 81 | elseif key == 76 then | |
| 82 | tfm.exec.movePlayer(name, 0, 0, true, 40, 0, false) | |
| 83 | end | |
| 84 | end | |
| 85 | end | |
| 86 | end |