- script NoviceVsZombie -1,{
OnInit:
RegisterSchedule("*",02,12,"RFYL Novice");
// item reward
setarray .item,
501, 10,
502, 5;
// zombiestart - gm manual start
bindatcmd "zombiestart", strnpcinfo(0)+"::OnStart",60,60;
// @zombie - player join event
bindatcmd "zombie", strnpcinfo(0)+"::OnJoinEvent";
// Event cooldown
.event_cd = 60 * 60 * 1; // 1hr
// Mapflags
setarray .@mapflag,
mf_nowarp,
mf_nowarpto,
mf_noskill,
mf_noteleport,
mf_nomemo,
mf_nosave,
mf_noicewall,
mf_nobranch,
mf_noreturn,
mf_nocommand;
for ( .@i = 0; .@i < getarraysize(.@mapflag); .@i++)
setmapflag "quiz_01", .@mapflag[.@i];
.@min = gettime(DT_MINUTE)*60;
.@sec = gettime(DT_SECOND);
.event_time = (gettimetick(2) - ( .@min + .@sec )) + .event_cd - 5;
end;
OnJoinEvent:
mes " [ Event Status ] ";
if ( !.start ) mes "Next schedule starts in ^FF0000"+ Time2Str(.event_time) +"^000000.";
if ( .start == 1 ) mes "Event is currently active.";
if ( .start == 2 ) mes "Event is currently on-going.";
next;
switch(select(
"Novice v Zombie Event - "+ ((.start == 1) ? "^00ff00Join Event":((.start == 2) ? "^00ff00Event On-Going":"^ff0000Not Available"))+"^000000" )) {
case 1:
if ( !.start ) {
mes "Event is not available.";
close;
} else if ( .start == 2 ) {
mes "Event is on-going";
close;
}
if ( BaseLevel > 10 || Class != 0 ) {
mes "Only Lv 10 Novice can enter.";
close;
}
if ( CharStatus > 10 || Class != 0 ) {
mes "Only Stats 10 Below can enter.";
close;
}
else {
getinventorylist;
if ( @inventorylist_amount ) {
mes "You store all your items first.";
close2;
@inventorylist_amount = false;
end;
}
sc_end SC_ALL;
sc_start SC_DECREASEAGI,600000,10;
percentheal 100,100;
warp "quiz_01",42,369;
}
}
end;
OnStart: .@force = true;
.@time = gettimetick(2);
.@min = gettime(DT_MINUTE)*60;
.@sec = gettime(DT_SECOND);
if ( .event_time > .@time && !.@force || .start && !.@force ) end; // doesnt start if cd isn't done.
.event_time = (.@time - ( .@min + .@sec )) + .event_cd - 5;
.start = 1;
killmonsterall "quiz_01";
announce "Event Manager: We are going to have a Novice Vs. Zombie event.",0;
sleep 10000;
announce "Event Manager: For those who wants to join, use @niko",0;
sleep 10000;
announce "Event Manager: Novice Vs. Zombie Event will be closing after 1 minute", 0;
sleep 20000;
announce "Event Manager: Last 30 second", 0;
sleep 10000;
announce "Event Manager: For those who wants to join, use @niko", 0;
sleep 10000;
announce "Event Manager: Last 10 second to join", 0;
sleep 5000;
announce "Event Manager: 5", 0;
sleep 1000;
announce "Event Manager: 4", 0;
sleep 1000;
announce "Event Manager: 3", 0;
sleep 1000;
announce "Event Manager: 2", 0;
sleep 1000;
announce "Event Manager: 1", 0;
sleep 1000;
announce "Event Manager: The entry to the event is now closed.", 0;
if ( getmapusers("quiz_01") <= 1 ) {
announce "Event Manager: Not enough participants.",0;
.start = false;
mapwarp "quiz_01", "prontera", 150, 180; // warp out.
end;
}
.start = 2;
sleep 3500;
mapannounce "quiz_01","We're about to begin the event.",bc_map,0x0ceedb;
sleep 2500;
mapannounce "quiz_01","The rules are simple.",bc_map,0x0ceedb;
sleep 2500;
mapannounce "quiz_01","Zombies will be spawned in the map.",bc_map,0x0ceedb;
sleep 2500;
mapannounce "quiz_01","and will apear every 20 seconds.",bc_map,0x0ceedb;
sleep 2000;
mapannounce "quiz_01","Last man surviving wins.",bc_map,0x0ceedb;
sleep 2000;
mapannounce "quiz_01","That's all. Let's begin.",bc_map,0x0ceedb;
sleep 3000;
monster "quiz_01",42,369,"Zombie",1036,4;
initnpctimer;
end;
OnTimer20000: // 20 seconds timer and also player check on how many left in map
monster "quiz_01",42,369,"Zombie",1036,10;
setnpctimer 0;
end;
OnPCDieEvent:
if ( .start && strcharinfo(3) == "quiz_01" ) {
warp "prontera",rand(148,163),rand(167,186);
if ( getmapusers("quiz_01") == 1 ) {
stopnpctimer;
killmonsterall "quiz_01";
.@size = getmapunits(BL_PC,"quiz_01",.@aid);
.@amt = getarraysize(.item);
.start = false;
attachrid .@aid;
announce strcharinfo(0)+" has won the Novice v Zombie Event.",bc_all,0x0ceedb;
for ( .@j = 0; .@j < .@amt; .@j += 2 )
getitem .item[.@j], .item[.@j+1];
warp "prontera",rand(148,163),rand(167,186);
end;
}
}
end;
}