The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Character Selection

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Reply
 
Thread Tools
  #1    
Old November 10th, 2014 (4:17 PM). Edited May 21st, 2018 by FL.
FL's Avatar
FL FL is offline
Pokémon Island Creator
     
    Join Date: Sep 2010
    Gender: Male
    Posts: 1,761
    For copying the script at PokéCommunity: Click Thread Tools, and then Show Printable Version, and copy that instead.
    Code:
    #===============================================================================
    # * Character Selection - by FL (Credits will be apreciated)
    #===============================================================================
    #
    # This script is for Pokémon Essentials. It's a character selection screen
    # suggested for player selection or partner selection.
    #
    #===============================================================================
    #
    # To this script works, put it above main and put a 32x32 background at 
    # "Graphics/Pictures/characterselectiontile" (may works with other sizes).
    #
    # To call this script, use 'pbCharacterSelection(overworld,battle)' passing two
    # arrays as arguments: the first must have the overworld graphics names and the
    # second must have the battle graphics, both using "Graphics/Pictures/" as 
    # directory. Both arrays must have the same since that can't be an odd number.
    # The return is the player selected index, starting at 0. 
    #
    # An example that initialize the player:
    #
    # overworld = ["trchar000","trchar001","trchar002","trchar003"]
    # battle = ["trainer000","trainer001","trainer002","trainer003"]
    # result = pbCharacterSelection(overworld,battle) 
    # pbChangePlayer(result)
    #
    #===============================================================================
    
    class CharacterSelectionScene
      SPEED=2 # Can be 1, 2, 4 or 8.
      TURNTIME=128 # In frames
      
      def pbStartScene(overworld,battle)
        @overworld = overworld
        @battle = battle
        @sprites={}
        @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
        @viewport.z=99999
        @sprites["bg"]=CharacterSelectionPlane.new(SPEED,TURNTIME,@viewport)
        @sprites["bg"].setBitmap("Graphics/Pictures/characterselectiontile")
        @sprites["arrow"]=IconSprite.new(@viewport)
        @sprites["arrow"].setBitmap("Graphics/Pictures/selarrow")
        @sprites["battlerbox"]=Window_AdvancedTextPokemon.new("")
        @sprites["battlerbox"][email protected]
        pbBottomLeftLines(@sprites["battlerbox"],5)
        @sprites["battlerbox"].width=256
        @sprites["battlerbox"][email protected]["battlerbox"].width
        @sprites["battlerbox"].z=0
        @sprites["battler"]=IconSprite.new(384,284,@viewport)
        # Numbers for coordinates calculation
        lines = 2
        marginX = 64
        marginY = 72
        lastPointX = 512
        lastPointY = 232
        diferenceX = lastPointX - marginX*2
        diferenceY = lastPointY - marginY*2
        for i in [email protected]
          @sprites["icon#{i}"]=AnimatedChar.new(
              "Graphics/Characters/"[email protected][i],4,16/SPEED,TURNTIME,@viewport)
          @sprites["icon#{i}"].x= @overworld.size<=2 ? marginX + (diferenceX / 2) :
              marginX+(diferenceX*(i/2))/((@overworld.size-1)/2)
          @sprites["icon#{i}"].y=marginY+diferenceY*(i%lines)
          @sprites["icon#{i}"].start
        end
        updateCursor
        @sprites["messagebox"]=Window_AdvancedTextPokemon.new(
            _INTL("Choose your character."))
        @sprites["messagebox"][email protected]
        pbBottomLeftLines(@sprites["messagebox"],5)
        @sprites["messagebox"].width=256
        pbFadeInAndShow(@sprites) { update }
      end
      
      def updateCursor(index=nil)
        @index=0
        if index
          pbSEPlay("Choose",80)
          @index=index
        end
        @sprites["arrow"][email protected]["icon#{@index}"].x-32
        @sprites["arrow"][email protected]["icon#{@index}"].y-32
        @sprites["battler"].setBitmap("Graphics/Characters/"[email protected][@index])
        @sprites["battler"][email protected]["battler"].bitmap.width/2
        @sprites["battler"][email protected]["battler"].bitmap.height/2
      end  
      
      def pbMidScene
       loop do
        Graphics.update
        Input.update
        self.update
        if Input.trigger?(Input::C)
          pbSEPlay("Choose",80)
          if pbDisplayConfirm(_INTL("Are you sure?"))
            pbSEPlay("Choose",80)
            return @index
          end
          pbSEPlay("Choose",80)
        end
        lines=2
        if Input.repeat?(Input::LEFT)
          updateCursor((@index-lines)>=0 ? 
              @index-lines : @overworld.size-lines+(@index%lines))
        end
        if Input.repeat?(Input::RIGHT)
          updateCursor((@index+lines)<=(@overworld.size-1) ? 
              @index+lines : @index%lines)
        end
        if Input.repeat?(Input::UP)
          updateCursor(@index!=0 ? @index-1 : @overworld.size-1)
        end
        if Input.repeat?(Input::DOWN)
          updateCursor(@[email protected] ? @index+1 : 0)  
        end
       end 
      end
      
      def update
        pbUpdateSpriteHash(@sprites)
      end
      
      def pbDisplayConfirm(text)
       ret=-1
       [email protected]["messagebox"].text
       @sprites["messagebox"].text=text
       using(cmdwindow=Window_CommandPokemon.new([_INTL("YES"),_INTL("NO")])){
         [email protected]+1
         cmdwindow.visible=false
         pbBottomRight(cmdwindow)
         [email protected]["messagebox"].height
         loop do
           Graphics.update
           Input.update
           cmdwindow.visible=true if [email protected]["messagebox"].busy?
           cmdwindow.update
           self.update
           if Input.trigger?(Input::B) && [email protected]["messagebox"].busy?
             ret=false
           end
           if (Input.trigger?(Input::C) && 
               @sprites["messagebox"].resume && [email protected]["messagebox"].busy?)
             ret=(cmdwindow.index==0)
             break
           end
         end
       }
       @sprites["messagebox"].text=oldtext
       return ret
      end
      
      def pbEndScene
        pbFadeOutAndHide(@sprites) { update }
        pbDisposeSpriteHash(@sprites)
        @viewport.dispose
      end
    
      class CharacterSelectionPlane < AnimatedPlane
        LIMIT=16
        
        def initialize(speed, turnTime, viewport)
          super(viewport)
          @speed = speed
          @turnTime = turnTime
        end  
        
        def update
          super
          @frame=0 if [email protected]
          @frame+=1
          @direction=0 if [email protected]
          if @[email protected]
            @frame=0
            @direction+=1
            @direction=0 if @direction==4
          end
          case @direction
          when 0 #down
            [email protected]
          when 1 #left
            [email protected]
          when 2 #up
            [email protected]
          when 3 #right
            [email protected]
          end
          self.ox=0 if self.ox==-LIMIT || self.ox==LIMIT 
          self.oy=0 if self.oy==-LIMIT || self.oy==LIMIT 
        end
      end
    
      class AnimatedChar < AnimatedSprite
        def initialize(*args)
          viewport = args[4]
          @sprite=Sprite.new(viewport)
          @animname=pbBitmapName(args[0])
          @framecount=args[1]
          @frameskip=[1,args[2]].max
          @turnTime=args[3]
          @realframes=0
          @realframeschar=0
          @direction=0
          begin
            @animbitmap=AnimatedBitmap.new(animname).deanimate
          rescue
            @animbitmap=Bitmap.new(framecount*4,32)
          end
          if @animbitmap.width%framecount!=0
            raise _INTL("Bitmap's width ({1}) is not a multiple of frame count ({2}) [Bitmap={3}]",@animbitmap.width,framewidth,animname)
          end
          @[email protected]/@framecount
          @[email protected]/4
          @framesperrow=framecount
          @playing=false
          [email protected]
          [email protected]
          [email protected]
          [email protected]/2
          [email protected]
          self.frame=0
        end
      
        def frame=(value)
          @frame=value
          @realframes=0
          [email protected]%@framesperrow*@framewidth
        end
      
        def update
          super
          if @playing
            @realframeschar+=1
            if @[email protected]
              @realframeschar=0 
              @direction+=1
              @direction= 0 if @direction==4
              #Spin
              if @direction==2
                dir=3
              elsif @direction==3
                dir=2
              else
                [email protected]
              end  
              [email protected]*dir
            end
          end
        end
      end  
    end
    
    class CharacterSelectionScreen
      def initialize(scene)
        @scene=scene
      end
      
      def pbStartScreen(overworld,battle)
        @scene.pbStartScene(overworld,battle)
        ret = @scene.pbMidScene
        @scene.pbEndScene
        return ret
      end
    end
    
    def pbCharacterSelection(overworld,battle)
      ret = nil
      pbFadeOutIn(99999) {
        scene=CharacterSelectionScene.new
        screen=CharacterSelectionScreen.new(scene)
        ret=screen.pbStartScreen(overworld,battle)
      }
      return ret
    end
    Attached Thumbnails
    characterselectionscreen.png‎  
    Attached Images
     
    __________________
    Reply With Quote

    Relevant Advertising!

      #2    
    Old November 10th, 2014 (5:26 PM). Edited November 10th, 2014 by Qwertyis666.
    Qwertyis666's Avatar
    Qwertyis666 Qwertyis666 is offline
    Dragon Trainer Since 1996
       
      Join Date: Feb 2014
      Location: Quebec, Canada
      Gender: Male
      Posts: 60
      Nice! I was looking for something like this :) but I have one question :
      I call the script after or before the gender selection in the intro?
      I think I will use it to change outfit, so it will be after I guess?

      Thanks in advance and sorry for my bad english
      __________________
      Pokemon Korano (First demo playable now :))
      The first demo have 3 gym and full of new cool features

      I need a new tileset and OW sprite so if you are a Spriter, PM me
      Reply With Quote
        #3    
      Old November 10th, 2014 (6:15 PM).
      Zeak6464's Avatar
      Zeak6464 Zeak6464 is offline
      Zeak #3205 - Discord
         
        Join Date: Mar 2013
        Location: USA
        Age: 25
        Gender: Male
        Nature: Calm
        Posts: 806
        Quote:
        Originally Posted by Qwertyis666 View Post
        Nice! I was looking for something like this :) but I have one question :
        I call the script after or before the gender selection in the intro?
        I think I will use it to change outfit, so it will be after I guess?

        Thanks in advance and sorry for my bad english
        I would do it after & make sure you have the Boy & Girl Characters Identified if your going to make this for Outfits. I personally love this script for adding in Tag Partner of your choice.
        There is a lot of stuff this script can be used for.
        __________________
        Looking for a team to help me finish Pokemon Green Remix

        DM please
        Reply With Quote
          #4    
        Old August 29th, 2016 (7:13 AM).
        kevios105 kevios105 is offline
           
          Join Date: Aug 2016
          Gender: Male
          Posts: 9
          how does this script work?

          i create a new script in script editor and name it "characterselect" then i go to "Intro" (map) and open the event where you must choose if you boy or girl and make this
          Quote:
          Comment: Initializes player 0 (PlayerA).
          ["pbChangePlayer" takes a value from 0 through 7;
          other values are not valid. To edit information about
          a player, choose "Set Metadata" in the Pokemon
          Essentials Editor and select "Global".]

          Script: pbCharacterSelection(overworld,battle)
          but this doesn´t work for me ...

          sorry my english and my knowledge about essentials and scripting is very weak.
          please help to get this script work for me i use the newest essentials (16v2)....

          i hope anyone can help me :(
          Reply With Quote
            #5    
          Old September 3rd, 2016 (5:16 PM).
          FL's Avatar
          FL FL is offline
          Pokémon Island Creator
             
            Join Date: Sep 2010
            Gender: Male
            Posts: 1,761
            Quote:
            Originally Posted by kevios105 View Post
            how does this script work?

            i create a new script in script editor and name it "characterselect" then i go to "Intro" (map) and open the event where you must choose if you boy or girl and make this

            but this doesn´t work for me ...

            sorry my english and my knowledge about essentials and scripting is very weak.
            please help to get this script work for me i use the newest essentials (16v2)....

            i hope anyone can help me :(
            Use the code:

            Code:
            overworld = ["trchar000","trchar001","trchar002","trchar003"]
            battle = ["trainer000","trainer001","trainer002","trainer003"]
            result = pbCharacterSelection(overworld,battle) 
            pbChangePlayer(result)
            And make sure that the first four players are initialized. If you want eight players, use eight sprite pairs (overworld and battle).
            __________________
            Reply With Quote
              #6    
            Old April 17th, 2017 (5:46 AM).
            Jazerules Jazerules is offline
               
              Join Date: Apr 2017
              Posts: 34
              Everytime I choose character in the screen for the first click it looped me back to selection screen. After second click then the game proceed with the character you chose. I tried with any no. of character choices and it doesn't affect it. Even I answered no first then yes after wards it still looping me back.
              Anyone with the same case?Hope anyone can help me here.
              Reply With Quote
                #7    
              Old April 18th, 2017 (5:28 AM).
              FL's Avatar
              FL FL is offline
              Pokémon Island Creator
                 
                Join Date: Sep 2010
                Gender: Male
                Posts: 1,761
                Quote:
                Originally Posted by Jazerules View Post
                Everytime I choose character in the screen for the first click it looped me back to selection screen. After second click then the game proceed with the character you chose. I tried with any no. of character choices and it doesn't affect it. Even I answered no first then yes after wards it still looping me back.
                Anyone with the same case?Hope anyone can help me here.
                I tested right now on Essentials V16.2 and it's working. Probably is something that you done wrong on your code, like don't deactivate the event who trigger the script. Try putting a message after the character selection script call. If it doesn't works, post your code here.
                __________________
                Reply With Quote
                  #8    
                Old April 19th, 2017 (1:00 AM). Edited April 19th, 2017 by Jazerules.
                Jazerules Jazerules is offline
                   
                  Join Date: Apr 2017
                  Posts: 34
                  Quote:
                  Originally Posted by FL View Post
                  I tested right now on Essentials V16.2 and it's working. Probably is something that you done wrong on your code, like don't deactivate the event who trigger the script. Try putting a message after the character selection script call. If it doesn't works, post your code here.
                  Well the full script was copied from thread tools so i don't think it was from syntax.

                  I used this code in the event to call the script:

                  overworld = ["trchar000","trchar001","trchar002","trchar003"]
                  battle = ["trainer000","trainer001","trainer002","trainer003"]
                  result = pbCharacterSelection(overworld,battle)
                  pbChangePlayer(result)

                  I tried it to put together in one script event. In separate script event but it all result same. First click do nothing after selecting yes but second click of the yes proceed with the choice character.

                  I tried putting a msg after the characterselection script call and this error occur

                  Quote:
                  Exception: NoMethodError
                  Message: Section173:517:in `pbChangePlayer'undefined method `<' for nil:NilClass
                  ***Full script:
                  pbChangePlayer(result)

                  Interpreter:243:in `pbExecuteScript'
                  (eval):1:in `pbExecuteScript'
                  Interpreter:1606:in `eval'
                  Interpreter:243:in `pbExecuteScript'
                  Interpreter:1606:in `command_355'
                  Interpreter:494:in `execute_command'
                  Interpreter:193:in `update'
                  Interpreter:106:in `loop'
                  Interpreter:198:in `update'
                  Scene_Map:103:in `update'
                  Reply With Quote
                    #9    
                  Old April 19th, 2017 (1:35 AM).
                  Jazerules Jazerules is offline
                     
                    Join Date: Apr 2017
                    Posts: 34
                    Sorry for multiple posting, I just want to say now it is working perfectly.
                    Thank you so much for this awesome code!!
                    Reply With Quote
                      #10    
                    Old July 16th, 2017 (5:03 PM).
                    ratylird ratylird is offline
                       
                      Join Date: Jul 2017
                      Posts: 10
                      Question, do any of you guys know how to remove the gender selection? I want the character and characters name to not be optional.
                      Reply With Quote
                        #11    
                      Old July 22nd, 2017 (4:38 PM). Edited July 22nd, 2017 by FL.
                      FL's Avatar
                      FL FL is offline
                      Pokémon Island Creator
                         
                        Join Date: Sep 2010
                        Gender: Male
                        Posts: 1,761
                        Quote:
                        Originally Posted by ratylird View Post
                        Question, do any of you guys know how to remove the gender selection? I want the character and characters name to not be optional.
                        I don't understand. You want a player selection with only one choice? I guess that this script should work, but what is the point?
                        __________________
                        Reply With Quote
                          #12    
                        Old July 26th, 2017 (10:27 AM).
                        ratylird ratylird is offline
                           
                          Join Date: Jul 2017
                          Posts: 10
                          Quote:
                          Originally Posted by FL View Post
                          I don't understand. You want a player selection with only one choice? I guess that this script should work, but what is the point?
                          No I want to remove the choice option all together and make you play as just the one character.
                          Reply With Quote
                            #13    
                          Old July 26th, 2017 (1:32 PM).
                          komaoto's Avatar
                          komaoto komaoto is offline
                             
                            Join Date: Mar 2014
                            Location: Brazil
                            Gender: Male
                            Posts: 114
                            Quote:
                            Originally Posted by ratylird View Post
                            No I want to remove the choice option all together and make you play as just the one character.
                            You mean the "character selection" beeing used to select outfits instead of using it for different character?
                            Reply With Quote
                              #14    
                            Old August 3rd, 2017 (10:44 PM).
                            ratylird ratylird is offline
                               
                              Join Date: Jul 2017
                              Posts: 10
                              No I just want it removed completely, so Oak won't sqy "are you a boy or girl? What is your name?" The game will just start after he explains the world of Pokemon
                              Reply With Quote
                                #15    
                              Old August 5th, 2017 (9:30 AM).
                              komaoto's Avatar
                              komaoto komaoto is offline
                                 
                                Join Date: Mar 2014
                                Location: Brazil
                                Gender: Male
                                Posts: 114
                                You just use the bottom example in the intro map. When making your event, it should look something like this:

                                Code:
                                @> Oak talking here
                                @> Script: pbChangePlayer(0)
                                @> Script: pbTrainerName(Red)
                                You don't need this script to do that.
                                And of course you can change both player and name to whatever you want.
                                Reply With Quote
                                  #16    
                                Old August 30th, 2017 (11:16 PM).
                                AndromedaKerova AndromedaKerova is offline
                                   
                                  Join Date: Aug 2015
                                  Gender: Female
                                  Nature: Sassy
                                  Posts: 32
                                  I'm having trouble getting this to work too.
                                  As a test I'm only trying to make the male select another character.

                                  Here is my event code:
                                  Spoiler:

                                  Error message:
                                  Code:
                                  ---------------------------
                                  Shadowname
                                  ---------------------------
                                  Exception: RuntimeError
                                  
                                  Message: Script error within event 1, map 1 (Intro):
                                  
                                  Exception: SyntaxError
                                  
                                  Message: (eval):11:in `pbExecuteScript'compile error
                                  (eval):8: syntax error
                                  (eval):11: syntax error
                                  
                                  ***Line '(overworld,battle)' shouldn't begin with '('. Try
                                  
                                  putting the '(' at the end of the previous line instead,
                                  
                                  or using 'extendtext.exe'.
                                  
                                  ***Line '(overworld,battle)' shouldn't begin with '('. Try
                                  
                                  putting the '(' at the end of the previous line instead,
                                  
                                  or using 'extendtext.exe'.
                                  
                                  ***Full script:
                                  
                                  overworld = 
                                  ["trchar000","trchar001","trchar002",
                                  "trchar003"]
                                  battle = 
                                  ["trainer000","trainer001","trainer00
                                  2","trainer003"]
                                  result = pbCharacterSelection
                                  (overworld,battle)
                                  pbChangePlayer(result)
                                  pbCharacterSelection
                                  (overworld,battle)
                                  
                                  
                                  
                                  
                                  Interpreter:276:in `pbExecuteScript'
                                  
                                  Interpreter:1606:in `command_355'
                                  
                                  Interpreter:494:in `execute_command'
                                  
                                  Interpreter:193:in `update'
                                  
                                  Interpreter:106:in `loop'
                                  
                                  Interpreter:198:in `update'
                                  
                                  Scene_Map:103:in `update'
                                  
                                  Scene_Map:101:in `loop'
                                  
                                  Scene_Map:114:in `update'
                                  
                                  Scene_Map:68:in `main'
                                  
                                  
                                  
                                  This exception was logged in 
                                  
                                  C:\Users\User\Saved Games/Shadowname/errorlog.txt.
                                  
                                  Press Ctrl+C to copy this message to the clipboard.
                                  ---------------------------
                                  OK   
                                  ---------------------------
                                  __________________
                                  Currently working on 2 projects.
                                  Chromia (banner to be added)
                                  Mirror (banner to be added)
                                  Reply With Quote
                                    #17    
                                  Old August 31st, 2017 (4:53 AM).
                                  komaoto's Avatar
                                  komaoto komaoto is offline
                                     
                                    Join Date: Mar 2014
                                    Location: Brazil
                                    Gender: Male
                                    Posts: 114
                                    Quote:
                                    Originally Posted by AndromedaKerova View Post
                                    something here
                                    Code:
                                    Exception: SyntaxError
                                    This line is saying what kind of error you are getting.

                                    And this is saying what you should do to fix the error:

                                    Code:
                                    ***Line '(overworld,battle)' shouldn't begin with '('. Try
                                    
                                    putting the '(' at the end of the previous line instead,
                                    
                                    or using 'extendtext.exe'.
                                    So you either put the '(' in the end of the previous line or use the "extendtext.exe". The extendtext is in the root of the game folder (the one where you run the game). Just double-click it and you are done. You will notice that yours message box became bigger than before. (it doesn't open a window of any kind, you won't even notice that it's running unless you insert text onto message boxes)
                                    Reply With Quote
                                      #18    
                                    Old September 6th, 2017 (6:20 AM). Edited September 6th, 2017 by Deatheye1.
                                    Deatheye1 Deatheye1 is offline
                                    Pokémon End of the World
                                       
                                      Join Date: Sep 2017
                                      Location: Here
                                      Gender: Male
                                      Posts: 6
                                      I use this code

                                      overworld = ["trchar000","trchar001","trchar002","trchar003"]
                                      battle = ["trainer000","trainer001","trainer002","trainer003"]
                                      result = pbCharacterSelection(overworld,battle)
                                      pbChangePlayer(result)

                                      But when i go to the script appears this message

                                      Code:
                                      Excepción: SyntaxError
                                      
                                      Mensaje: (eval):9:in `command_355'compile error
                                      (eval):8: syntax error
                                      
                                      EOW Antilag 1:201:in `command_355'
                                      
                                      Interpreter:494:in `eval'
                                      
                                      EOW Antilag 1:201:in `command_355'
                                      
                                      Interpreter:494:in `execute_command'
                                      
                                      Interpreter:193:in `update'
                                      
                                      Interpreter:106:in `loop'
                                      
                                      Interpreter:198:in `update'
                                      
                                      Scene_Map:103:in `update'
                                      
                                      Scene_Map:101:in `loop'
                                      
                                      Scene_Map:114:in `update'
                                      Edit: I fixed that, the error was another script that i have, but i have another error, is not a error message, when i choose another character nothing happens i still have the same overworld sprite
                                      Reply With Quote
                                        #19    
                                      Old September 10th, 2017 (11:49 AM).
                                      FL's Avatar
                                      FL FL is offline
                                      Pokémon Island Creator
                                         
                                        Join Date: Sep 2010
                                        Gender: Male
                                        Posts: 1,761
                                        Quote:
                                        Originally Posted by Deatheye1 View Post
                                        Edit: I fixed that, the error was another script that i have, but i have another error, is not a error message, when i choose another character nothing happens i still have the same overworld sprite
                                        Did you correctly defined the players on Metadata PBS?
                                        __________________
                                        Reply With Quote
                                          #20    
                                        Old September 10th, 2017 (12:15 PM). Edited September 10th, 2017 by Deatheye1.
                                        Deatheye1 Deatheye1 is offline
                                        Pokémon End of the World
                                           
                                          Join Date: Sep 2017
                                          Location: Here
                                          Gender: Male
                                          Posts: 6
                                          That was the problem thanks, now i have a question how can i use the script to choose a partner? For example i define three tainers in the script and i want to choose one of them to be my partner.
                                          Reply With Quote
                                            #21    
                                          Old September 13th, 2017 (4:27 PM).
                                          FL's Avatar
                                          FL FL is offline
                                          Pokémon Island Creator
                                             
                                            Join Date: Sep 2010
                                            Gender: Male
                                            Posts: 1,761
                                            Quote:
                                            Originally Posted by Deatheye1 View Post
                                            That was the problem thanks, now i have a question how can i use the script to choose a partner? For example i define three tainers in the script and i want to choose one of them to be my partner.
                                            Just use a simple conditional branch with my method result value:

                                            Code:
                                            overworld = ["trchar000","trchar001","trchar002","trchar003"]
                                            battle = ["trainer000","trainer001","trainer002","trainer003"]
                                            result = pbCharacterSelection(overworld,battle) 
                                            if result==0
                                              pbRegisterPartner(PBTrainers::HOOPYTRAINER,"Zaphod",0)
                                            elsif result==1
                                              pbRegisterPartner(PBTrainers::OTHERTRAINER,"Purple",0)
                                            elsif result==2
                                              pbRegisterPartner(PBTrainers::ANOTHERTRAINER,"Gray",0)
                                            elsif result==3
                                              pbRegisterPartner(PBTrainers::ONEMORETRAINER,"Brown",0)
                                            end
                                            Since this code is too big for a Script Event Command, I suggest you to put it above main, between a line with "def insertSomeMethodNameHere" and "end", and call it on the Event.
                                            __________________
                                            Reply With Quote
                                              #22    
                                            Old September 14th, 2017 (11:17 AM).
                                            Deatheye1 Deatheye1 is offline
                                            Pokémon End of the World
                                               
                                              Join Date: Sep 2017
                                              Location: Here
                                              Gender: Male
                                              Posts: 6
                                              Quote:
                                              Originally Posted by FL View Post
                                              Just use a simple conditional branch with my method result value:

                                              Code:
                                              overworld = ["trchar000","trchar001","trchar002","trchar003"]
                                              battle = ["trainer000","trainer001","trainer002","trainer003"]
                                              result = pbCharacterSelection(overworld,battle) 
                                              if result==0
                                                pbRegisterPartner(PBTrainers::HOOPYTRAINER,"Zaphod",0)
                                              elsif result==1
                                                pbRegisterPartner(PBTrainers::OTHERTRAINER,"Purple",0)
                                              elsif result==2
                                                pbRegisterPartner(PBTrainers::ANOTHERTRAINER,"Gray",0)
                                              elsif result==3
                                                pbRegisterPartner(PBTrainers::ONEMORETRAINER,"Brown",0)
                                              end
                                              Since this code is too big for a Script Event Command, I suggest you to put it above main, between a line with "def insertSomeMethodNameHere" and "end", and call it on the Event.
                                              Ok thanks, but i see that script only work one time, for example in a future event the partners must have more level with their team and when i put again the partner selection the partner had the team in the first trainer battle, how can i change that when the player has playing?
                                              Reply With Quote
                                                #23    
                                              Old September 19th, 2017 (5:00 PM).
                                              FL's Avatar
                                              FL FL is offline
                                              Pokémon Island Creator
                                                 
                                                Join Date: Sep 2010
                                                Gender: Male
                                                Posts: 1,761
                                                Quote:
                                                Originally Posted by Deatheye1 View Post
                                                Ok thanks, but i see that script only work one time, for example in a future event the partners must have more level with their team and when i put again the partner selection the partner had the team in the first trainer battle, how can i change that when the player has playing?
                                                This was nothing to do with my script...

                                                Anyway change the last "0" argument in partner call for a variable number that you change per moment.
                                                __________________
                                                Reply With Quote
                                                  #24    
                                                Old March 4th, 2018 (10:54 AM).
                                                SirDakishi SirDakishi is offline
                                                   
                                                  Join Date: Mar 2018
                                                  Posts: 2
                                                  Hi,
                                                  I think this is an amazing addition to essentials, and I'm keen to start using it in my game.

                                                  I'd like it to be a "costume change" tool for the player, so they can change outfits, possibly bound to an item
                                                  e.g one of my player characters is misty so I'd like to be able to switch to anime, hgss, and swimsuit styles

                                                  Is that possible? If so, can this script also replace surf/bike/fish graphics?

                                                  Also, is it possible to have it be useable on NPC trainers/gymleaders via a menu or item?
                                                  tl;dr trying to make a pokemon "best of" where you can change the trainers as you see fit
                                                  Reply With Quote
                                                    #25    
                                                  Old March 6th, 2018 (4:20 PM).
                                                  FL's Avatar
                                                  FL FL is offline
                                                  Pokémon Island Creator
                                                     
                                                    Join Date: Sep 2010
                                                    Gender: Male
                                                    Posts: 1,761
                                                    Quote:
                                                    Originally Posted by SirDakishi View Post
                                                    I'd like it to be a "costume change" tool for the player, so they can change outfits, possibly bound to an item
                                                    e.g one of my player characters is misty so I'd like to be able to switch to anime, hgss, and swimsuit styles

                                                    Is that possible? If so, can this script also replace surf/bike/fish graphics?

                                                    Also, is it possible to have it be useable on NPC trainers/gymleaders via a menu or item?
                                                    tl;dr trying to make a pokemon "best of" where you can change the trainers as you see fit
                                                    You can activate the script by item. An item example:
                                                    Item data on PBS:
                                                    Code:
                                                    621,YOURITEMINTERNALNAMEHERE,YourItemNameHere,YourItemNameHere,8,0,"Description goes here",2,0,6
                                                    Item code:
                                                    Code:
                                                    ItemHandlers.addUseFromBag(:YOURITEMINTERNALNAMEHERE, proc {|item|
                                                      overworld = ["trchar000","trchar001","trchar002","trchar003"]
                                                      battle = ["trainer000","trainer001","trainer002","trainer003"]
                                                      result = pbCharacterSelection(overworld,battle)
                                                      # Do things with result. 
                                                      next 1 # Continue
                                                    })
                                                    You can handle the result using game switches and variables to change NPCs outfits. For surf/bike/fish graphics this is a bit harder, I suggest you to set the $Trainer.outfit by result.
                                                    __________________
                                                    Reply With Quote
                                                    Reply

                                                    Quick Reply

                                                    Join the conversation!

                                                    Create an account to post a reply in this thread, participate in other discussions, and more!

                                                    Create a PokéCommunity Account

                                                    Sponsored Links
                                                    Thread Tools

                                                    Posting Rules
                                                    You may not post new threads
                                                    You may not post replies
                                                    You may not post attachments
                                                    You may not edit your posts

                                                    BB code is On
                                                    Smilies are On
                                                    [IMG] code is On
                                                    HTML code is Off

                                                    Forum Jump


                                                    All times are GMT -8. The time now is 2:12 AM.