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
/
instance_time_round.txt
390 lines (368 loc) · 14.2 KB
/
instance_time_round.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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
//===== rAthena Script =======================================
//= Instance
//===== By: ==================================================
//= Capuche
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Base on this request :
//= http://rathena.org/board/topic/78529-instance-script/?hl=instance
//----------------------------------------------------
//= An instance on 1@guild (just make a map).
//= Players must be in party.
//= Spawn amount and ID of mob/difficulty/number of player in
//= the party.
//= Players have some time to kill the mobs each round. If
//= they fail => end.
//= Each round, they gain #hero_points.
//============================================================
// ~~~~~ show time left in days, hours, minutes and seconds ~~~~~
function script timeleft__ {
if ( ( .@left = getarg(0) ) <= 0 ) return getarg(0);
.@day = .@left / 86400;
.@hour = .@left % 86400 / 3600;
.@min = .@left % 3600 / 60;
.@sec = .@left % 60;
if ( .@day )
return .@day +" day "+ .@hour +" hour";
else if ( .@hour )
return .@hour +" hour "+ .@min +" min";
else if ( .@min )
return .@min +" min "+ .@sec +" sec";
else
return .@sec +" sec";
}
prontera,152,178,3 script szfjkii 406,{
mes "- each difficulty have 10 levels",
"- each difficulty have given time to finish the instance",
"- for Normal: 30 minutes",
"- for Hard: 45 minutes",
"- for Nightmare: 60 minutes",
"- for Hardcore: 90 minutes";
next;
// can re-enter if already generated
if( instance_id(1) && getcharid(1) ) {
if ( select( "Enter", "Cancel" ) -1 ) {
mes "See ya.";
close;
}
if ( has_instance( .map_inst$ ) == "" ) {
mes "Your group is already registered at an other instance.";
close;
}
getpartymember getcharid(1), 1;
if ( $@partymembercount > .max_players ) {
mes "Maximum of "+ .max_players +" members in the party";
close;
}
// check job if a player is invited
if( .same_job ) {
.@self = getcharid(3);
for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {
attachrid( $@partymemberaid[ .@i ] );
.@job_name$ = .@job_name$ + jobname(Class) +"|";
}
}
attachrid( .@self );
if( countstr( .@job_name$, jobname(Class) ) > 1 ) {
mes "sorry there is 2 same job in the party, you can't enter.";
close;
}
}
// check delay if a player is invited
for( .@i = 0; .@i < getarraysize( getd( ".char_id"+ getcharid(1) ) ); .@i++ )
if( getd( ".char_id"+ getcharid(1) +"["+ .@i +"]" ) == getcharid(0) ) {
.@pass = 1;
break;
}
if( !.@pass ) {
if( gettimetick(2) < Delay_instance ) {
mes "sorry you must wait "+ callfunc( "timeleft__", Delay_instance - gettimetick(2) ) +" before enter";
close;
}
.@size = getarraysize( getd( ".char_id"+ getcharid(1) ) );
setd( ".char_id"+ getcharid(1) +"[ "+ .@size +" ]", getcharid(0) );
Delay_instance = gettimetick(2) + 3600 * 3;
}
instance_announce instance_id(1), strcharinfo(0)+" of the party "+ getpartyname( getcharid(1) ) +" is entering in the instance.",bc_map;
warp has_instance( .map_inst$ ),50,50;
end;
}
if ( select ( "Normal", "Hard", "Hardcore", "Nightmare", "Leave" ) == 5 ) {// using @menu for instancing
mes "See ya.";
close;
}
else if( !getcharid(1) ) {
mes "You need to be in party ( Maximum of "+ .max_players +" members ).";
close;
}
// check delay of players in the party
getpartymember getcharid(1), 1;
getpartymember getcharid(1), 2;
.@self = getcharid(3);
for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {
attachrid( $@partymemberaid[ .@i ] );
if( gettimetick(2) < Delay_instance ) {
.@name$ = strcharinfo(0);
.@time = Delay_instance - gettimetick(2);
attachrid( .@self );
mes "sorry "+ .@name$ +" must wait "+ callfunc( "timeleft__", .@time ) +" before enter";
close;
}
else if( compare( .@job_name$, jobname(Class) ) && .same_job ) {
.@name$ = strcharinfo(0);
.@job$ = jobname(Class);
attachrid( .@self );
mes "sorry, "+ .@name$ +" is "+ .@job$ +" and there is already a "+ .@job$ +" in the party";
close;
}
.@job_name$ = .@job_name$ + jobname(Class) +"|";
}
}
attachrid( .@self );
if ( $@partymembercount > .max_players ) {
mes "Maximum of "+ .max_players +" members in the party";
close;
}
else if( getpartyleader( getcharid(1),2 ) != getcharid(0) ) {
mes "I only talk to your leader.";
close;
}
mes "If the instance is successfully generated all your party will be warp inside. Get ready";
next;
.@inst_id = instance_create( .name_inst$,getcharid(1) );
if( .@inst_id < 0 ){
mes "Failed. Contact a GM.";
close;
}
instance_attachmap( .map_inst$,.@inst_id );
instance_set_timeout .timelimit[ @menu ], .timeidle, .@inst_id;
instance_init .@inst_id;
instance_attach .@inst_id;
'diff$ = .diff$[ @menu ];
'party_id = getcharid(1);
'time_inst = gettimetick(2) + .timelimit[ @menu ];
'inst_id = .@inst_id;
'max_players = .max_players;
donpcevent instance_npcname( "Inst_cust" ) +"::Oninstancing";
sleep2 50;
getpartymember getcharid(1), 1;
getpartymember getcharid(1), 2;
.@self = getcharid(3);
if( .same_job ) {
.@job_name$ = "";
for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {
attachrid( $@partymemberaid[ .@i ] );
.@job_name$ = .@job_name$ + jobname(Class) +"|";
}
}
}
// dispbottom .@job_name$;
for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {
attachrid( $@partymemberaid[ .@i ] );
if( gettimetick(2) >= Delay_instance && countstr( .@job_name$, jobname(Class) ) <= 1 ) {
Delay_instance = gettimetick(2) + 3600 * 3;
.@size = getarraysize( getd( ".char_id"+ getcharid(1) ) );
setd( ".char_id"+ getcharid(1) +"[ "+ .@size +" ]", getcharid(0) );
warp has_instance( .map_inst$ ),50,50;
}
}
}
// warpparty has_instance( .map_inst$ ),50,50, getcharid(1);
close;
OnDelete:
deletearray getd( ".char_id"+ getvariableofnpc( .party_id, "Inst_cust") );
end;
OnInit:
.same_job = 1; // DON'T allow 2 same job to enter in the instance
.map_inst$ = "1@guild"; // instance map's name
.name_inst$ = "Custom instance"; // instance name display
.timeidle = 300; // time (sec) to re-enter in the instance when all players outside
.max_players = 4; // max players in the party
// time limit (sec) of the instance per level - Normal, Hard, Hardcore, Nightmare
setarray .timelimit[ 1 ], 1800, 2700, 3600, 4500;
// Difficulty's names - Don't touch
setarray .diff$[ 1 ], "Normal", "Hard", "Hardcore", "Nightmare";
end;
}
1@guild,0,0,0 script Inst_cust -1,{
function Countpartyonline;
function Reward;
OnInit:
.npc_enter$ = "szfjkii"; // name of the NPC to enter in the instance
// Number ( monsters / round / difficulty ) initialized
setarray .mob_init_Normal[ 1 ], 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
setarray .mob_init_Hard[ 1 ], 2, 3, 4, 5, 6, 7, 8, 9, 10, 12;
setarray .mob_init_Hardcore[ 1 ], 3, 4, 5, 6, 7, 8, 9, 10, 11, 13;
setarray .mob_init_Nightmare[ 1 ], 5, 6, 7, 8, 9, 10, 12, 14, 16, 20;
// Hero ( points / round / difficulty ) - using #hero_points variable
setarray .hero_points_Normal[ 1 ], 100,110,120,130,140,150,160,170,180,200;
setarray .hero_points_Hard[ 1 ], 120,140,160,180,200,220,240,260,280,300;
setarray .hero_points_Hardcore[ 1 ], 150,180,210,240,270,300,330,360,390,420;
setarray .hero_points_Nightmare[ 1 ], 200,250,300,350,400,450,500,550,600,700;
// Time (min) / round / difficulty
setarray .time_Normal[ 1 ], 1,2,3,4,5,6,7,8,9,10;
setarray .time_Hard[ 1 ], 2,4,6,8,10,12,14,16,18,20;
setarray .time_Hardcore[ 1 ], 3,6,9,12,15,18,21,24,27,30;
setarray .time_Nightmare[ 1 ], 4,8,12,16,20,24,28,32,36,40;
// Mob ID / round
// Level : Normal
setarray .mob_ID_Normal_round1[ 0 ], 1002,1005,1004;// poring, hornet, familiar
setarray .mob_ID_Normal_round2[ 0 ], 1002,1005;
setarray .mob_ID_Normal_round3[ 0 ], 1002,1005,1004;
setarray .mob_ID_Normal_round4[ 0 ], 1002,1005,1004;
setarray .mob_ID_Normal_round5[ 0 ], 1002,1005,1004,1005;
setarray .mob_ID_Normal_round6[ 0 ], 1002,1005,1004;
setarray .mob_ID_Normal_round7[ 0 ], 1002,1005,1004;
setarray .mob_ID_Normal_round8[ 0 ], 1002,1005,1004;
setarray .mob_ID_Normal_round9[ 0 ], 1002,1005,1004;
setarray .mob_ID_Normal_round10[ 0 ], 1002,1005,1004;
// Level : Hard
setarray .mob_ID_Hard_round1[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round2[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round3[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round4[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round5[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round6[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round7[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round8[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round9[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hard_round10[ 0 ], 1002,1005,1004;
// Level : Hardcore
setarray .mob_ID_Hardcore_round1[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round2[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round3[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round4[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round5[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round6[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round7[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round8[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round9[ 0 ], 1002,1005,1004;
setarray .mob_ID_Hardcore_round10[ 0 ], 1002,1005,1004;
// Level : Nightmare
setarray .mob_ID_Nightmare_round1[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round2[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round3[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round4[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round5[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round6[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round7[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round8[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round9[ 0 ], 1002,1005,1004;
setarray .mob_ID_Nightmare_round10[ 0 ], 1002,1005,1004;
.round_max = 10; // round max
end;
// Instance start
// --------------
Oninstancing:
sleep 10000;
// New round
// ---------
LStart:
'round++;
instance_announce 'inst_id, 'round + ( 'round % 10 == 1 ? "st" : ( 'round % 10 == 2 ? "nd" : ( 'round % 10 == 3 ? "rd" : "th" ) ) ) +" round in :", bc_map;
for( .@i = 5; .@i > 0; .@i-- ) {
instance_announce 'inst_id, .@i +"" ,bc_map;
sleep 1000;
}
donpcevent instance_npcname( "Inst_cust" ) +"::OnTimevent";// initialize time limit for the round
goto OnRound;
// Monster is dead : check player on map + reward if 0 mob
// -------------------------------------------------------
OnMobDead:
if( instance_check_party( 'party_id,'max_players +1 ) ) {// check if there are more than 4 players in the party instance
instance_announce 'inst_id, "To much players. End of instance.", bc_map;
'round = .round_max + 1;
goto L_pr;
}
'count = mobcount( strnpcinfo(4), instance_npcname( "Inst_cust", 'inst_id ) +"::OnMobDead" );
instance_announce instance_id(0), 'count +" monsters left" ,bc_map;
if( !'count ) {
instance_announce 'inst_id, "All monsters on the "+ 'round + ( 'round % 10 == 1 ? "st" : ( 'round % 10 == 2 ? "nd" : ( 'round % 10 == 3 ? "rd" : "th" ) ) ) +" level have been defeated.", bc_map;
Reward();// hero points / round / difficulty
if( 'round == .round_max ) {
'round = .round_max + 1;
goto L_end;
}
goto LStart;
}
end;
// Random (spawn / round / difficulty)
// -----------------------------------
OnRound:
.@spawn = 'count = Countpartyonline() + getd( ".mob_init_"+ 'diff$ +"[ "+ 'round +" ]" );// spawn count = ( monster initialized / round / difficulty ) + number players online in party
instance_announce 'inst_id, "you have "+ getd( ".time_"+ 'diff$ +"[ "+ 'round +" ]" ) +" min to finish this round in "+ 'diff$ +" mode. "+ .@spawn +" mobs are spawned",bc_map;
while( .@spawn ) {// spawned ( monster / round / difficulty ) randomly
.@rand = rand( 1,.@spawn );// number mobs
.@spawn = .@spawn - .@rand;
.@i = rand( getarraysize( getd( ".mob_ID_"+ 'diff$ +"_round"+ 'round ) ) );// ID mob
monster "1@guild",0,0,"--ja--", getd( ".mob_ID_"+ 'diff$ +"_round"+ 'round +"[ "+ .@i +" ]" ), .@rand, instance_npcname( strnpcinfo(0),'inst_id )+"::OnMobDead";
}
end;
// End of instance
// ---------------
L_end:
instance_announce 'inst_id, "Congratulation you have finished the instance in "+ callfunc( "timeleft__", 'time_inst - gettimetick(2) ), bc_map;
OnTimevent:// time limit / round / difficulty
awake instance_npcname( "Inst_cust" );
if( 'round <= .round_max ) {
sleep 1;
'tmp = 'round;
sleep 1000 * 60 * getd( ".time_"+ 'diff$ +"[ "+ 'round +" ]" );
if( 'round != 'tmp ) end;
instance_announce 'inst_id, "you take to much time.", bc_map;
}
L_pr:
instance_warpall "prontera", 152,178, 'inst_id;
.party_id = 'party_id;
donpcevent .npc_enter$ +"::OnDelete";
sleep 500;
instance_destroy 'inst_id;
end;
// Functions
// ---------
function Countpartyonline {
getpartymember 'party_id, 1;
getpartymember 'party_id, 2;
for( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) && getarg( 0,1 ) ) .@j++;
// else if( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) && !getarg( 0,1 ) ) {
// attachrid( $@partymemberaid[ .@i ] );
// Delay_instance = gettimetick(2) + 3600 * 3;
// }
}
return .@j;
}
function Reward {
getpartymember 'party_id, 1;
getpartymember 'party_id, 2;
.@tmp$ = strcharinfo(3);
for( .@i = 0; .@i < $@partymembercount; .@i++ )
if( isloggedin( $@partymemberaid[ .@i ], $@partymembercid[ .@i ] ) ) {
attachrid( $@partymemberaid[ .@i ] );
if( strcharinfo(3) == .@tmp$ ) {
#hero_points = #hero_points + getd( ".hero_points_"+ 'diff$ +"[ "+ 'round +" ]" );
dispbottom "Gained : "+ getd( ".hero_points_"+ 'diff$ +"[ "+ 'round +" ]" ) +" Hero Points. Total : "+ #hero_points;
}
}
return;
}
// function Delayparty {
// Countpartyonline( 0 );
// return;
// }
}
1@guild mapflag nowarp
1@guild mapflag partylock
1@guild mapflag nowarpto
1@guild mapflag noteleport
1@guild mapflag nosave SavePoint
1@guild mapflag nomemo
1@guild mapflag nobranch
1@guild mapflag monster_noteleport