Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoShaman(true)
- tfm.exec.newGame ('<C><P F="5" /><Z><S><S H="251" P="0,0,0,0.2,0,0,0,0" L="17" X="391" Y="277" T="1" /><S H="205" P="0,0,0,0.2,0,0,0,0" L="10" X="220" Y="298" T="1" /><S H="211" P="0,0,0,0.2,0,0,0,0" L="10" X="530" Y="301" T="1" /><S H="111" P="0,0,0,0.2,0,0,0,0" L="10" X="80" Y="345" T="1" /><S H="137" P="0,0,0,0.2,0,0,0,0" L="10" X="671" Y="334" T="1" /></S><D><DS Y="138" X="392" /><DC Y="145" X="392" /></D><O /></Z></C>')
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.setGameTime(9999)
- players={}
- toDespawn={}
- function eventNewPlayer(name)
- for i,key in ipairs({32,40,83}) do
- tfm.exec.bindKeyboard(name,key,true,true)
- end
- players[name]={
- timestamp=os.time(),
- offsets={x=2, y=10}
- }
- end
- function eventKeyboard(name,key,down,x,y)
- if (key==32 or key==40 or key==83) and not tfm.get.room.playerList[name].isDead and started then
- if players[name].timestamp < os.time()-1000 then
- local id=tfm.exec.addShamanObject(34, x+(tfm.get.room.playerList[name].isFacingRight and players[name].offsets.x or -players[name].offsets.x), y+players[name].offsets.y, tfm.get.room.playerList[name].isFacingRight and 90 or 270)
- tfm.exec.moveObject(id,x+(tfm.get.room.playerList[name].isFacingRight and -2 or 2),y+20,false, tfm.get.room.playerList[name].isFacingRight and 250 or -250)
- players[name].timestamp=os.time()
- table.insert(toDespawn,{os.time(),id})
- end
- end
- end
- function eventNewGame()
- started=false
- end
- function eventLoop(time,remaining)
- if time >= 3000 and not started then
- started=true
- end
- if remaining<=0 then
- tfm.exec.newGame ('<C><P F="5" /><Z><S><S H="251" P="0,0,0,0.2,0,0,0,0" L="17" X="391" Y="277" T="1" /><S H="205" P="0,0,0,0.2,0,0,0,0" L="10" X="220" Y="298" T="1" /><S H="211" P="0,0,0,0.2,0,0,0,0" L="10" X="530" Y="301" T="1" /><S H="111" P="0,0,0,0.2,0,0,0,0" L="10" X="80" Y="345" T="1" /><S H="137" P="0,0,0,0.2,0,0,0,0" L="10" X="671" Y="334" T="1" /></S><D><DS Y="138" X="392" /><DC Y="145" X="392" /></D><O /></Z></C>')
- end
- for i,cannon in ipairs(toDespawn) do
- if cannon[1] <= os.time()-3000 then
- tfm.exec.removeObject(cannon[2])
- table.remove(toDespawn,i)
- end
- end
- end
- function eventPlayerDied(name)
- local i=0
- local n
- for pname,player in pairs(tfm.get.room.playerList) do
- if not player.isDead then
- i=i+1
- n=pname
- end
- end
- if i==0 then
- elseif i==1 then
- for u in pairs(tfm.get.room.playerList) do
- tfm.exec.respawnPlayer(u)
- end
- tfm.exec.giveCheese(n)
- tfm.exec.playerVictory(n)
- tfm.exec.respawnPlayer(n)
- tfm.exec.setGameTime(9999)
- elseif i==2 then
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.setGameTime(9999)
- end
- end
- for name,player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement