This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
queue_bg_on_official.txt
310 lines (268 loc) · 11.5 KB
/
queue_bg_on_official.txt
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
//===== rAthena Script =======================================
//= Queue Battleground
//===== By: ==================================================
//= Capuche
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= A sample queue system to register in official bg.
//= Diff of official bg at the end of the script.
//============================================================
bat_room,178,162,5 script Register BG 56,{
function CheckPlayerBg; function RegisterBg;
if( @side_tmp ) {
mes "You already are on the waiting line...";
mes "You have ^FF0000"+ ( getd( ".signup_count_"+ .name_bg$[ @bg_type ] + @side_tmp ) -1 ) +"^000000 People(s) before you.";
close;
}
mes "Would you like to compete ?";
next;
if( select( "Let's do it!", "no thanks" ) -1 ) close;
if( .random_bg ) // Random BG ?
.@s = .random_bg;
else {
mes "Select the bg.";
.@s = select( .menu_bg$ ) -1;
}
if( getd( ".random_"+ .name_bg$[.@s] ) ) // random team ? Croix or Guillaume
@side_tmp = .@side = ( getd( ".signup_count_"+ .name_bg$[.@s] +"1" ) == getd( ".min_size_"+ .name_bg$[.@s] ) ? 2 : ( getd( ".signup_count_"+ .name_bg$[.@s] +"2" ) == getd( ".min_size_"+ .name_bg$[.@s] ) ? 1 : rand( 1,2 ) ) );
else
@side_tmp = .@side = select( ( getd( ".signup_count_"+ .name_bg$[.@s] + "1" ) == getd( ".min_size_"+ .name_bg$[.@s] ) ? "" : "Croix side" ), ( getd( ".signup_count_"+ .name_bg$[.@s] + "2" ) == getd( ".min_size_"+ .name_bg$[.@s] ) ? "" : "Guillaume side" ) );
setd ".signup_aid_"+ .name_bg$[.@s] + .@side +"["+ getd( ".signup_count_"+ .name_bg$[.@s] + .@side ) +"]", getcharid(3);
setd ".signup_count_"+ .name_bg$[.@s] + .@side, getd( ".signup_count_"+ .name_bg$[.@s] + .@side ) +1;
CheckPlayerBg(); // Just clean the array queue
@bg_type = .@s;
switch( .@s ){
case 0: donpcevent "start#bat_b01::OnReadyCheck"; break;
case 1: donpcevent "start#bat_a01::OnReadyCheck"; break;
case 2: donpcevent "KvM01_BG::OnReadyCheck";
}
close;
// Functions Part
// --------------
// Assign a BG ID to the player when the bg start
// Delete aid and the count of players in the array queue
function RegisterBg {
.@s = getarg(0);
for( .@i = 0; .@i < getd( ".min_size_"+ .name_bg$[.@s] ); .@i++ ) {
setbgid getarg(1), getd( ".signup_aid_"+ .name_bg$[.@s] +"1[" +.@i +"]" );
setbgid getarg(2), getd( ".signup_aid_"+ .name_bg$[.@s] +"2[" +.@i +"]" );
}
deletearray getd( ".signup_aid_"+ .name_bg$[.@s] +"1" ), getd( ".min_size_"+ .name_bg$[.@s] );
deletearray getd( ".signup_aid_"+ .name_bg$[.@s] +"2" ), getd( ".min_size_"+ .name_bg$[.@s] );
setd ".signup_count_"+ .name_bg$[.@s] +"1", getd( ".signup_count_"+ .name_bg$[.@s] +"1" ) - getd( ".min_size_"+ .name_bg$[.@s] );
setd ".signup_count_"+ .name_bg$[.@s] +"2", getd( ".signup_count_"+ .name_bg$[.@s] +"2" ) - getd( ".min_size_"+ .name_bg$[.@s] );
if( .random_bg ) .random_bg = rand( 1,.size_bg );
end;
}
// clear the array
// send the player's position to his character in the bg queue
function CheckPlayerBg {
for( .@side = 1; .@side < 3; .@side++ ) {
for( .@j = 0; .@j < .size_bg; .@j++ ) {
for ( set .@i, 0; .@i < getd( ".signup_count_"+ .name_bg$[.@j] + .@side ); set .@i, .@i +1 ) {
if ( getd( ".signup_aid_"+ .name_bg$[.@j] + .@side +"["+.@i+"]" ) != getarg( 0,1 ) && attachrid( getd( ".signup_aid_"+ .name_bg$[.@j] + .@side +"["+.@i+"]" ) ) ) {
if ( getmapflag( strcharinfo(3), mf_battleground ) ) { // has join another bg, just in case
deletearray getd( ".signup_aid_"+ .name_bg$[.@j] + .@side +"["+.@i+"]" ), 1;
setd ".signup_count_"+ .name_bg$[.@j] + .@side, getd( ".signup_count_"+ .name_bg$[.@j] + .@side ) -1;
@bg_type = @side_tmp = 0;
.@i--;
}
else {
dispbottom "You have ^FF0000"+ ( getd( ".signup_count_"+ .name_bg$[.@j] + .@side ) - .@i -1 ) +"^000000 Peoples before you.";
@bg_type = .@j;
@side_tmp = .@side;
}
}
else {
deletearray getd( ".signup_aid_"+ .name_bg$[.@j] + .@side +"["+.@i+"]" ), 1;
setd ".signup_count_"+ .name_bg$[.@j] + .@side, getd( ".signup_count_"+ .name_bg$[.@j] + .@side ) -1;
.@i--;
}
}
}
}
return;
}
// Event Part
// ----------
OnFlaviusStart:
$@FlaviusBG1_id2 = createbgid( "bat_b01",390,10,"start#bat_b01::OnCroixQuit","" );
$@FlaviusBG1_id1 = createbgid( "bat_b01",10,290,"start#bat_b01::OnGuillaumeQuit","" );
RegisterBg( 0, $@FlaviusBG1_id1, $@FlaviusBG1_id2 ); // ( bg index in .name_bg$ ) ( bg1 id ) ( bg2 id )
OnTierraStart:
$@TierraBG1_id1 = createbgid( "bat_a01",50,374,"start#bat_a01::OnGuillaumeQuit","" );
$@TierraBG1_id2 = createbgid( "bat_a01",42,16,"start#bat_a01::OnCroixQuit","" );
RegisterBg( 1, $@TierraBG1_id1, $@TierraBG1_id2 );
OnKvMStart:
$@KvM01BG_id1 = createbgid( "bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie" );
$@KvM01BG_id2 = createbgid( "bat_c01",147,55,"KvM01_BG::OnCroixQuit","KvM01_BG::OnCroixDie" );
RegisterBg( 2, $@KvM01BG_id1, $@KvM01BG_id2 );
OnPCLogoutEvent:
CheckPlayerBg( getcharid(3) ); // Clear the array queue and delete the aid
end;
OnPCLoadMapEvent:
if( compare( strcharinfo(3), "bat_" ) || strcharinfo(3) == strnpcinfo(4) )
@bg_type = @side_tmp = 0;
end;
OnInit:
.random_bg = 0; // random bg ( 1 : random, 0 : choice bg )
.random_Flavius = 1; // Flavius random ? ( 1 : random, 0 : choice ) - if 1 the player has no choice he is sent in a random team
.random_Tierra = 1; // Tierra random ?
.random_KvM = 1; // KvM random ?
.min_size_Flavius = 1; // number min of players to start Flavius - must be the SAME in the flavius setting in the svn
.min_size_KvM = 1; // Tierra
.min_size_Tierra = 1; // KvM
setarray .name_bg$, "Flavius", "Tierra", "KvM"; // Menu + is used to set the variables. Don't touch if you don't know what you do.
// Others - no need to touch
setmapflag "bat_a01",mf_loadevent; // mapflag to clear the @ bg variables
setmapflag "bat_b01",mf_loadevent;
setmapflag "bat_c01",mf_loadevent;
setmapflag strnpcinfo(4),mf_loadevent;
mapannounce strnpcinfo(4), "An admin had reload please re-enregister.",0;
mapwarp strnpcinfo(4),"prontera",150,150,0; // to clear the @ bg variables when @reload
.size_bg = getarraysize( .name_bg$ );
.menu_bg$ = implode( .name_bg$, ":" );
if( .random_bg ) .random_bg = rand( 1,.size_bg );
end;
}
/*
Index: npc/battleground/flavius/flavius01.txt
===================================================================
--- npc/battleground/flavius/flavius01.txt (révision 17251)
+++ npc/battleground/flavius/flavius01.txt (copie de travail)
@@ -22,21 +22,22 @@
//============================================================
bat_room,86,227,4 script Lieutenant Ator 418,{
end;
-OnInit:
- waitingroom "Battle Station",11,"start#bat_b01::OnReadyCheck",1,0,80;
- end;
+// OnInit:
+ // waitingroom "Battle Station",2,"start#bat_b01::OnReadyCheck",1,0,80;
+ // end;
OnEnterBG:
- set $@FlaviusBG1_id1, waitingroom2bg("bat_b01",10,290,"start#bat_b01::OnGuillaumeQuit","");
+ // set $@FlaviusBG1_id1, waitingroom2bg("bat_b01",10,290,"start#bat_b01::OnGuillaumeQuit","");
end;
}
bat_room,85,204,0 script Lieutenant Thelokus 414,{
end;
-OnInit:
- waitingroom "Battle Station",11,"start#bat_b01::OnReadyCheck",1,0,80;
- end;
+// OnInit:
+ // waitingroom "Battle Station",11,"start#bat_b01::OnReadyCheck",1,0,80;
+ // end;
OnEnterBG:
- set $@FlaviusBG1_id2, waitingroom2bg("bat_b01",390,10,"start#bat_b01::OnCroixQuit","");
+ // set $@FlaviusBG1_id2, waitingroom2bg("bat_b01",390,10,"start#bat_b01::OnCroixQuit","");
+ donpcevent "Register BG::OnFlaviusStart";
end;
}
@@ -79,13 +80,15 @@
OnReadyCheck:
if( $@FlaviusBG1 )
end;
- set .@Guillaume, getwaitingroomstate(0,"Lieutenant Ator");
- set .@Croix, getwaitingroomstate(0,"Lieutenant Thelokus");
+// set .@Guillaume, getwaitingroomstate(0,"Lieutenant Ator");
+// set .@Croix, getwaitingroomstate(0,"Lieutenant Thelokus");
+ set .@Croix, getvariableofnpc( .signup_count_Flavius1, "Register BG" );
+ set .@Guillaume, getvariableofnpc( .signup_count_Flavius2, "Register BG" );
if( !.@Guillaume && !.@Croix ) {
donpcevent "#bat_b01_timer::OnStop";
end;
}
Index: npc/battleground/kvm/kvm01.txt
===================================================================
--- npc/battleground/kvm/kvm01.txt (révision 17251)
+++ npc/battleground/kvm/kvm01.txt (copie de travail)
@@ -24,12 +24,12 @@
bat_room,169,226,5 script KVM Waiting Room#a::KvM01R_Guillaume 418,{
end;
-OnInit:
- waitingroom "Battle Station 5 Players",6,"KvM01_BG::OnGuillaumeJoin",1;
- end;
+// OnInit:
+ // waitingroom "Battle Station 5 Players",6,"KvM01_BG::OnGuillaumeJoin",1;
+ // end;
OnEnterBG:
- set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
+ // set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
end;
}
@@ -38,12 +38,13 @@
bat_room,169,205,3 script KVM Waiting Room#b::KvM01R_Croix 414,{
end;
-OnInit:
- waitingroom "Battle Station 5 Players",6,"KvM01_BG::OnCroixJoin",1;
- end;
+// OnInit:
+ // waitingroom "Battle Station 5 Players",6,"KvM01_BG::OnCroixJoin",1;
+ // end;
OnEnterBG:
- set $@KvM01BG_id2, waitingroom2bg("bat_c01",147,55,"KvM01_BG::OnCroixQuit","KvM01_BG::OnCroixDie");
+ // set $@KvM01BG_id2, waitingroom2bg("bat_c01",147,55,"KvM01_BG::OnCroixQuit","KvM01_BG::OnCroixDie");
+ donpcevent "Register BG::OnKvMStart";
end;
}
@@ -173,10 +174,12 @@
OnReadyCheck:
if( $@KvM01BG )
end;
- set .@Guillaume, getwaitingroomstate(0,"KvM01R_Guillaume");
- set .@Croix, getwaitingroomstate(0,"KvM01R_Croix");
+ // set .@Guillaume, getwaitingroomstate(0,"KvM01R_Guillaume");
+ // set .@Croix, getwaitingroomstate(0,"KvM01R_Croix");
+ set .@Croix, getvariableofnpc( .signup_count_KvM1, "Register BG" );
+ set .@Guillaume, getvariableofnpc( .signup_count_KvM2, "Register BG" );
Index: npc/battleground/tierra/tierra01.txt
===================================================================
--- npc/battleground/tierra/tierra01.txt (révision 17251)
+++ npc/battleground/tierra/tierra01.txt (copie de travail)
@@ -23,24 +23,25 @@
bat_room,57,227,5 script Lieutenant Kalos 418,{
end;
-OnInit:
- waitingroom "Battle Station",11,"start#bat_a01::OnReadyCheck",1,0,80;
- end;
+// OnInit:
+ // waitingroom "Battle Station",11,"start#bat_a01::OnReadyCheck",1,0,80;
+ // end;
OnEnterBG:
- set $@TierraBG1_id1, waitingroom2bg("bat_a01",50,374,"start#bat_a01::OnGuillaumeQuit","");
+ // set $@TierraBG1_id1, waitingroom2bg("bat_a01",50,374,"start#bat_a01::OnGuillaumeQuit","");
end;
}
bat_room,58,204,1 script Lieutenant Eyor 414,{
end;
-OnInit:
- waitingroom "Battle Station",11,"start#bat_a01::OnReadyCheck",1,0,80;
- end;
+// OnInit:
+ // waitingroom "Battle Station",11,"start#bat_a01::OnReadyCheck",1,0,80;
+ // end;
OnEnterBG:
- set $@TierraBG1_id2, waitingroom2bg("bat_a01",42,16,"start#bat_a01::OnCroixQuit","");
+ // set $@TierraBG1_id2, waitingroom2bg("bat_a01",42,16,"start#bat_a01::OnCroixQuit","");
+ donpcevent "Register BG::OnTierraStart";
end;
}
@@ -127,13 +128,15 @@
OnReadyCheck:
if( $@TierraBG1 )
end;
- set .@Guillaume, getwaitingroomstate(0,"Lieutenant Kalos");
- set .@Croix, getwaitingroomstate(0,"Lieutenant Eyor");
+ // set .@Guillaume, getwaitingroomstate(0,"Lieutenant Kalos");
+ // set .@Croix, getwaitingroomstate(0,"Lieutenant Eyor");
+ set .@Croix, getvariableofnpc( .signup_count_Tierra1, "Register BG" );
+ set .@Guillaume, getvariableofnpc( .signup_count_Tierra2, "Register BG" );
if( !.@Guillaume && !.@Croix ) {
donpcevent "#bat_a01_timer::OnStop";
end;
}
*/