Skip to content

What are these derankable requirements you are talking about?

Staartvin edited this page Apr 14, 2016 · 10 revisions

Derankable Requirements

Let's say you have a group where a player must have at least 1 million in-game money. You set up a group like this:

Poor beggar:
    requirements:
        money:
            value: 1000000
    results:
        rank change: Poor beggar; Millionaire
        message: 'Congratulations, you are a filthy rich bastard!'
Millionaire:
    requirements:
        money:
            value: 1000000000
    results:
        rank change: Millionaire; Billionaire
        message: 'Congratulations, you are now even more of a filthy rich bastard!'

Now, you want it so that when a player gets below a 1 million money, he will demote to 'poor beggar' again. This can be done with Autorank 3.7.4 and onwards. You'll have to set allow deranking and infinite ranking in the Settings.yml to true. Once you've done that, you can specify per requirement whether it should derank the player or not. If a player does not meet a requirement that is 'derankable', he/she will be deranked to their previous group. To set a requirement to derankable, you'll have to add the derankable flag to any requirement you like. For example:

Poor beggar:
    requirements:
        money:
            value: 1000000
    results:
        rank change: Poor beggar; Millionaire
        message: 'Congratulations, you are a filthy rich bastard!'
Millionaire:
    requirements:
        money:
            value: 1000000000
        money2: #to distinct the demotion attribute, from the normal; add a '2' at the end of the requirement you are using
            value: 1000000 #value from previous ranks's requirement
    results:
        rank change: Millionaire; Billionaire
        message: 'Congratulations, you are now even more of a filthy rich bastard!'

#Due to the nature of how Autorank works, your highest rank (if you want it to be derankable) will need to have a block. Assuming there are no promotions above it. This is a workaround to still get demotion working 
Billionaire:
    requirements:
        money:
          value: 10000000000000 #this can really be whatever. each time it runs though, it will do the command at the bottom, so go ahead and make it an unreachable high number
        money2:
          value: 1000000000 #value from previous ranks's requirement
          options:
              derankable: true
    results:
        command: 'ping' #a harmless command to run if someone reachs your unreachable goal

What I've done is added an extra money requirement to the Millionaire group. This requirement does nothing on its own but only makes sure that when a player does not have 1 million money, he will be demoted to Poor beggar again.

Lastly, you can also add commands that will be fired when a player is demoted. Let's say you want everybody on the server to know that a player has deranked (because it's a shame he did, really!). You could let Autorank perform a 'say &p has just deranked' command. Example given:

Poor beggar:
    requirements:
        money:
            value: 1000000
    results:
        rank change: Poor beggar; Millionaire
        message: 'Congratulations, you are a filthy rich bastard!'
Millionaire:
    requirements:
        money:
            value: 1000000000
        money2: 
            value: 1000000 #value from previous ranks's requirement
    results:
        rank change: Millionaire; Billionaire
        message: 'Congratulations, you are now even more of a filthy rich bastard!
Billionaire:
    requirements:
        money:
          value: 10000000000000
        money2:
          value: 1000000000
          options:
              derankable: true
              commands on derank:
              - say &p has just deranked!
              - more commands here
              - and here
    results:
        command: 'ping'

That's all! Have fun using Autorank!

Clone this wiki locally