View difference between Paste ID: mBnxkrDN and vSDk80yK
SHOW: | | - or go back to the newest paste.
1
owner = "nobody" -- replace with your username
2
 
3-
interval = 10
3+
interval = 9999999999
4-
cannonInfo = {}
4+
 
5-
difficulty = 8
5+
6
 
7
function main()
8
    tfm.exec.disableAutoNewGame(true)
9
    tfm.exec.disableAutoShaman(true)
10
    tfm.exec.disableAutoTimeLeft(true)
11
    tfm.exec.newGame(maps[math.random(#maps)])
12
end
13
 
14
function eventNewGame()
15
    interval = 9999999999
16
    tfm.exec.setGameTime(300)
17-
    interval = 10
17+
18
19
function eventLoop(time, remaining)
20-
function eventNewPlayer(name)
20+
    interval = interval - 1
21-
    ui.addTextArea(1, "<a href='event:easy'><VP><font size='14'>E", name, 728, 21, nil, nil, 0x000001, nil, 0.7)
21+
    if time>3000 and interval>6 then
22-
    ui.addTextArea(2, "<a href='event:medium'><J><font size='14'>M", name, 753, 21, nil, nil, 0x000001, nil, 0.7)
22+
        ui.removeTextArea(4)
23-
    ui.addTextArea(3, "<a href='event:hard'><R><font size='14'>H", name, 781, 21, nil, nil, 0x000001, nil, 0.7)
23+
        local users = {}
24
        for name,p in pairs(tfm.get.room.playerList) do
25
            if not p.isDead then
26-
function eventTextAreaCallback(id, name, cb)
26+
                users[#users+1] = name
27-
    if (owner==name or owner=="nobody") and interval > 6 then
27+
28-
        interval = 10
28+
29-
        if cb == "easy" then
29+
        spawnCannon(users[math.random(#users)])
30-
            difficulty = 7
30+
31-
        elseif cb == "medium" then
31+
    if interval<=5 then
32-
            difficulty = 8
32+
        tfm.exec.setUIMapName("<ROSE>The next map will start in "..interval)
33-
        elseif cb == "hard" then
33+
        if interval == 0 then
34-
            difficulty = 9
34+
            tfm.exec.newGame(maps[math.random(#maps)])
35
        end
36
    end
37
    if remaining<=0 then
38
        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)
39-
function eventLoop(time, remaining) 
39+
40-
    if time>3000 then
40+
41-
        interval = interval - 1
41+
42-
        if interval == difficulty then
42+
 
43-
            ui.removeTextArea(4)
43+
44-
            local users = {}
44+
45-
            for name,p in pairs(tfm.get.room.playerList) do
45+
46-
                if not p.isDead then
46+
47-
                    users[#users+1] = name
47+
48-
                end
48+
 
49
function playerCount()
50-
            cannonInfo = spawnCannon(users[math.random(#users)])
50+
51-
            interval = 11
51+
52-
        elseif interval<=5 then
52+
53-
            tfm.exec.setUIMapName("<ROSE>The next map will start in "..interval)
53+
            print(name)
54-
            if interval == 0 then
54+
55-
                tfm.exec.newGame(maps[math.random(#maps)])
55+
56
    end
57-
        elseif interval == 10 then
57+
58-
            tfm.exec.addShamanObject(17, cannonInfo[1], cannonInfo[2], cannonInfo[3]-90)
58+
59-
            cannonInfo={}
59+
 
60
function spawnCannon(name)
61
    local px = tfm.get.room.playerList[name].x
62
    local py = tfm.get.room.playerList[name].y
63
    local cnnx = math.random()*800
64
    local cnny = math.random()*400
65
    if cnny > py then
66
        cnny = py-math.random(50)-20
67
    end
68
    if math.abs(cnnx-px) > 300 then
69
        cnnx = px + math.random(-50, 50)
70
    end
71
    local ang = math.deg(math.atan2(cnny-py, cnnx-px))
72
    for i=0, math.random(10) do
73
        tfm.exec.addShamanObject(17, cnnx, cnny, ang-90)
74
    end
75
end
76
       
77
main()