summaryrefslogtreecommitdiff
path: root/npc/004-2/bgmaster.txt
blob: 92db75bb9e3a8e34b1f842c3e99156b7c6ef913f (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// TMW2 Scripts.
// Author:
//  Jesusalva

004-2,29,23,0	script	BGMaster	NPC_FEMALE,{
    mesn;
    //if ($@BattleOn) goto L_Busy;
    mesq l("Hello, lets bg masterize this.");
    mes "";
    menu
        rif(!$@BattleOn, l("Init!")), L_Init,
        l("Join team 1."), L_T1,
        l("Join team 2."), L_T2;

L_T1:
    mesn;
    if (bg_join_team($@FK_Team1))
        goto L_SuccessJoin;
    mes "An error happened.";
    goto L_Close;

L_T2:
    mesn;
    if (bg_join_team($@FK_Team1))
        goto L_SuccessJoin;
    mes "An error happened.";
    goto L_Close;

L_SuccessJoin:
    mesq l("Done!");
    next;
    warp "testbg", 0, 0;
    close;

L_Init:
    $@BattleOn=1;
    mesq str( bg_get_data($@FK_Team1, 0) );
    mesq str( bg_get_data($@FK_Team2, 0) );
    next;
    //for 
    bg_warp $@FK_Team1, "testbg", 13, 4;
    bg_warp $@FK_Team2, "testbg", 13, 26;
    mesn;
    next;
    //setbgteam $@FK_Team1, 1;
    //setbgteam $@FK_Team2, 2;
    //mesn;
    //next;
	mapannounce("testbg", "May the fight begin!", bc_map);
    mesn;
    next;
	$@FKing_T1 = bg_monster($@FK_Team1, "testbg", 1, 1, "OldFallen", 1079, "BGMaster::OnVictor2");
	$@FKing_T2 = bg_monster($@FK_Team2, "testbg", 13, 28, "OldFallen2", 1080, "BGMaster::OnVictor1");
    mesn;
    next;
	initnpctimer();
    close;

L_Close:
    close;

L_Busy:
    mesq l("Sorry, registration period is over.");
    close;

OnPcQuit:
    warp "002-4", 0, 0;
    bg_leave();
    end;

OnPcDeath:
    warp "002-4", 0, 0;
    bg_leave();
    end;

OnTimer30000:
    if (getmapusers("testbg") < 2) goto L_RestartTimer;
	mapannounce("testbg", "Reinforcements raise!", bc_map);
	$@FKing_T1 = bg_monster($@FK_Team1, "testbg", 1, 1, "FallenGuard1", 1081, "BGMaster::OnSkip");
	$@FKing_T2 = bg_monster($@FK_Team2, "testbg", 13, 28, "FallenGuard2", 1082, "BGMaster::OnSkip");
	stopnpctimer();
	initnpctimer();
    end;

OnSkip:
    end;

L_Skip:
    end;

L_RestartTimer:
	stopnpctimer();
	initnpctimer();
    end;

OnVictor1:
    if (!$@BattleOn) goto L_Skip;
	stopnpctimer();
    announce "Team 1 raises victorious!", bc_all;
    bg_warp $@FK_Team1, "004-2", 29, 23;
    bg_warp $@FK_Team2, "004-2", 29, 23;
    bg_destroy($@FK_Team1);
    bg_destroy($@FK_Team2);
    $@BattleOn=0;
    end;

OnVictor2:
    if (!$@BattleOn) goto L_Skip;
	stopnpctimer();
    announce "Team 2 raises victorious!", bc_all;
    bg_warp $@FK_Team1, "004-2", 29, 23;
    bg_warp $@FK_Team2, "004-2", 29, 23;
    bg_destroy($@FK_Team1);
    bg_destroy($@FK_Team2);
    $@BattleOn=0;
    end;

OnInit:
    .@npcId = getnpcid(0, .name$);
    setunitdata(.@npcId, UDT_HEADTOP, 1322); // Dress
    setunitdata(.@npcId, UDT_HEADMIDDLE, 2204); // Not needed
    setunitdata(.@npcId, UDT_HEADBOTTOM, 1800); // Shoes
    setunitdata(.@npcId, UDT_WEAPON, 3501);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 12);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 5);
    npcsit;

	waitingroom("Hello World", 30);
    $@FK_Team1=waitingroom2bg("testbg", 13, 4, "BGMaster::OnPcQuit", "BGMaster::OnPcDeath");
    $@FK_Team2=waitingroom2bg("testbg", 13, 26, "BGMaster::OnPcQuit", "BGMaster::OnPcDeath");

    .sex = G_FEMALE;
    .distance = 5;
    end;
}