• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Cool Player Titles

Swdfm

Game Developer
245
Posts
5
Years
    • he/him
    • UK
    • Seen Dec 8, 2023
    #Allows you to give players titles, such as Sir, Madam etc.

    Code:
    #===============================================================================
    #                                Cool Player Titles
    #                                     by Swdfm
    #===============================================================================
    #
    #                 To use, call $Trainer.title
    #                 Recommended for use in Trainer Cards etc.
    #
    #===============================================================================
    #===============================================================================
    #
    #          - PLAYERTITLES is a constant used for the variable to store all the 
    #            unlocked titles.
    #          - The array from pbPlayerTitle is where you are to put your title
    #             names.
    #          - Use pbUnlockTitle(NUMBER) to unlock titles. NUMBER is the index of
    #             the title from the array just mentioned. Begins with 0.
    #          - pbLockTitle(NUMBER) locks the title.
    #          - pbStripTitle(NUMBER) makes the title blank.
    #          - Call pbChooseTitle to pick a title from a list of unlocked titles.
    #             add an argument to give a message while selecting.
    #             eg. pbChooseTitle("Pick a cool title!")
    #             Ensure at least one title is unlocked before calling this.
    #          - Call pbCheckTitle(NUMBER) to check if a certain title has been
    #             unlocked.
    #          
    #===============================================================================
    #
    #            Thanks for using, and please credit Swdfm if used in your game.
    #
    #===============================================================================
    
    
            PLAYERTITLES = 19 #Change this number to an empty global variable.
    
    
      def pbPlayerTitle
        #Change these to titles you want for your own game.
        array=[
        (_INTL("Trainer")),     (_INTL("Sir")),       (_INTL("Lord")),
        (_INTL("Count")),       (_INTL("Duke")),      (_INTL("Master")),
        (_INTL("Priest")),      (_INTL("Ninja")),     (_INTL("Student")),
        (_INTL("Warrior")),     (_INTL("Fighter")),   (_INTL("Champion"))
        ]
        
        if $Trainer.isFemale?
          array[1]=(_INTL("Madam"))
          array[2]=(_INTL("Lady"))
          array[3]=(_INTL("Countess"))
          array[4]=(_INTL("Duchess"))
          array[6]=(_INTL("Priestess"))
        end
        
        return array
      end
    
      def pbInitTitles
        #Makes all the titles into an array full of falses.
        if pbGet(PLAYERTITLES)==0
          $game_variables[PLAYERTITLES]=[[]]
          for i in 0...pbPlayerTitle.length
            $game_variables[PLAYERTITLES][i]=false
          end
        end
      end
    
      def pbListTitles
        #Returns an array of your unlocked titles.
        pbInitTitles
        array=[]
        unlock=$game_variables[PLAYERTITLES]
        for i in 0...unlock.length
          if unlock[i]==true
            array.push(pbPlayerTitle[i])
          end
        end
        return array
      end
    
      def pbChooseTitle(message=nil)
        #Gives a list of available titles that you can select from and pick a title.
        array=pbListTitles
        if array != nil
          command=Kernel.pbShowCommands(message,array,-1) if message==nil
          command=Kernel.pbMessage(message,array) if message != nil
          if command != -1
            name=array[command]
            if name==$Trainer.title
              Kernel.pbMessage(_INTL("You already have this title!"))
              return true
            end
            $Trainer.title=name
            Kernel.pbMessage(_INTL("Your title has been changed to {1}!",name))
            return true
          end
        end
        return false
      end
    
      def pbStripTitle
        #Obviously, removes your title without locking it.
        $Trainer.title=""
      end
    
      def pbUnlockTitle(num)
        #Unlocks a title
        pbInitTitles
        if !pbCheckTitle(num)
          $game_variables[PLAYERTITLES][num]=true
          name=pbPlayerTitle[num]
          Kernel.pbMessage(_INTL("You can now get the title of {1}!",name))  
        end
      end
    
      def pbLockTitle(num)
        #Locks a title
        pbInitTitles
        $game_variables[PLAYERTITLES][num]=false
      end
      
      def pbCheckTitle(num)
        #Checks you have a certain title.
        pbInitTitles
        return true if $game_variables[PLAYERTITLES][num]
        return false
      end
      
    class PokeBattle_Trainer
      attr_accessor(:title)
    end
     
    26
    Posts
    5
    Years
    • Seen Nov 25, 2021
    I liked it, I'll use it as a way to rank the player, I edited a bit for that, but, You could add in Script how to force a Title. I already have, but it's something useful.
    If something is misspelled it is Google Translate.
     
    Last edited:
    421
    Posts
    9
    Years
  • I really like this! I did something similar in my fangame, The Camry Legend where you would defeat Master Trainers and get a title, but this is a mega improvement! I might just use this in the sequel.
     
    9
    Posts
    3
    Years
    • Seen Jan 14, 2023
    In what way could I use this title in game? like does it show up anywhere? im not well versed in scripts to know if i could.
     
    Back
    Top