Jump to content
  • 0

Help with this MVP Rank Script


PandaLovesHamster

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

//= ---
//= MvP Rank Improved v1.0
//= ---
//= This Rank will count every MvP you kill,
//= to be more clear, will count every mob
//= defined inside the array ".mobid[0]",
//= so, if you add the poring ID will count in the rank
//= you can modify and ad miniBoss because this array
//= only have all MvPs, that's the idea, only MvPs...
//= ---
-	script	Rank MvP	-1,{
OnInit: // Script Configuration
setarray .mobid[0],1511,1647,1785,1630,1399,1039,1874,2068,1272,1719,1046,1389,1112,1115,1957,1418,1871,1252,1768,1086,1688,1646,
				1373,1147,1059,1150,1956,2022,1087,1190,1038,1157,1159,1502,1623,1650,1583,1708,1312,1751,1685,1648,1917,1658; // MvP Ids
set .a, 1; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
set $@top, 10; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
end;

OnNPCKillEvent: // Script execution
for (set .@c, 0; .@c < getarraysize(.mobid); set .@c, .@c + 1)
	if (killedrid == .mobid[.@c])
		set .@s, 1; // If a MvP
if (!.@s) end;
if (.a) // If announce On
	announce "The user [" +strcharinfo(0) +"] has killed a [" +getmonsterinfo(killedrid,0) +"] in the map [" +strcharinfo(3) +"]",bc_blue|bc_all;
set MvP, MvP + 1;
specialeffect2 EF_HEAL2;
callfunc ("MvPRank",MvP,strcharinfo(0));
end;
} // End Script

malaya,300,345,5	script	MvP Ranking	416,{

mes "[^FF0000MvP ^0000FFRank ^00FF00Top ^FF0000" +$@top +"^000000]";
for (set .@c, 0; .@c < $@top; set .@c, .@c + 1)
	mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" +getd("$topmvp" +.@c +"$") +"^000000 with ^FF0000" +getd("$topmvp" +.@c) +"^000000 MvP killed.";
close;
end;
}
OnInit:
	waitingroom "MvP Top 10",0;
	end;
}

function	script	MvPRank	{
set @mvptotal, getarg(0);
set @nomb$, getarg(1);
for (set .@c, 0; .@c < $@top; set .@c, .@c + 1) {
	if (@mvptotal >= getd("$topmvp" +.@c)) {
		if (strcharinfo(0) == getd("$topmvp" +.@c +"$")) {
			setd "$topmvp" +.@c, @mvptotal;
			setd "$topmvp" +.@c +"$", @nomb$;
			return;
		} else {
			if (getd("$topmvp" +(.@c + 1) +"$") == "") {
				setd "$topmvp" +.@c, @mvptotal;
				setd "$topmvp" +.@c +"$", @nomb$;
				return;
			} else {
				setd "$topmvp" +(.@c + 1), getd("$topmvp" +.@c);
				setd "$topmvp" +(.@c + 1) +"$", getd("$topmvp$" +.@c);
				setd "$topmvp" +.@c, @mvptotal;
				setd "$topmvp" +.@c +"$", @nomb$;
				return;
			} // End if
		} // End if
	} // End if
} // End loop
return;
} // End function

I wanted to add a reset option to this MVP where I can reset it weekly or it can reset itself automatically every week.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   3
  • Joined:  06/03/12
  • Last Seen:  

go to phpmyadmin after you login go to your ragnarok database / global_reg_value / search

 

in str type this MvP the click go

 

post-5093-0-83237800-1431794816_thumb.jpg

 

Check all then delete

 

post-5093-0-39373800-1431794987_thumb.jpg

 

/no1 /no1 /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

To reset the ranking I usually use one of these two options:

 

  • Either you choose to store the ranking variables as player variables, so here's what you'd have to do:

 -Each time a player kills a MVP, store the player rid (with getcharid(3,strcharinfo(0))) in a permanent array but only if it wasn't in it already.

-When you want to reset the ranking attach the rid of each player and set their variables to 0.

-All players definitely won't be online the exact time you want to reset their variables so you will have to copy the array in another array and check, each time a player logs on, if one of the players' ranking left to reset is that of the player that just logged (not sure if I'm really clear about it ><)

 

You will have those problems using this method:

-If more than 128 players play your server, you will have to make sure the array doesn't get more than 128 rid because it won't handle it (you can use more arrays but it's pretty annoying)

-If you want to display the players rank you will have to make sure to find a way to prevent players left to be reset not to be displayed on the list (I only read quickly your script so I can't tell you excatly how, it depends on how you did it)

 

 

  • Or you can choose to store ranking variables as NPC variables doing something like:

       setd "."+strcharinfo(0)+"_ranking" , getd("."+strcharinfo(0)+"_ranking") + 1; //when a player kills a MVP

       setarray .ranking_names$[getarraysize(.ranking_names$)] , strcharinfo(0); //so that you can display it on your board

 

On reset you can just set those variables to 0 and delete the array '.ranking_names$'

 

But you will also have problems using this method  :lol: :

-Again if more than 128 different players kill some MVPs, you'll have to create other arrays

-If you want to keep the rankings after a reloadscript you'll have to use global arrays

 

The second metod is cleary the simplier one here but I just wanted to inform you on the first one because it is often simplier in different situations and when it comes to a lot of variables, it's not recommended to use global variables.

 

Sorry I guess you though I would post it for you but I neither have time nor motivation to do it  :P.

Still I think it's a good idea to try it yourself, you'll see that it's not as easy as it seems but if you never tried something like this before you'll learn a lot. Good luck  :lol:

 

As I said I don't have time right now but if you don't manage(or you do want) to do it I'll do it for you but only in a week or two  :P

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

Thanks, just read the reply, I'm trying to figure it out right now. Of course help would be really appreciated :D Will post some results here after some trial and error.

Link to comment
Share on other sites

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.

×
×
  • Create New...