Jump to content
  • 0
Sign in to follow this  
ZelosAvalon

Event Ranking

Question

I have an event, that when the player kills a Event Monster, he gets a event_point (I used the variable: #Event_Point) I would like to create a ranking at the end of the event where they can see the result of who killed more monsters! someone could help me with this? would like a general ranking which appear all players who participated according to the number of monsters killed by them.

This ranking will remain there, and every player event will adding more points. I really do not know how to do this, I need help!

 

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Well is the variable a specific variable for events? like only on Event Monster, will you gain a point in #Event_Point, or is it for all events? If so you would need to adjust the scripts manually adding in in the variable #Event_Point with your equation, then you can make a listing of so and so character with getcharid(); so get their character id and make an if statement.

It's not that hard when you logically think about it

Share this post


Link to post
Share on other sites
  • 0

Well is the variable a specific variable for events? like only on Event Monster, will you gain a point in #Event_Point, or is it for all events? If so you would need to adjust the scripts manually adding in in the variable #Event_Point with your equation, then you can make a listing of so and so character with getcharid(); so get their character id and make an if statement.

 

It's not that hard when you logically think about it

is only for an invasion event, will not be with all event!

Share this post


Link to post
Share on other sites
  • 0

Well, I see 2 ways: You add and maintain a server-wide array of top players, adding/removing them from the array as soon as they get that point. 2nd way is to display the ranking via SQL query, which might be more or less efficient.

 

Cons for first route:

Arrays are not lost on character deletion, so if someone deleted their character they'll still see their name in the ranking

Pros:

It's less dynamic, by far.

Need to get at least one point after script is ingame to build the initial array.

Need to get at least one point after script is ingame to appear in the ranking even if you have enough points.

 

Cons for SQL path:

Dynamic, if someone deletes character or changes name rankings will display that immideately.

Pros:

Heavier load on SQL engine.

 

I'd prefer the 2nd path, it's way easier to maintain imo :3

Share this post


Link to post
Share on other sites
  • 0

I already tried to create via sql ,but don't know how to do this or how to put in the NPC, i have very easily in script, but I'm not very good with SQL tables =/

Edited by ZelosAvalon

Share this post


Link to post
Share on other sites
  • 0

Hmm. Something along these lines for query:

SELECT a.`value`,b.`name` FROM `acc_reg_num_db` a INNER JOIN `char` b ON a.`account_id` = b.`account_id` WHERE a.`key` = '#Event_Point' GROUP BY a.`account_id` ORDER BY a.`value` DESC LIMIT 10;

Take 10 values, names from join of acc_reg_num_db/char tables where account IDs match, take only first character from account (since it's an account variable I don't really know how you want to handle this...) in regards of charID where there's a variable on that account named "#Event_Point" ordered by descending order of value of said variable.

Share this post


Link to post
Share on other sites
  • 0

Hmm. Something along these lines for query:

SELECT a.`value`,b.`name` FROM `acc_reg_num_db` a INNER JOIN `char` b ON a.`account_id` = b.`account_id` WHERE a.`key` = '#Event_Point' GROUP BY a.`account_id` ORDER BY a.`value` DESC LIMIT 10;

Take 10 values, names from join of acc_reg_num_db/char tables where account IDs match, take only first character from account (since it's an account variable I don't really know how you want to handle this...) in regards of charID where there's a variable on that account named "#Event_Point" ordered by descending order of value of said variable.

which name I should put this sql table when you put it in phpmyadmin, or should I put it inside another sql?

and in the game as I do the ranking of npc with the sql configuration?

Edited by ZelosAvalon

Share this post


Link to post
Share on other sites
  • 0

You can run it from inside phpmyadmin if you'll open your RO server DB in it.

Running it in script is even simplier, just copy/paste it into a *query_sql

*query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values, and will return the number of rows (the array size).

Something like this:

-	script	OnInit	-1,{OnInit:	if( (.@num = query_sql("SELECT a.`value`,b.`name` FROM `acc_reg_num_db` a INNER JOIN `char` b ON a.`account_id` = b.`account_id` WHERE a.`key` = '#Event_Point' GROUP BY a.`account_id` ORDER BY a.`value` DESC LIMIT 10", .@points, .@names)) > 0 ) {		for (.@i = 0; .@i < .@num; .@i++) {			debugmes .@i + ". " + .@names[.@i] + ": " + .@points[.@i] + " points.";		}	}	end;}

^This will post the list inside mapserver console on loading the script/loading server with script.

Edited by Garr

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.