Group Promotion


Author: Aortal
Created: 2013-04-05T00:15:58-0400
Edited: 2013-04-05T01:35:22-0400
Denizen Version: 0.8.8 pre-release
Views: 89
Downloads: 873
Likes: 1


WGET
Description: A group promotion assignment script that can be assigned to any NPC.

Use /npc assignment --set Promotion

ChangeLog:

1.1 - First release.

Enjoy it and let me know if you have any suggestions or feature requests.

Thanks to:
Jeebiss
mythan
PrimerBlock

# This is a group promotion script for I'm not sure what version
# This script is kept simple to allow a base scripting example to extend upon.
#
# @author Aortal
# @version 1.1
# @last-updated April 2 2013

"Promotion":
    type: assignment
 
    # Here we set the constants
    default constants:
        reqFee: 500
        reqGroup: Citizen
 
    # Here is the click trigger
    actions:
      on assignment:
      - trigger name:click toggle:true
 
    # Define the interact script
    interact scripts:
        - 10 PromotionKnight

'PromotionKnight':
    type: interact

    steps:
        'gotPromotion':
            click trigger:
                # Player has clicked, lets say something..
                script:
                - random 3
                - chat 'Welcome back &a<player.name>&f.'
                - chat 'Carrying out your duties &a<player.name>&f?'
                - chat 'Ahh &a<player.name>&f my friend!. It is good to see you again. '

        'getPromotion*':
            click trigger:
                script:
                # Player has clicked, lets say something..
                - random 3
                - chat 'Are you ready to join the ranks of the Knights &a<player.name>&f?'
                - chat 'Do you think you are ready to join us &a<player.name>&f?'
                - chat 'Getting your Knight promotion &a<player.name>&f?'
                - NARRATE "- Type Yes/No/Info"
                # Lets wait for a player to say the Yes, No or Info wildcard..
            chat trigger:
                '1':
                    trigger: '/Yes/ I am ready!'
                    script:
                    # Player is ready like run the first script CheckRank..
                    - RUNTASK 'SCRIPT:CheckRank'

                '2':
                    trigger: '/No/ I am not ready yet.'
                    script: 
                    - chat "No worries, see you again."
                    
                '2':
                    trigger: 'I need a little more /info/rmation before I make my decision'
                    script: 
                    - chat 'You must be Citizen rank before becoming a Knight.'
                    - WAIT 1
                    - chat 'The rank of Knight will cost you 500 <gold>Gold<white>.'
                    - WAIT 1
                    - chat 'You currently have <player.money.asint> <gold>Gold<white>.'                 

'CheckRank': # Lets see if they are in the correct Group
        Type: task
        Script:
        - if <player.group[cons:reqGroup]> runtask "SCRIPT:CheckMoney"
          else chat "I am sorry but you must be at least the rank of <cons:reqGroup> before I can give you this promotion."
        - zap step:getPromotion SCRIPT:PromotionKnight

'CheckMoney':  # Player has the correct Rank but do they have the correct change?
        Type: task
        Script:
        - CHAT "<white>Alright, that'll be 500 <gold>Gold<white>..."
        - if "<player.money>" >= "<cons:reqFee>" runtask "SCRIPT:GivePromotion"
          else runtask "SCRIPT:NotEnoughMoney"

'NotEnoughMoney': # Player doesn't have enough money, lets let them know how much they actually have..
        Type: task
        Script:
        # If the player doesn't have any money at all lets tell them..
        - if "<player.money>" = "0"
          chat "You don't have any money! Clear off before I run you through!"
          else if "<player.money>" <= "<cons:reqFee>"
          chat "<white>You only have <player.money.asint> <gold>Gold<white>! Come back when you have 500 <gold>Gold<white>."
        - zap step:getPromotion SCRIPT:PromotionKnight

'GivePromotion':
      Type: task
      Script:
        # Player got this far they must meet all the requirements lets take some money since we already know they have enough..
        - TAKE MONEY QTY:500
        # Time to execute a command in the console to promote the player..
        - execute asserver 'manuadd <player.name> Knight'
        # Player got promoted lets remember that and store the step gotPromotion..
        - zap step:gotPromotion SCRIPT:PromotionKnight
        # Why not let others know of this players promotion for the gratz..
        - ANNOUNCE "<player.name> has joined the ranks of the Knights!"
 
# END OF LINE




Comments
2013-04-05 11:58:25 - karlo7:

What if the server uses an item based economy like my local server does? How do i go about changing the variables so that it checks for X amount of nether stars (server currency) in the players inventory? I'm rather new to scripting, sorry.
2013-04-05 23:48:04 - Aortal:

item based economy is actually a lot simpler. I will possibly do another version with a item based economy. Ideally I would have them all run under the same script then have the ability to configure the npc just by talking to him as op using flags to store the configuration.
2013-04-08 09:02:08 - karlo7:

Awesome! I'm trying to learn from all the scripts here, still fairly new. Shame there aren't a lot of scripts for 0.8 yet