Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Developed by: Contistente#0000
- Unplayable version: 1.0
- ]]--
- -- Disable standard room behaviors --
- for _, k in next, {"AutoShaman", "AutoNewGame", "AutoTimeLeft", "AutoScore"} do
- tfm.exec["disable"..k]()
- end
- -- Minigame data table --
- tfm.unplayable = {player={}, players={}, shooter={targetName="", firerate=0, firerate_timer=0, firetip=0, x=0, y=0, dx=0, dy=0, dir=0, angles={0, 0}, isFacingRight=false, canshoot=false}, round={mapCode=0, players_alive=0, started=false, difficulty={level=1, timer=0, levelup=15000}}}
- -- Minigame events --
- function eventNewGame()
- -- Reset play --
- tfm.unplayable.round.mapCode = tfm.get.room.xmlMapInfo.mapCode
- tfm.unplayable.round.difficulty.level = 1
- tfm.unplayable.round.players_alive = 0
- for k, v in next, tfm.get.room.playerList do
- if (not v.isDead) then
- tfm.unplayable.round.players_alive = tfm.unplayable.round.players_alive + 1
- end
- end
- ui.setMapName("Unplayable <BL>|</BL> <G>@"..tfm.unplayable.round.mapCode.."</G> <BL>|</BL> <N>Difficulty Lvl: <V>"..tfm.unplayable.round.difficulty.level.."</V></N>")
- -- Set round time
- tfm.exec.setGameTime(93)
- end
- function eventLoop(elapsed, remaining)
- if (tfm.unplayable.round.started) then
- if (remaining <= 2000 and tfm.unplayable.round.players_alive > 0) then
- for k, v in next, tfm.get.room.playerList do
- if(not v.isDead) then
- tfm.exec.giveCheese(k)
- tfm.exec.playerVictory(k)
- end
- end
- end
- if (remaining <= 500 or tfm.unplayable.round.players_alive == 0) then
- tfm.unplayable.round.started = false
- tfm.exec.newGame('#10')
- else
- if (tfm.unplayable.round.difficulty.timer < os.time()) then
- tfm.unplayable.round.difficulty.level = tfm.unplayable.round.difficulty.level + 1
- tfm.unplayable.round.difficulty.timer = os.time() + tfm.unplayable.round.difficulty.levelup
- tfm.unplayable.shooter.firerate = (tfm.unplayable.round.difficulty.levelup/(tfm.unplayable.round.difficulty.level*5))
- tfm.unplayable.shooter.firetip = math.floor(tfm.unplayable.round.difficulty.levelup/(tfm.unplayable.round.difficulty.level*5.9999))
- ui.setMapName("Unplayable <BL>|</BL> <G>@"..tfm.unplayable.round.mapCode.."</G> <BL>|</BL> <N>Difficulty Lvl: <V>"..tfm.unplayable.round.difficulty.level.."</V></N>")
- end
- if (tfm.unplayable.shooter.firerate_timer - tfm.unplayable.shooter.firetip < os.time() and tfm.unplayable.shooter.targetName == "") then
- local alives, troll = {}
- for k, v in next, tfm.get.room.playerList do if(not v.isDead) then alives[#alives+1] = k end end
- local targetName = alives[math.random(#alives)]
- local target = tfm.get.room.playerList[targetName]
- local troll = (tfm.unplayable.round.difficulty.level >= 5 and math.random(1,100) > 80)
- if (not target) then return false end
- if (not troll) then
- tfm.unplayable.shooter.targetName = targetName
- else
- tfm.unplayable.shooter.firerate_timer = os.time() + (tfm.unplayable.shooter.firerate/2)
- end
- tfm.unplayable.shooter.x = target.x
- tfm.unplayable.shooter.y = target.y
- tfm.unplayable.shooter.dir = math.random(1, 9)
- tfm.unplayable.shooter.dx = (tfm.unplayable.shooter.dir ~= 3 and math.random(80,180) or math.random(-10,10))
- tfm.unplayable.shooter.dy = (tfm.unplayable.shooter.dir ~= 3 and math.random(-20,20) or -math.random(80,250))
- tfm.unplayable.shooter.isFacingRight = target.isFacingRight
- if (tfm.unplayable.round.difficulty.level > 2 and math.random(1,100) < 40) then
- tfm.unplayable.shooter.isFacingRight = not target.isFacingRight
- end
- tfm.unplayable.shooter.angles[1] = (tfm.unplayable.shooter.dir ~= 3 and (tfm.unplayable.shooter.isFacingRight and math.random(260,275) or math.random(80,95)) or math.random(175,185))
- tfm.unplayable.shooter.angles[2] = ((tfm.unplayable.shooter.angles[1] >= 80 and tfm.unplayable.shooter.angles[1] <= 95)or(tfm.unplayable.shooter.angles[1] >= 175 and tfm.unplayable.shooter.angles[1] <= 185)or(tfm.unplayable.shooter.angles[1] >= 260 and tfm.unplayable.shooter.angles[1] <= 275)) and (tfm.unplayable.shooter.angles[1] - 180) or tfm.unplayable.shooter.angles[1]
- tfm.exec.addShamanObject(0, (tfm.unplayable.shooter.x + (tfm.unplayable.shooter.isFacingRight and tfm.unplayable.shooter.dx or -tfm.unplayable.shooter.dx) + math.random(-4,4)), (tfm.unplayable.shooter.dir ~= 3 and (tfm.unplayable.shooter.y + (tfm.unplayable.shooter.isFacingRight and tfm.unplayable.shooter.dy or -tfm.unplayable.shooter.dy)) or (tfm.unplayable.shooter.y + tfm.unplayable.shooter.dy)), tfm.unplayable.shooter.angles[2])
- elseif (tfm.unplayable.shooter.firerate_timer < os.time()) then
- tfm.exec.addShamanObject(17, (tfm.unplayable.shooter.isFacingRight and tfm.unplayable.shooter.x + tfm.unplayable.shooter.dx or tfm.unplayable.shooter.x - tfm.unplayable.shooter.dx), (tfm.unplayable.shooter.y + tfm.unplayable.shooter.dy), tfm.unplayable.shooter.angles[1])
- tfm.unplayable.shooter.firerate_timer = os.time() + tfm.unplayable.shooter.firerate
- tfm.unplayable.shooter.targetName = ""
- end
- end
- elseif (elapsed > 3000) then
- tfm.unplayable.shooter.firerate = (tfm.unplayable.round.difficulty.levelup/(tfm.unplayable.round.difficulty.level*5))
- tfm.unplayable.shooter.firetip = math.floor(tfm.unplayable.round.difficulty.levelup/(tfm.unplayable.round.difficulty.level*5.9999))
- tfm.unplayable.shooter.firerate_timer = os.time() + tfm.unplayable.shooter.firerate
- tfm.unplayable.round.difficulty.timer = os.time() + tfm.unplayable.round.difficulty.levelup
- tfm.unplayable.round.started = true
- end
- end
- function eventPlayerDied(name)
- tfm.unplayable.round.players_alive = tfm.unplayable.round.players_alive - 1
- end
- function eventNewPlayer(name)
- tfm.unplayable.players[#tfm.unplayable.players+1] = name
- end
- function eventPlayerLeft(name)
- local index
- for k, v in next, tfm.unplayable.players do
- if (v == name) then index = k end
- end
- tfm.unplayable.players[index] = nil
- end
- -- Start up --
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
- tfm.exec.newGame('#10')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement