summaryrefslogtreecommitdiff
path: root/npc/020-1/siege.txt
blob: 9b56c90b2ae494d57f79fda16ccd28dfa832b888 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Nivalis Siege for Liberation Day
//    Each player process its own share of monsters. There are 10 waves.
//
//    Q_NivalisLibday
//    Day, Score, Temporary Time;

020-1,0,0,0	script	#NLib_Siege	NPC_HIDDEN,{

OnLoop:
    @nlib_time+=5; // This is looped every 5 s

    // Victory conditions: All monsters dead & number of waves filled. (Or if you reach level 40)
    if (BaseLevel >= 40 || (@nlib_wave >= 10 && mobcount("020-1", "#NLib_Siege::OnPetDeath") <= 0)) {
        goto L_Victory;

    // New wave condition: Waves pending and A- All Mobs Dead B- 4 minutes spent
    if (@nlib_wave < 10 && (mobcount("020-1", "#NLib_Siege::OnPetDeath") <= 0 || @nlib_time >= 240))
        goto L_NextRound;
    }

    // reset timer
    addtimer(5000, "#NLib_Siege::OnLoop");
    end;

L_NextRound:
    @nlib_time=0;
    @nlib_wave = @nlib_wave + 1;
    // Prepare next round
    dispbottom l("Wave @@/10", @nlib_wave);
    .@amount=@nlib_wave+rand(1,2);
    freeloop(true);
	for (.@i = 0; .@i < .@amount; ++.@i) {
        .@mid=rand(1,22);
        .@monsterId=Piou;
        switch (.@mid) {
            case 1:
                .@monsterId = CaveMaggot ; break;
            case 2:
                .@monsterId = GiantMaggot ; break;
                //.@monsterId = Wolvern ; break;
            case 3:
                .@monsterId = WhiteSlime ; break;
            case 4:
                .@monsterId = MagicGoblin ; break;
            case 5:
                .@monsterId = Bandit ; break;
            case 6:
                .@monsterId = GreenSlime ; break;
            case 7:
                .@monsterId = LavaSlime ; break;
            case 8:
                .@monsterId = CaveSnake ; break;
            case 9:
                .@monsterId = DesertBandit ; break;
            case 10:
                .@monsterId = Sarracenus ; break;
            case 11:
                .@monsterId = AngryRedScorpion ; break;
            case 12:
                .@monsterId = IcedFluffy ; break;
            case 13:
                .@monsterId = Scorpion ; break;
            case 14:
                .@monsterId = RedScorpion ; break;
            case 15:
                .@monsterId = BlackSlime ; break;
            case 16:
                .@monsterId = Piousse ; break;
            case 17:
                .@monsterId = CandiedSlime ; break;
            case 18:
                .@monsterId = BlueSlime ; break;
            case 19:
                .@monsterId = SlimeBlast ; break;
            case 20:
                .@monsterId = BlackSlime ; break;
            case 21:
                .@monsterId = RedSlime ; break;
            default:
                .@monsterId = AngryScorpion ; break;
        }
        areamonster "020-1", 20, 20, 100, 100, strmobinfo(1, .@monsterId), .@monsterId, 1, "#NLib_Siege::OnPetDeath";
    }
    freeloop(false);

    // reset timer
    addtimer(5000, "#NLib_Siege::OnLoop");
    end;

// Warp you back, and give you a random small score.
L_CleanUp:
    .@q2=getq2(Q_NivalisLibday);
    setq2 Q_NivalisLibday, .@q2+rand(1,5);
    warp "019-2", 43, 55;
    end;

OnPetDeath:
    .@lf=mobcount("020-1", "#NLib_Siege::OnPetDeath");
    dispbottom l("Mobs remaining: @@", .@lf);
    end;

}