Jump to content
  • 0

script ranking mob kill


Question

Posted (edited)

script ranking mob kill -

when event begin:

the 3 players who kill more mobs earned rewards,

and the rewards are different for each position:

1st place - getitem 8032,1;

2nd place - getitem 8033,1;

3rd place - getitem 8034,1;

The event will have many people participating, only 3 that killed more earned rewards.

Edited by ZelosAvalon

7 answers to this question

Recommended Posts

Posted (edited)

/bo

script ranking mob kill -

when event begin:

the 3 players who kill more mobs earned rewards,

and the rewards are different for each position:

1st place - getitem 8032,1;

2nd place - getitem 8033,1;

3rd place - getitem 8034,1;

The event will have many people participating, only 3 that killed more earned rewards.

Event start with whisper system for GM : start/end to start or end the event.

Set the configuration for the number of mob spawn, it ID and reward ID.

Maybe it's not full optimized but ranking without SQL /pif

-	script	event	-1,{

OnWhisperGlobal:
if ( getgmlevel() < 60 ) end;
else if ( compare( @whispervar0$, "on" ) || compare( @whispervar0$, "start" ) ) {
	if ( .on ) {
		dispbottom "Event already started";
		end;
	}
	else
		goto L_Start;
}
else if ( compare( @whispervar0$, "off" ) || compare( @whispervar0$, "end" ) ) {
	if ( !.on ) {
		dispbottom "Event not yet start";
		end;
	}
	else
		goto L_End;
}
else {
	dispbottom "Event is currently "+( ( .on )? "" : " not " )+" running";
	end;
}
end;



OnDead:
.count--;
for( .@i = 0; .@i < getarraysize( .Data ); .@i++ )
	if( getcharid(3) == .Data[ .@i ] ) {
	    // .Rank = .Rank + ( ( ( ( .Rank >> .@i * 5 ) % pow( 2, 5 ) ) + 1 ) << .@i * 5 );
		.Rank[ .@i ]++;
		break;
	}

if( .@i == getarraysize( .Data ) ) {
	.Data[ .@i ] = getcharid(3);
	.Rank[ .@i ]++;
}

if( !.count ) {
	mapannounce .mapevent$,"End of event.",0;
	for( .@j = 50; .@j > 0; .@j-- )
		for( .@i = 0; .@i < getarraysize( .Rank ); .@i++ )
			if( .Rank[ .@i ] == .@j ) {
				getitem .gained[ .@W ], 1, .Data[ .@i ];
				.@W++;
				if( .@W == getarraysize( .gained ) ) goto OnInit;
			}
}
end;


L_Start:
.on = 1;
monster .mapevent$,0,0,"--ja--",.mobID, .count, strnpcinfo(0)+"::OnDead";
end;


L_End:
announce "Event has ended", 0;
killmonster .mapevent$, strnpcinfo(0)+"::OnDead";

OnInit:
.on = 0;
deletearray .Data[ 0 ], getarraysize( .Data );
deletearray .Rank[ 0 ], getarraysize( .Rank );
//- Config
//-- ID mob
.mobID = 1002;
//-- Number of mob spawn
.count = 4;
//-- ID items rewards - 3 best positions
setarray .gained, 8032, 8033, 8034;
//-- Map of event
.mapevent$ = "prontera";
end;
}

Edited by Capuche
  • Upvote 1
Posted (edited)

so I made the request to add the rankings this event already created: event_invasion.txt, i tried adding the line ranking but have had many errors.

I already own the event of invasion, and would like to set the reward event for 3 players that kill more mobs receive the reward.

example:

main event menu:


case 1:
mes "Which item would you like the MVP to drop?";
mes "Please input the item ID:";
input .ItemID;
goto Main;
case 2:
mes "Please input the monster ID:";
input .MobID;
goto Main;
case 3:
mes "Please input the first place will drop:"; ( here i will put id reward for the first place)
input .ItemID1;
goto Main;
case 5:
mes "Please input the second place will drop:";  ( here i will put id reward for the second place)
input .ItemID2;
goto Main;
case 6:
mes "Please input the third place will drop:";  ( here i will put id reward for the third place)
input .ItemID3;
goto Main;
case 7:
mes "Please input the MVP ID:";
input .MvpID;
goto Main;
case 8:
for ( set .@i, 1; .@i < getarraysize(.@mp$); set .@i, .@i + 1 )
set .@menuE$, .@menuE$ + .@mp$[.@i] + ":";
set .Map$, .@mp$[select( .@menuE$ )];
mes "Map Event : "+.Map$;
goto Main;
case 9:
mes "Starting the event now...";
close2;
goto onstart;

Edited by ZelosAvalon
Posted

so I made the request to add the rankings this event already created: event_invasion.txt, i tried adding the line ranking but have had many errors.

I already own the event of invasion, and would like to set the reward event for 3 players that kill more mobs receive the reward.

jupe_ele,36,53,6    script    Event Invasion    105,{

setarray .@mp$[1], "prontera", "morocc", "geffen", "payon", "alberta", "izlude", "aldebaran",
   "xmas (lutie)", "comodo", "yuno", "amatsu", "gonryun", "umbala", "niflheim", "louyang", "jawaii", "ayothaya",
   "einbroch", "hugel", "rachel", "veins", "moscovia", "midgard camp", "manuk", "splendide", "brasilis", "el dicastes",
   "mora", "dewata", "malangdo island", "malaya port", "eclage";

setarray .mapflag_event, mf_nopvp, mf_nomobloot, mf_nobranch;


   // GM menu
   //It allows GMs Level 50 or more to Start and Stop invasions.

   if( getgmlevel() > .gm ) {
       if( .count ) {
           mes "[Event Invasion]";
           mes "An invasion is in progress..";
           mes "Location: " + .map_event$;
           mes "^FF0000"+.count+"^000000 Monsters left";
           mes " ";
           mes "Stop invasion?";
           if( select("No:Yes") ) close;
           donpcevent "Event Invasion::onstop";
           mes "Invasion stopped";
           announce "The Invasion has been stopped by "+strcharinfo(0),bc_all;
           close;
       }

       mes "[Event Invasion]";
       mes "Please customize the Invasion event before starting it.";
   Main:
       next;
       mes "[Event Invasion]";
       mes "MVP Item Drop:[^FF0000" + getitemname(.Item_ID) + "^000000]";
       mes "Monsters Respawn:[^FF0000" + strmobinfo(1,.mob_ID) + "^000000]";
       mes "Reward 1 place: [^FF0000" + getitemname(.gained[ 0 ]) + "^000000]";
       mes "Reward 2 place: [^FF0000" + getitemname(.gained[ 1 ]) + "^000000]";
       mes "Reward 3 place: [^FF0000" + getitemname(.gained[ 2 ]) + "^000000]";
       mes "MVP Respawn:[^FF0000" + strmobinfo(1,.Mvp_ID) + "^000000]";
       mes "Map Event will Start:[^FF0000"+.map_event$+"^000000]";

       switch(select("Item [" + getitemname(.Item_ID) + "]",
                   "Monster [" + strmobinfo(1,.mob_ID) + "]",
                   "Reward for the first place [" + getitemname(.gained[ 0 ]) + "]",
                   "Reward for the second place [" + getitemname(.gained[ 1 ]) + "]",
                   "Reward for the third place [" + getitemname(.gained[ 2 ]) + "]",
                   "MVP [" + strmobinfo(1,.Mvp_ID) + "]",
                   "Select Map Event["+.map_event$+"]:Start Event")) {
       case 1:
           next;
           mes "[Event Invasion]";
           mes "Which item would you like the MVP to drop?";
           mes "Please input the item ID:";
           input .Item_ID;
           goto Main;
       case 2:
           next;
           mes "[Event Invasion]";
           mes "Please input the monster ID:";
           input .mob_ID;
           goto Main;
       case 3:
           next;
           mes "[Event Invasion]";
           mes "Please input the first place will drop:";// ( here i will put id reward for the first place)
           input .gained[ 0 ];
           goto Main;
       case 4:
           next;
           mes "[Event Invasion]";
           mes "Please input the second place will drop:";//  ( here i will put id reward for the second place)
           input .gained[ 1 ];
           goto Main;
       case 5:
           next;
           mes "[Event Invasion]";
           mes "Please input the third place will drop:";//  ( here i will put id reward for the third place)
           input .gained[ 2 ];
           goto Main;
       case 6:
           next;
           mes "[Event Invasion]";
           mes "Please input the MVP ID:";
           input .Mvp_ID;
           goto Main;
       case 7:
           next;
           mes "[Event Invasion]";
           for ( set .@i, 1; .@i < getarraysize(.@mp$); set .@i, .@i + 1 )
               set .@menuE$, .@menuE$ + .@mp$[.@i] + ":";
           set .map_event$, .@mp$[select( .@menuE$ )];
           mes "Map Event : "+.map_event$;

           for( .@i = 0; .@i < getarraysize( .mapflag_event ); .@i++ )
               setmapflag .map_event$, .mapflag_event[ .@i ];
           goto Main;
       case 8:
           next;
           mes "[Event Invasion]";
           if( !.Item_ID || !.mob_ID || !.Mvp_ID || .map_event$ == "" || !.gained[ 0 ] || !.gained[ 1 ] || !.gained[ 2 ] ) {
               mes "Miss some conditions.";
               goto Main;
           }
           mes "Starting the event now...";
           close2;
           goto onstart;
       }
   }

   // If a player clicks the NPC, it displays:
   mes "[Event Invasion]";
   mes .count+" monster have invaded "+.map_event$+"!";
   close;

           /////////////////////////
           //The actual NPC Script//
           /////////////////////////

//OnMinute50: // Change this to your liking ( automatic start )
onstart:
   if( .count ) end;
   set .count, .number_mob;
   sleep2 1000;
   announce "[ Rune-Midgard Guard ]: We have trouble here in the town " + .map_event$ + "!", bc_all;
   sleep2 5000;
   announce "[ Rune-Midgard Guard ]: Everyone, we need your help to get rid of these monsters!", bc_all;
   monster .map_event$,0,0,"--ja--",.mob_ID, .count, strnpcinfo(0)+"::OnMyMobDead";
   initnpctimer;
   end;




OnMyMobDead: //When a mob is killed
   .count--;
   for( .@i = 0; .@i < getarraysize( .Data ); .@i++ )
       if( getcharid(3) == .Data[ .@i ] ) {
           .Rank[ .@i ]++;
           break;
       }

   if( .@i == getarraysize( .Data ) ) {
       .Data[ .@i ] = getcharid(3);
       .Rank[ .@i ]++;
   }

   if( !.count ) {
       announce "[ Rune-Midgard Guard ]: The MvP " + strmobinfo( 1,.Mvp_ID ) + " has spawned in " + .map_event$ + "!", bc_all;
       monster .map_event$,0,0,"--ja--",.Mvp_ID,1,"Event Invasion::OnSpecialMobDead";
       for( .@j = .number_mob; .@j > 0; .@j-- )
           for( .@i = 0; .@i < getarraysize( .Rank ); .@i++ )
               if( .Rank[ .@i ] == .@j ) {
                   getitem .gained[ .@W ], 1, .Data[ .@i ];
                   .@W++;
                   if( .@W == getarraysize( .gained ) ) goto OnInit;
               }
   } else
       announce "["+.count+"/250] " + strmobinfo(1,.mob_ID) + " left.",bc_map;
   end;


OnSpecialMobDead:
   announce strcharinfo(0)+" has fought off the Invasion and has been awarded a worthy prize!", bc_all;
   getitem .Item_ID, 1; //Change the [5] to the amount you wish to hand out.

onstop:
   killmonster .map_event$,"Event Invasion::OnSpecialMobDead";
   for( .@i = 0; .@i < getarraysize( .mapflag_event ); .@i++ )
       removemapflag .map_event$, .mapflag_event[ .@i ];

OnTimer1805000:    // 30 minutes later, kills all the mobs.
   killmonster .map_event$,"Event Invasion::OnMyMobDead";
   set .count, 0;
   stopnpctimer;

OnInit:
   deletearray .Data[ 0 ], getarraysize( .Data );
   deletearray .Rank[ 0 ], getarraysize( .Rank );
//- Config
//-- Number of mob spawn
   .number_mob = 250;
//-- GM Level to access the GM Menu.
   set .gm, 50;
   end;
}

Posted

so I made the request to add the rankings this event already created: event_invasion.txt, i tried adding the line ranking but have had many errors.

I already own the event of invasion, and would like to set the reward event for 3 players that kill more mobs receive the reward.

jupe_ele,36,53,6	script	Event Invasion	105,{

setarray .@mp$[1], "prontera", "morocc", "geffen", "payon", "alberta", "izlude", "aldebaran",
"xmas (lutie)", "comodo", "yuno", "amatsu", "gonryun", "umbala", "niflheim", "louyang", "jawaii", "ayothaya",
"einbroch", "hugel", "rachel", "veins", "moscovia", "midgard camp", "manuk", "splendide", "brasilis", "el dicastes",
"mora", "dewata", "malangdo island", "malaya port", "eclage";

setarray .mapflag_event, mf_nopvp, mf_nomobloot, mf_nobranch;


// GM menu
//It allows GMs Level 50 or more to Start and Stop invasions.

if( getgmlevel() > .gm ) {
	if( .count ) {
		mes "[Event Invasion]";
		mes "An invasion is in progress..";
		mes "Location: " + .map_event$;
		mes "^FF0000"+.count+"^000000 Monsters left";
		mes " ";
		mes "Stop invasion?";
		if( select("No:Yes") ) close;
		donpcevent "Event Invasion::onstop";
		mes "Invasion stopped";
		announce "The Invasion has been stopped by "+strcharinfo(0),bc_all;
		close;
	}

	mes "[Event Invasion]";
	mes "Please customize the Invasion event before starting it.";
Main:
	next;
	mes "[Event Invasion]";
	mes "MVP Item Drop:[^FF0000" + getitemname(.Item_ID) + "^000000]";
	mes "Monsters Respawn:[^FF0000" + strmobinfo(1,.mob_ID) + "^000000]";
	mes "Reward 1 place: [^FF0000" + getitemname(.gained[ 0 ]) + "^000000]";
	mes "Reward 2 place: [^FF0000" + getitemname(.gained[ 1 ]) + "^000000]";
	mes "Reward 3 place: [^FF0000" + getitemname(.gained[ 2 ]) + "^000000]";
	mes "MVP Respawn:[^FF0000" + strmobinfo(1,.Mvp_ID) + "^000000]";
	mes "Map Event will Start:[^FF0000"+.map_event$+"^000000]";

	switch(select("Item [" + getitemname(.Item_ID) + "]",
				"Monster [" + strmobinfo(1,.mob_ID) + "]",
				"Reward for the first place [" + getitemname(.gained[ 0 ]) + "]",
				"Reward for the second place [" + getitemname(.gained[ 1 ]) + "]",
				"Reward for the third place [" + getitemname(.gained[ 2 ]) + "]",
				"MVP [" + strmobinfo(1,.Mvp_ID) + "]",
				"Select Map Event["+.map_event$+"]:Start Event")) {
	case 1:
		next;
		mes "[Event Invasion]";
		mes "Which item would you like the MVP to drop?";
		mes "Please input the item ID:";
		input .Item_ID;
		goto Main;
	case 2:
		next;
		mes "[Event Invasion]";
		mes "Please input the monster ID:";
		input .mob_ID;
		goto Main;
	case 3:
		next;
		mes "[Event Invasion]";
		mes "Please input the first place will drop:";// ( here i will put id reward for the first place)
		input .gained[ 0 ];
		goto Main;
	case 4:
		next;
		mes "[Event Invasion]";
		mes "Please input the second place will drop:";//  ( here i will put id reward for the second place)
		input .gained[ 1 ];
		goto Main;
	case 5:
		next;
		mes "[Event Invasion]";
		mes "Please input the third place will drop:";//  ( here i will put id reward for the third place)
		input .gained[ 2 ];
		goto Main;
	case 6:
		next;
		mes "[Event Invasion]";
		mes "Please input the MVP ID:";
		input .Mvp_ID;
		goto Main;
	case 7:
		next;
		mes "[Event Invasion]";
		for ( set .@i, 1; .@i < getarraysize(.@mp$); set .@i, .@i + 1 )
			set .@menuE$, .@menuE$ + .@mp$[.@i] + ":";
		set .map_event$, .@mp$[select( .@menuE$ )];
		mes "Map Event : "+.map_event$;

		for( .@i = 0; .@i < getarraysize( .mapflag_event ); .@i++ )
			setmapflag .map_event$, .mapflag_event[ .@i ];
		goto Main;
	case 8:
		next;
		mes "[Event Invasion]";
		if( !.Item_ID || !.mob_ID || !.Mvp_ID || .map_event$ == "" || !.gained[ 0 ] || !.gained[ 1 ] || !.gained[ 2 ] ) {
			mes "Miss some conditions.";
			goto Main;
		}
		mes "Starting the event now...";
		close2;
		goto onstart;
	}
}

// If a player clicks the NPC, it displays:
mes "[Event Invasion]";
mes .count+" monster have invaded "+.map_event$+"!";
close;

		/////////////////////////
		//The actual NPC Script//
		/////////////////////////

//OnMinute50: // Change this to your liking ( automatic start )
onstart:
if( .count ) end;
set .count, .number_mob;
sleep2 1000;
announce "[ Rune-Midgard Guard ]: We have trouble here in the town " + .map_event$ + "!", bc_all;
sleep2 5000;
announce "[ Rune-Midgard Guard ]: Everyone, we need your help to get rid of these monsters!", bc_all;
monster .map_event$,0,0,"--ja--",.mob_ID, .count, strnpcinfo(0)+"::OnMyMobDead";
initnpctimer;
end;




OnMyMobDead: //When a mob is killed
.count--;
for( .@i = 0; .@i < getarraysize( .Data ); .@i++ )
	if( getcharid(3) == .Data[ .@i ] ) {
		.Rank[ .@i ]++;
		break;
	}

if( .@i == getarraysize( .Data ) ) {
	.Data[ .@i ] = getcharid(3);
	.Rank[ .@i ]++;
}

if( !.count ) {
	announce "[ Rune-Midgard Guard ]: The MvP " + strmobinfo( 1,.Mvp_ID ) + " has spawned in " + .map_event$ + "!", bc_all;
	monster .map_event$,0,0,"--ja--",.Mvp_ID,1,"Event Invasion::OnSpecialMobDead";
	for( .@j = .number_mob; .@j > 0; .@j-- )
		for( .@i = 0; .@i < getarraysize( .Rank ); .@i++ )
			if( .Rank[ .@i ] == .@j ) {
				getitem .gained[ .@W ], 1, .Data[ .@i ];
				.@W++;
				if( .@W == getarraysize( .gained ) ) goto OnInit;
			}
} else
	announce "["+.count+"/250] " + strmobinfo(1,.mob_ID) + " left.",bc_map;
end;


OnSpecialMobDead:
announce strcharinfo(0)+" has fought off the Invasion and has been awarded a worthy prize!", bc_all;
getitem .Item_ID, 1; //Change the [5] to the amount you wish to hand out.

onstop:
killmonster .map_event$,"Event Invasion::OnSpecialMobDead";
for( .@i = 0; .@i < getarraysize( .mapflag_event ); .@i++ )
	removemapflag .map_event$, .mapflag_event[ .@i ];

OnTimer1805000:	// 30 minutes later, kills all the mobs.
killmonster .map_event$,"Event Invasion::OnMyMobDead";
set .count, 0;
stopnpctimer;

OnInit:
deletearray .Data[ 0 ], getarraysize( .Data );
deletearray .Rank[ 0 ], getarraysize( .Rank );
//- Config
//-- Number of mob spawn
.number_mob = 250;
//-- GM Level to access the GM Menu.
set .gm, 50;
end;
}

tested the event today and only the player who killed the MVP received the reward.

the 3 players that killed more monsters didn't receive his reward.

i need help for fix it, I really like this event a lot on my server, I'm much time planning this event, but I'm not very good at configure scripting .

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...