Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- owner = "nobody" -- replace with your username
- interval = 10
- cannonInfo = {}
- difficulty = 8
- maps = {3107377,305748,1539148,4543602,390649,495880,1463332,1492805,292678,305753,1545834,3175437,2964900,1812056,852617,799141,1794907,2939549,459284,1519483,1794873,811211,306360,489829,479091,3419948,290546,276534,3220945,1754355,281649,390657,311496,295988,802958,2643833}
- function main()
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- function eventNewGame()
- interval = 10
- end
- function eventNewPlayer(name)
- ui.addTextArea(1, "<a href='event:easy'><VP><font size='14'>E", name, 728, 21, nil, nil, 0x000001, nil, 0.7)
- ui.addTextArea(2, "<a href='event:medium'><J><font size='14'>M", name, 753, 21, nil, nil, 0x000001, nil, 0.7)
- ui.addTextArea(3, "<a href='event:hard'><R><font size='14'>H", name, 781, 21, nil, nil, 0x000001, nil, 0.7)
- end
- function eventTextAreaCallback(id, name, cb)
- if (owner==name or owner=="nobody") and interval > 6 then
- interval = 10
- if cb == "easy" then
- difficulty = 7
- elseif cb == "medium" then
- difficulty = 8
- elseif cb == "hard" then
- difficulty = 9
- end
- end
- end
- function eventLoop(time, remaining)
- if time>3000 then
- interval = interval - 1
- if interval == difficulty then
- ui.removeTextArea(4)
- local users = {}
- for name,p in pairs(tfm.get.room.playerList) do
- if not p.isDead then
- users[#users+1] = name
- end
- end
- cannonInfo = spawnCannon(users[math.random(#users)])
- interval = 11
- elseif interval<=5 then
- tfm.exec.setUIMapName("<ROSE>The next map will start in "..interval)
- if interval == 0 then
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- elseif interval == 10 then
- tfm.exec.addShamanObject(17, cannonInfo[1], cannonInfo[2], cannonInfo[3]-90)
- cannonInfo={}
- end
- end
- if remaining<=0 then
- ui.addTextArea(4, "<VP><p align='center'><B>CONGRATULATIONS</B>\n\n<CH><i>you beat the CPU!", nil, 290, 22, 180, nil, 0x000001, 0xCA0805, 0.8)
- tfm.exec.newGame(maps[math.random(#maps)])
- end
- end
- function eventPlayerDied(name)
- if playerCount() < 1 then
- interval = 6
- end
- end
- function playerCount()
- local n=0
- for name, player in pairs(tfm.get.room.playerList) do
- if not player.isDead then
- n=n+1
- end
- end
- return n
- end
- function spawnCannon(name)
- local info = {}
- local px = tfm.get.room.playerList[name].x
- local py = tfm.get.room.playerList[name].y
- local cnnx = math.random()*800
- local cnny = math.random()*400
- if cnny > py then
- cnny = py-math.random(50)-20
- end
- if math.abs(cnnx-px) > 300 then
- cnnx = px + math.random(-50, 50)
- end
- local ang = math.deg(math.atan2(cnny-py, cnnx-px))
- tfm.exec.addShamanObject(0, cnnx, cnny, ang+90)
- info[1] = cnnx
- info[2] = cnny
- info[3] = ang
- return info
- end
- for name in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement