prontera,98,254,5 script Event 792,{
mes "[" + strnpcinfo( 1 ) + "]";
mes "Do you want to take part in this event?";
next;
switch( select( "Enter.:Cancel." ) ) {
case 1:
percentheal 100, 100;
warp "quiz_01", 237, 270;
mapannounce "quiz_01", "Player " + strcharinfo( 0 ) + " entered the event.", bc_map;
break;
case 2:
mes "[" + strnpcinfo( 1 ) + "]";
mes "Come again if you change your mind.";
close;
break;
}
}
quiz_01,182,183,5 script Event3 -1,{
waitingroom "Waiting", 0;
OnStartEvent:
OnMinute50:
if ( .status ) {
dispbottom "Error: Event is allready running.";
end;
}
announce "The Event has started, you have 1 minute to join!", bc_all;
set .status, 1;
enablenpc "Event";
sleep( 30000 );
announce "You have 30 seconds left!", bc_all;
sleep( 15000 );
announce "You have 15 seconds left!", bc_all;
sleep( 10000 );
disablenpc "Event";
if( getmapusers( "quiz_01" ) <= 1 ) {
announce "Not enough people participated and the event ends without a result.", bc_all;
set .status, 0;
mapwarp "quiz_01", "prontera", 96, 244;
end;
}
announce "The Event has started!", bc_all;
set .currentWave, 0;
OnNextWave:
set .mobCount, 2;
set .currentWave, .currentWave + 1;
for( set .@i, 0; .@i < .mvpCount; set .@i, .@i + 1 ) {
.@monsterId = .@mvps[ rand( .mvpCount ) ];
monster "quiz_01", 0, 0, getmonsterinfo( .@monsterId, 0 ), .@monsterId, 1, strnpcinfo( 3 ) + "::OnMobDead";
}
end;
OnMobDead:
if ( !.status ) end;
set .mobCount, .mobCount - 1;
set .@playersLeft, getmapusers( "quiz_01" );
if( .mobCount == 1 )
mapannounce "quiz_01","One MVP and " + .@playersLeft + " players left on wave #" + .currentWave + ".", bc_map;
if( .mobCount == 0 ) {
announce "All MVPs have been killed on wave #" + .currentWave + " a new one will spawn!", bc_all;
goto OnNextWave;
}
end;
OnStopEvent:
set .@stopEvent, 1;
OnPCLogoutEvent:
OnPCDieEvent:
set .@playersLeft, getmapusers( "quiz_01" );
if( .@playersLeft == 1 || .@stopEvent ) {
killmonsterall "quiz_01";
set .status, 0;
if( !.@stopEvent ) {
set .@accountIdCount, query_sql( "SELECT`account_id` FROM `char`", .@accountIds );
for( set .@i, 0; .@i < .@accountIdCount; set .@i, .@i + 1 ) {
if( attachrid( .@accountIds[ .@i ] ) ) {
if( strcharinfo( PC_MAP ) == "quiz_01" )
break;
}
sleep( 100 );
}
percentheal 100, 100;
announce "Player " + strcharinfo( PC_NAME ) + " won the event! Congratulations!", bc_all;
getitem .priceId, .priceAmount;
sleep2( 5000 );
warp "prontera", 96, 244;
}
announce "A GM endet the event.", bc_all;
sleep( 5000 );
mapwarp "quiz_01", "prontera", 96, 244;
}
end;
OnInit:
bindatcmd( "startevent", strnpcinfo(3) + "::OnStartEvent" );
bindatcmd( "stopevent", strnpcinfo(3) + "::OnStopEvent" );
setarray .mvps, 1751, 1708, 1832, 1650, 1647, 1649, 1651, 1646, 1648;
set .mvpCount, getarraysize( .mvps );
set .priceId, 7720 ;
set .priceAmount, 1;
disablenpc "Event";
end;
}
quiz_01 mapflag nowarp
quiz_01 mapflag nowarpto
quiz_01 mapflag noteleport
quiz_01 mapflag nosave SavePoint
quiz_01 mapflag nomemo
quiz_01 mapflag nobranch
quiz_01 mapflag nopenalty
quiz_01 mapflag pvp off
quiz_01 mapflag gvg off