Jump to content
  • 0

[Rank] MvP


Yugosh

Question


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   0
  • Joined:  05/09/12
  • 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, 0; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
set $@top, 30; // 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 "El usuario [" +strcharinfo(0) +"] ha matado un [" +getmonsterinfo(killedrid,0) +"] en el mapa [" +strcharinfo(3) +"]",bc_blue|bc_all;
set MvP, MvP + 1;
callfunc ("MvPRank",MvP,strcharinfo(0));
end;
} // End Script

//prontera,147,171,5	script	MvP Rank	405,{ // NPC that will show the ranking
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 if

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 am having a problem here.
if the player has killed more than 200 mvp he will automatically reset to 0.
and repeat as before.
please help her thank you very much ..
Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   1
  • Joined:  04/14/17
  • Last Seen:  

Hello. I'm using your script as my MVP Rank. But i found something odd. Whenever i killed an MVP, the points raised randomly instead of 1. What did i miss?

MVPRank.txt

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   1
  • Joined:  04/14/17
  • Last Seen:  

Hello @Capuche . I'm using your script as my MVP Ranker. But i found something weird. Whenever i killed an MVP, the points raised randomly instead of 1. What should i change to make 1 mvp = 1 point? Thank you.

 

So sorry for the spam question. I thought my connection was bad and my post didn't send. Turns out it goes up. So sorry.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

On 4/23/2014 at 12:46 AM, Capuche said:

you take this script from a previous request ; the guy wanted to reset the points when the player gets more than 200 points


prontera,162,152,4	script	MVP Ladder	619,{
	query_sql( "DELETE FROM `mvp_ranking` WHERE `name` NOT IN ( SELECT `name` FROM `char` )" );
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	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)
	waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = `points` + 1";
	end;
}

The NPC reads all mobs poring - MVP as MVP.. and announces all mobs you kill

kindly help me

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

5 hours ago, celeron0134 said:

The NPC reads all mobs poring - MVP as MVP.. and announces all mobs you kill

kindly help me

 

Use mine's instead

https://rathena.org/board/topic/114448-utility-mvp-ladder-only-on-mvp-maps-with-announcer/

Edited by pajodex
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

17 hours ago, pajodex said:

Fix the Reset function.. (i killed 1 MVP  then it shows on the rankings "[1] GM - blabla ~ 1 kills") then i used reset function.. it turned to "~ 0 kills"

and after i killed an MVP again.. instead of showing "~ 1 kills" it showed " ~ 2 kills " it continued the MVP kills after the reset

Edited by celeron0134
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

43 minutes ago, celeron0134 said:

Fix the Reset function.. (i killed 1 MVP  then it shows on the rankings "[1] GM - blabla ~ 1 kills") then i used reset function.. it turned to "~ 0 kills"

and after i killed an MVP again.. instead of showing "~ 1 kills" it showed " ~ 2 kills " it continued the MVP kills after the reset

https://github.com/pajodex/ScriptCollections/blob/master/mvp_kill.txt

here thanks for report

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

10 hours ago, pajodex said:

Thanks it worked.. more power

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  29
  • Topics Per Day:  0.01
  • Content Count:  270
  • Reputation:   20
  • Joined:  12/10/11
  • Last Seen:  

Instead of using variables to keep track of it, I would switch to SQL based script

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   0
  • Joined:  05/09/12
  • Last Seen:  

How?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

I honestly don't really like how that script is written.

In the MvPRank function, you are trying to build up a script-based ranking without facing position swaps or referals.

If it is of just 1 variable, I'd just run a query_sql command to get the ranking positions, there should be an example of exactly what you need in the script_commands.txt file, under the query_sql command explanation.

About the variable being resetted, I honestly didn't find anything that actually resets it. Try to check if you have some other scripts that may use the same variable.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Load this table

CREATE TABLE IF NOT EXISTS `mvp_ranking` (
  `char_id` int(11) unsigned NOT NULL DEFAULT '0',
  `name` varchar(30) NOT NULL DEFAULT '',
  `points` int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (`char_id`)
) ENGINE=MyISAM;

 

and this script

prontera,147,171,5	script	MvP Rank	75,{
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^00FF00Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	set .a, 1; // Broadcast who killed the MvP and wich MvP and wick Map [0 Off - 1 On]
	set .top, 30; // Max. Top Rank (Hihgly recommended between 5~10, more maybe bug the server (limited variables)
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "El usuario [" +strcharinfo(0) +"] ha matado un [" +getmonsterinfo(killedrid,0) +"] en el mapa [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = if ( `points` + 1 > 200, 0, `points` + 1 )";
	end;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Sir Capuche, I used your MVP ladder script, there is some bugs here. The ranking shows that..

 

Top 1 Game Master with 1 MVP killed.

Top 2 Milk with 1 MVP killed.

Top 3 Nakku with 7 MVP Killed.

 

as it shows, the player who kill the most didn't get to Top 1, may I know how to fix this please? Thanks in advance.

 

bottom is the edited script shown

CREATE TABLE IF NOT EXISTS `mvp_ranking` (
`char_id` int(11) unsigned NOT NULL DEFAULT '0',
`name` varchar(30) NOT NULL DEFAULT '',
`points` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`char_id`)
) ENGINE=MyISAM;


/////////////////////////////////////////////////////////////////

prontera,162,152,4	script	MVP Ladder	619,{
set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	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)
waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = if ( `points` + 1 > 200, 0, `points` + 1 )";
	end;
}
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Add desc

prontera,162,152,4	script	MVP Ladder	619,{
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );
//etc..
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Thx, it works !! you're the best xD


Patskie, when I delete character, the character gone, but the rank still shows the name, how to make it like when delete character, name gone from the ladder. Hmmm....

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

query_sql( "DELETE FROM `mvp_ranking` WHERE `name` NOT IN ( SELECT `name` FROM `char` )" );
query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );

well, another method is that you can store the MVP ranking point at the char table..so that it get removed when the character is deleted.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Sir Emistry, I need to remove something from my current script? Can you tell me where to insert from...hmmm I show you the full script below, post me an edited full script if possible yea.. Thanks much appreciate it.

prontera,162,152,4	script	MVP Ladder	619,{
set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	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)
waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = if ( `points` + 1 > 200, 0, `points` + 1 )";
	end;
}

Guys, there is something wrong with this MVP Rank script, at first I saw a player with 67 MVP Killed, and then the next day I click the NPC, it shows 11 MVP Killed. HELP~~ Anybody know whats wrong about this please !! =(((


Bump~ Anyone would help please... ><

Edited by fallen0519
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

 

Guys, there is something wrong with this MVP Rank script, at first I saw a player with 67 MVP Killed, and then the next day I click the NPC, it shows 11 MVP Killed. HELP~~ Anybody know whats wrong about this please !! =(((

you take this script from a previous request ; the guy wanted to reset the points when the player gets more than 200 points

prontera,162,152,4	script	MVP Ladder	619,{
	query_sql( "DELETE FROM `mvp_ranking` WHERE `name` NOT IN ( SELECT `name` FROM `char` )" );
	set .@size, query_sql( "select name, points from mvp_ranking where points > 0 order by points desc limit "+ .top, .@name$, .@points );
	mes "[^FF0000MvP ^0000FFRank ^996600Top ^FF0000" + .top +"^000000]";
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@name$[.@c] +"^000000 with ^FF0000" + .@points[.@c] +"^000000 MvP killed.";
	close;

OnInit: // Script Configuration
	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)
	waitingroom "MvP Rank",0;
	end;

OnNPCKillEvent: // Script execution
	if ( getmonsterinfo( killedrid,MOB_MODE ) & 0x0020  == 0 ) end;// not an mvp
	if (.a) // If announce On
		announce "Player [" +strcharinfo(0) +"] had killed MVP [" +getmonsterinfo(killedrid,0) +"] in [" +strcharinfo(3) +"]",bc_blue|bc_all;
	query_sql "insert into `mvp_ranking` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update `points` = `points` + 1";
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Thanks Capuche, the deleted character name was gone, now was trying to see if the ranking position appear bugs again. Thanks much !!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Capuche, why when the players didnt kill the MVP and his/her name was posted under top 10, what cause this bug to happen yea...

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

? I don't understand

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...