summaryrefslogtreecommitdiff
path: root/npc/001-10-1/scripts.txt
blob: cfda99a6fa05d2db5e819b4c4a36002619a7e62e (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
// TMW2 scripts.
// Authors:
//    Jesusalva
//    Dusty in a Bottle (aka. Dustynator, Dustman, mr. willbelz)
// Description:
//    Scripts for 001-10-1: Boss Fight!

001-10-1,0,0,0	script	#COD_BossManager	NPC_HIDDEN,{
    end;

// Spawn the Dust Boss
OnEventStart:
    areamonster("001-10-1", 34, 29, 59, 52, strmobinfo(1, DustBoss), DustBoss, 1, "#COD_BossManager::OnVictory");
    initnpctimer;
    end;

// Dust boss was killed, add timers, special reward for victor
OnVictory:
    if (getcharid(1) > 0)
        .pwin=getcharid(1);
    else
        .win$=strcharinfo(0);

    getitem BottledDust, 1;

    maptimer("001-10-1", 100, "#COD_BossManager::OnReward1");
    maptimer("001-10", 100, "#COD_BossManager::OnReward2");
    donpcevent("Colonel DUSTMAN::OnCoDEnd");
    end;

// Handle rewards: 10 dust for winner party on boss room, 1 dust for everyone else
// on boss room, 1 dust for winner party outside boss room
OnReward1:
    if ((.pwin > 0 && getcharid(1) == .pwin) || strcharinfo(0) == .win$)
        getitem BottledDust, 10;
    else
        getitem BottledDust, 1;
OnReward2:
    if (.pwin && getcharid(1) == .pwin)
        getitem BottledDust, 1;
    warp "018-2-1", 24, 29;
    end;

// You ran out of time
OnTimeDefeat:
    @COD_CHECKPOINT=0;
    if (getmap() ~= "001-10") {
        warp "018-2-1", 24, 29;
        dispbottom l("COD: Ran out of time!");
    }
    end;

// Must reset for next challenge
OnCleanUp:
    .pwin=0; // party winner
    .win$=""; // fallback, if char not in party
    killmonsterall("001-10-1");
    initnpctimer;
    stopnpctimer;
    end;

// Every 20 seconds mobs are created if needed
OnTimer20000:
    .@mi=mobcount("001-10-1", "all");
    .@pl=getmapusers("001-10-1");
    .@monsterId=any(DustRifle, DustGatling, DustRevolver);
    if (.@pl > (.@mi-2))
        areamonster("001-10-1", 34, 29, 59, 52, strmobinfo(1, .@monsterId), .@monsterId, (.@pl-.@mi+2));
    initnpctimer;
    end;

// Setup
OnInit:
    .pwin=0; // party winner
    .win$=""; // fallback, if char not in party
    end;
}