Page 1 of 1

Auto-Rank System.

PostPosted: 13 Feb 2014, 23:37
by Leeizazombie
Not something you could work on straight away but you could possibly add an auto-rank system to the properties in Zombie Survival. I have made my own custom Auto-Ranking system, here's some of the code:
Spoiler:

It would be handy for people to have a more friendly user version in the settings like where it checks how many levels that were added to the text file, then show drop down menus to select the level and then the rank that level will give players, also to take note of all the custom ranks added by the player.

Re: Auto-Rank System.

PostPosted: 14 Feb 2014, 00:22
by dzienny
Well, it's not that easy to make a good auto-ranking system, but it's possible via a custom command/plugin and it's a good exercise in coding ;)

Here are my notes about the code, and possible improvements:
http://www.coderemarks.com/review/gIUenj5034rYaqOl
Spoiler:

Re: Auto-Rank System.

PostPosted: 15 Feb 2014, 15:38
by Leeizazombie
Thanks for those notes! :)
Updated:
Spoiler:


I was wondering how it would be possible to keep running the code as the server is on to check it on every player, my only ideas are to set a Boolean in a text file and the code can run under a while statement and make the player use the command, I also tried chat filter, that everytime they chat, it will check the code, but that isn't the best either, any suggestions?

Re: Auto-Rank System.

PostPosted: 16 Feb 2014, 23:28
by HelloWorldCool
Leeizazombie wrote:...
I was wondering how it would be possible to keep running the code as the server is on to check it on every player, my only ideas are to set a Boolean in a text file and the code can run under a while statement and make the player use the command, I also tried chat filter, that everytime they chat, it will check the code, but that isn't the best either, any suggestions?


Hmm...well I'm sure that it is not easy for the system to perfectly "match" up times to players.
You may want to adjust the level "numbers."
Like making them 5, 10, 15, 20, 25, etc. Just so they follow a mathematical pattern.


Anyway here are some way(s) to go about it:
> Time: run code every 10 min (nobody wants to wait too long)
> Time: run after every zb round(or beginning of a new one)

Pro: This would be easy to add in.
Pro: Timed intervals are stable usually.
Con: Server may experience lag if too many people.


====================================================================================================

> Points: (Player's points) / (points for 1 tier) = Level y
Ex: 3000 / 500 = Level 6
Add rule: Run code after every y levels gained. (If we use 5x tier levels, y = 5)

Pro: Safer than timed intervals, lag is random but is reduced AND spread out
Pro: Stable because of the low likelihood of all players surviving.
Pro: Better for large servers with lots of players.
Con: Hard to add into the code, involves player's points, etc.


====================================================================================================

> Command: /rankup (course that means this ranking system is not completely auto)
Run code when player uses /rankup

Pro: None
Con: A Player has to do it.
Con: Random Lag ... guaranteed :geek:



So...those are my ideas.
Hope it kinda helped.

Good Luck,
HelloWorldCool

Re: Auto-Rank System.

PostPosted: 17 Feb 2014, 15:43
by dzienny
HelloWorldCool brought up some good points in his post.

I would recommend you the option that involves doing a check when a zombie round starts.
You would have to hook your "auto-ranks" method to the event:
Code: Select all
EventHandler<RoundStartEventArgs> InfectionSystem.InfectionSystem.RoundStart

So your method would have to be:
Code: Select all
void OnZombieRoundStart(object source, RoundStartEventArgs e)
{
    // Do something.
}


And you would have to register this method to the event.
Code: Select all
InfectionSystem.InfectionSystem.RoundStart += OnZombieRoundStart;


Also, the code looks better now! :)

Re: Auto-Rank System.

PostPosted: 17 Feb 2014, 15:58
by Leeizazombie
Perfect, thank you! : :)

Re: Auto-Rank System.

PostPosted: 17 Feb 2014, 17:08
by Leeizazombie
Actually, under the void OnZombieRoundStart(object source, RoundStartEventArgs e) method, I cannot use certain things like, p.name / Player.name / e.Player.name, how do I go around this.

Re: Auto-Rank System.

PostPosted: 13 Mar 2014, 22:37
by Marvy
I like the sound of this- and I think if you get enough experience with coding- you could make the autorank levels customizable in a text file, something like this:

rankName : rankRequired : expRequired
etc.

This would then allow the server owners to add/delete autoranks so that the owner is not confined to a set number of ranks and rank names and will allow them to adjust the difficulty/effort required to get this rank.

I certainly could help with this, so if you want any help I am always willing :D

Of course- I have little experience with the ins and outs of MCDzienny's structure, so I would therefore need to have some practice first ;)