viewing paste topic/4646- bg_queue_bug_onquit | Athena
Posted on the | Last edited on
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
| /*
},{
name: "KVM (Level 60~79)" //must match the name in client files
event: "bg_emp::OnStart"
minLevel: 1
maxLevel: 150
reward: { // useless ! should be done by npc scripting
win: 0
loss: 0
draw: 0
}
minPlayers: 4 // minimum amount of players to start
maxPlayers: 5 // maximum amount of players. NOTE: I wonder why they set to 60 when MAX_BG_MEMBERS is only 30 <_<
minTeamPlayers: 2 // try this to test
delay_var: "BG_EMP_Tick" // char variable name that will store the delay for this match
maxDuration: 1 // maximum duration in minutes ... this one also bugged
fillDuration: 20 // time in seconds to wait for more applications when minimum has been reached
pGameDuration: 20 // time to wait for players to confirm their attendence after queueing process has finished
},{
*/
function script rand__ {
.@range = getarg(0);
.@count = getarg(2, 0);
if ( !.@count || .@count > .@range )
.@count = .@range;
else if ( .@count > 128 )
.@count = 128;
while ( .@i < .@count ) {
.@r = .@save = rand( .@i, .@range -1 ) ;
if ( !getd( ".@tmp1_"+ .@i ) ) {
.@r = ( getd(".@tmp1_"+ .@r ) )? getd( ".@tmp2_"+ .@r ) : .@r;
setd ".@tmp2_"+ .@i, .@r;
setd ".@tmp2_"+ .@save , .@i;
setd ".@tmp1_"+ .@save , 1;
set getelementofarray( getarg(1), .@i ), .@r;
if ( .@save < .@count )
set getelementofarray( getarg(1), .@save ), .@i;
}
.@i++;
}
return .@count;
}
- script bg_emp -1,{
OnInit:
.eventlasting = 3; // duration in minutes
setarray .rewardwin, 501,10, 502,5, 503,3; // reward to winning team
setarray .rewardlose, 501,5, 502,3, 503,1; // reward to losing team
setarray .rewarddraw, 501,3, 502,1; // reward to both teams when draw
.rewardwinsize = getarraysize( .rewardwin );
.rewardlosesize = getarraysize( .rewardlose );
.rewarddrawsize = getarraysize( .rewarddraw );
end;
OnStart:
// Note: the server pushed these variables
for ( .@i = 0; .@i < $@bg_member_size; .@i++ ) {
switch ( $@bg_member_type[.@i] ) {
case 0: announce rid2name( $@bg_member[.@i] ) +" SOLO", 0; break;
case 1: announce rid2name( $@bg_member[.@i] ) +" from GUILD ["+ getguildname( $@bg_member_group[.@i] ) +"]", 0; break;
case 2: announce rid2name( $@bg_member[.@i] ) +" from PARTY ["+ getpartyname( $@bg_member_group[.@i] ) +"]", 0; break;
}
}
// that's all I need for the battleground script to work, no need to use their 12 script commands
debugmes "Battleground Queue Start";
.red = createbgid( "guild_vs3", 45,50, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead" );
.blue = createbgid( "guild_vs3", 55,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead" );
.teamname$[.red] = "Red";
.teamname$[.blue] = "Blue";
callfunc "rand__", $@bg_member_size, $@rand;
.@modulus = rand(2);
for ( .@i = 0; .@i < $@bg_member_size; .@i++ )
setbgid ( .@i % 2 == .@modulus )? .red : .blue, $@bg_member[ $@rand[.@i] ];
bg_updatescore "guild_vs3", 0,0;
bg_warp .red, "guild_vs3", 45,50;
bg_warp .blue, "guild_vs3", 55,50;
bg_monster .red,"guild_vs3",47,50, "--ja--",1915, strnpcinfo(3)+"::OnRedDown";
bg_monster .blue,"guild_vs3",52,50, "--ja--",1914, strnpcinfo(3)+"::OnBlueDown";
sleep .eventlasting * 60000;
killmonsterall "guild_vs3";
if ( .winside == 1 ) {
mapannounce "guild_vs3", "- Red Team is victorious! -", bc_map;
callsub L_reward, .red, .rewardwin, .rewardwinsize;
callsub L_reward, .blue, .rewardlose, .rewardlosesize;
}
else if ( .winside == 2 ) {
mapannounce "guild_vs3", "- Blue Team is victorious! -", bc_map;
callsub L_reward, .blue, .rewardwin, .rewardwinsize;
callsub L_reward, .red, .rewardlose, .rewardlosesize;
}
else {
mapannounce "guild_vs3", "- The match has ended in a draw! -", bc_map;
callsub L_reward, .red, .rewarddraw, .rewarddrawsize;
callsub L_reward, .blue, .rewarddraw, .rewarddrawsize;
}
sleep 5000;
mapwarp "guild_vs3","prontera",152,178;
bg_destroy .red;
bg_destroy .blue;
.winside = 0;
sleep 1000;
bg_match_over "KVM (Level 60~79)"; // for some reason this one has to be execute in delay ? otherwise my client crash !
debugmes "Battleground Queue Ends";
end;
L_reward:
getbgusers getarg(0);
for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )
for ( .@j = 0; .@j < getarg(2); .@j += 2 )
getitem getelementofarray( getarg(1), .@j ), getelementofarray( getarg(1), .@j +1 ), $@arenamembers[.@i];
return;
OnRedDown: callsub L_EmpDown, .red, 2;
OnBlueDown: callsub L_EmpDown, .blue, 1;
L_EmpDown:
mapannounce "guild_vs3", strcharinfo(0) +" has destroyed "+ .teamname$[ getarg(0) ] +" Team's Emperium.", bc_map;
.winside = getarg(1);
awake strnpcinfo(0);
end;
OnRedDead:
OnBlueDead:
debugmes "Battleground Queue "+ strcharinfo(0) +" has dead";
sleep2 1250;
percentheal 100,100;
end;
OnRedQuit: callsub L_Quit, .red, 2;
OnBlueQuit: callsub L_Quit, .blue, 1;
L_Quit:
debugmes "Battleground Queue "+ strcharinfo(0) +" quit battleground";
percentheal 100, 100;
bg_leave;
if ( bg_get_data( getarg(0), 0 ) ) end;
mapannounce "guild_vs3", "All "+ .teamname$[ getarg(0) ] +" team members have quit!", bc_map, 0xff3333;
.winside = getarg(1);
awake strnpcinfo(0);
end;
}
- script kdfhksfdsf -1,{
OnPCLogoutEvent:
debugmes strcharinfo(0) +" has logout";
end;
}
guild_vs3 mapflag battleground 2
guild_vs3 mapflag nosave SavePoint
guild_vs3 mapflag nowarp
guild_vs3 mapflag nowarpto
guild_vs3 mapflag noteleport
guild_vs3 mapflag nomemo
guild_vs3 mapflag nopenalty
guild_vs3 mapflag nobranch
guild_vs3 mapflag noicewall
prontera,152,178,5 script bg_pvp#random 733,{
OnInit:
.minplayer2start = 1; // minimum players to start (ex. if 3vs3, set to 3)
.eventlasting = 20*60; // event duration before auto-reset (20 minutes * seconds)
setarray .rewarditem[0], // rewards for the winning team:
501, 10; // <item>,<amount>
waitingroom "bg_pvp", .minplayer2start *2 +1, strnpcinfo(0) +"::OnStart", .minplayer2start *2;
end;
OnStart:
if ( getwaitingroomstate(0) < .minplayer2start *2 ) end;
debugmes "Battleground Normal Start";
getmapxy .@map$, .@x, .@y, 1;
warpwaitingpc .@map$, .@x, .@y, .minplayer2start *2;
.red = createbgid( "guild_vs3", 13,50, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead" );
.blue = createbgid( "guild_vs3", 86,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead" );
for ( .@i = 0; .@i < $@warpwaitingpcnum; .@i++ )
setbgid ( .@i % 2 )? .red : .blue, $@warpwaitingpc[.@i];
delwaitingroom strnpcinfo(0);
bg_warp .red, "guild_vs3", 13,50;
bg_warp .blue, "guild_vs3", 86,50;
.score[1] = .score[2] = .minplayer2start;
bg_updatescore "guild_vs3", .score[1], .score[2];
sleep .eventlasting * 1000;
if ( .score[1] > .score[2] ) {
mapannounce "guild_vs3", "- Red Team is victorious! -", bc_map;
callsub L_Reward, .red;
}
else if ( .score[1] < .score[2] ) {
mapannounce "guild_vs3", "- Blue Team is victorious! -", bc_map;
callsub L_Reward, .blue;
}
else
mapannounce "guild_vs3", "- The match has ended in a draw! -", bc_map;
mapwarp "guild_vs3","prontera",152,178;
bg_destroy .red;
bg_destroy .blue;
waitingroom "bg_pvp", .minplayer2start *2 +1, strnpcinfo(0) +"::OnStart", .minplayer2start *2;
debugmes "Battleground Normal Ends";
end;
L_Reward:
getbgusers getarg(0);
for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )
getitem .rewarditem[0], .rewarditem[1], $@arenamembers[.@i];
return;
OnRedDead: callsub L_Dead, 1;
OnBlueDead: callsub L_Dead, 2;
L_Dead:
debugmes "Battleground Normal "+ strcharinfo(0) +" has dead";
warp "Save", 0,0;
.score[ getarg(0) ]--;
bg_updatescore "guild_vs3", .score[1], .score[2];
bg_leave;
if ( !.score[ getarg(0) ] )
awake strnpcinfo(0);
sleep2 1250;
percentheal 100,100;
end;
OnRedQuit: callsub L_Quit, 1;
OnBlueQuit: callsub L_Quit, 2;
L_Quit:
debugmes "Battleground Normal "+ strcharinfo(0) +" quit battleground";
.score[ getarg(0) ]--;
bg_updatescore "guild_vs3", .score[1], .score[2];
if ( !.score[ getarg(0) ] )
awake strnpcinfo(0);
percentheal 100, 100;
end;
} |
Viewed 1696 times, submitted by
AnnieRuru.