The PokéCommunity Forums Fan Games Game Development Scripts, Tutorials & Tools
Essentials Script Pokemon Birthsigns

Scripts, Tutorials & Tools 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
  #201    
Old October 2nd, 2018 (7:00 PM).
Venomous_Zero86's Avatar
Venomous_Zero86 Venomous_Zero86 is offline
Pokemon Chosen Ones (Coming Soon)
     
    Join Date: Mar 2016
    Gender: Male
    Posts: 113
    in a event is the scritp suposse to go like this pokemon.setRandomSign for a random one i keep getting errors
    __________________
    Whatever you do in this life, it's not legendary unless your friends are there to see it. -Barney Stinson
    Reply With Quote
      #202    
    Old October 2nd, 2018 (8:14 PM).
    Lucidious89 Lucidious89 is offline
       
      Join Date: Apr 2014
      Gender: Male
      Posts: 208
      Quote:
      Originally Posted by Venomous_Zero86 View Post
      i wanted to put in the part of my game that explains birthsign would you mind telling me how i should word it
      I more or less summarized it in the first post. But if you want something more specific:

      A Birthsign is a special attribute a Pokemon may have that is determined by its time of birth. There are 12 different signs that form a zodiac, which correspond to the 12 months of the year. A Pokemon will inherit the sign that is tied to the month it was born in. Each of these 12 signs grant unique perks to the Pokemon with a variety of effects, and can even be called upon in battle to unleash a Zodiac Power if the proper item is held. Each sign has two corresponding "partner" signs, and one corresponding "rival" sign. When breeding, parents may yield better offspring if they share compatible signs. However, offspring may be of poorer quality if the parents have rivaling signs. It is impossible to alter a Pokemon's sign through normal means, but it is possible for a Pokemon to convert to a different sign if it receives a blessing from some divine force. However, once a Pokemon has been blessed, it may no longer receive a different blessing.


      ^That basically sums up the mechanics of the entire birthsign system in a paragraph.

      Quote:
      Originally Posted by Venomous_Zero86 View Post
      in a event is the scritp suposse to go like this pokemon.setRandomSign for a random one i keep getting errors
      Define what "pokemon" is. You have to actually define what setRandomSign is targeting. I just wrote "pokemon" in there as placeholder. Just write it out in the event the same way you would if you were to try and change a Pokemon's IV's, Nature, Shininess, etc...
      Reply With Quote
        #203    
      Old October 3rd, 2018 (3:08 AM).
      Venomous_Zero86's Avatar
      Venomous_Zero86 Venomous_Zero86 is offline
      Pokemon Chosen Ones (Coming Soon)
         
        Join Date: Mar 2016
        Gender: Male
        Posts: 113
        Quote:
        Originally Posted by Lucidious89 View Post
        I more or less summarized it in the first post. But if you want something more specific:

        A Birthsign is a special attribute a Pokemon may have that is determined by its time of birth. There are 12 different signs that form a zodiac, which correspond to the 12 months of the year. A Pokemon will inherit the sign that is tied to the month it was born in. Each of these 12 signs grant unique perks to the Pokemon with a variety of effects, and can even be called upon in battle to unleash a Zodiac Power if the proper item is held. Each sign has two corresponding "partner" signs, and one corresponding "rival" sign. When breeding, parents may yield better offspring if they share compatible signs. However, offspring may be of poorer quality if the parents have rivaling signs. It is impossible to alter a Pokemon's sign through normal means, but it is possible for a Pokemon to convert to a different sign if it receives a blessing from some divine force. However, once a Pokemon has been blessed, it may no longer receive a different blessing.


        ^That basically sums up the mechanics of the entire birthsign system in a paragraph.



        Define what "pokemon" is. You have to actually define what setRandomSign is targeting. I just wrote "pokemon" in there as placeholder. Just write it out in the event the same way you would if you were to try and change a Pokemon's IV's, Nature, Shininess, etc...

        Oh ok thanks alot ill pu at npc hat stops and explains this o you with your expanation this will help alot i just didn add zotiac powers tho
        __________________
        Whatever you do in this life, it's not legendary unless your friends are there to see it. -Barney Stinson
        Reply With Quote
          #204    
        Old October 3rd, 2018 (6:11 AM). Edited October 3rd, 2018 by Marin.
        Marin's Avatar
        Marin Marin is offline
        Not Bored
         
        Join Date: Nov 2016
        Age: 16
        Gender: Other
        Posts: 792
        By overwrites PokeBattle_Pokemon's constructor, the potential call to "getFormOnCreation" is overwritten. This causes Pokémon that would normally have a different form upon creation to have form 0.

        This could be fixed either by aliasing the constructor to add your instance variables in, or to add the missing code (can originally be found in Pokemon_Forms, line 42) to your overwritten constructor:
        Code:
            f=MultipleForms.call("getFormOnCreation",self)
            if f
              self.form=f
              self.resetMoves
            end
        I'd highly suggest aliasing though. By overwriting the constructor, you break all other scripts that touch it (regardless of whether they alias or overwrite).

        Sorry if I'm speaking too technical terms, I can clarify further if you'd like.
        Reply With Quote
          #205    
        Old October 5th, 2018 (1:02 PM).
        Lucidious89 Lucidious89 is offline
           
          Join Date: Apr 2014
          Gender: Male
          Posts: 208
          Quote:
          Originally Posted by Marin View Post
          By overwrites PokeBattle_Pokemon's constructor, the potential call to "getFormOnCreation" is overwritten. This causes Pokémon that would normally have a different form upon creation to have form 0.

          This could be fixed either by aliasing the constructor to add your instance variables in, or to add the missing code (can originally be found in Pokemon_Forms, line 42) to your overwritten constructor:
          Code:
              f=MultipleForms.call("getFormOnCreation",self)
              if f
                self.form=f
                self.resetMoves
              end
          I'd highly suggest aliasing though. By overwriting the constructor, you break all other scripts that touch it (regardless of whether they alias or overwrite).

          Sorry if I'm speaking too technical terms, I can clarify further if you'd like.
          I'd appreciate if you would. I think I understand what the issue is that you're pointing out, but it does go slightly above my head, and I don't have any experience using aliases or how they really work. This entire project has been built so far from just taking apart existing things I've found in the default Essentials script, and teaching myself how to put them back together in a way that suits my ideas. So I'm not exactly well versed on the technical end on problems like this.

          Basically what im getting from you is that by making my overwrites to PokeBattle_Pokemon, it somehow omits something that allows Pokemon to spawn naturally in forms other than the default form 0. And that this can be fixed most efficiently by utilizing an alias as to not break other scripts that rely on the untouched version of the PokeBattle_Pokemon script. Is this correct?
          Reply With Quote
            #206    
          Old October 7th, 2018 (2:03 AM). Edited October 7th, 2018 by Marin.
          Marin's Avatar
          Marin Marin is offline
          Not Bored
           
          Join Date: Nov 2016
          Age: 16
          Gender: Other
          Posts: 792
          Quote:
          Originally Posted by Lucidious89 View Post
          I'd appreciate if you would. I think I understand what the issue is that you're pointing out, but it does go slightly above my head, and I don't have any experience using aliases or how they really work. This entire project has been built so far from just taking apart existing things I've found in the default Essentials script, and teaching myself how to put them back together in a way that suits my ideas. So I'm not exactly well versed on the technical end on problems like this.

          Basically what im getting from you is that by making my overwrites to PokeBattle_Pokemon, it somehow omits something that allows Pokemon to spawn naturally in forms other than the default form 0. And that this can be fixed most efficiently by utilizing an alias as to not break other scripts that rely on the untouched version of the PokeBattle_Pokemon script. Is this correct?
          Yeah, what you said is basically right. I'll break down what alias does real quick.

          Essentially all alias itself does it copy method a to method b, meaning that you have two methods that do the exact same. It's usually written as alias newmethod oldmethod. You can then call the oldmethod method with newmethod as well. Example:
          Code:
          def say_hi
            p "Hi!"
          end
          
          say_hi # Prints "Hi"
          
          say_hello # Undefined method say_hello, obviously
          
          # This copies say_hi to say_hello
          alias say_hello say_hi
          
          say_hello # Prints "Hi!"
          What this allows you to do is to add code to a method without needing to overwrite the whole entire method, like so:


          Code:
          def greet
            p "Greetings"
          end
          
          greet # Prints "Greetings"
          
          alias oldgreet greet
          def greet
            p "Welcome"
            oldgreet
          end
          
          
          greet
          #This now first prints "Welcome", and then prints "Greetings" after because it's calling that "oldgreet" alias. That method is still what the "greet" method USED to be, without the welcome part.[/code]


          And this oldgreet stuff is essentially what Essentials itself does in its own script. If you then completely overwrite/redefine the method, you lose all those aliases because the method is just completely overwritten.

          Code:
          def greet
            p "Greetings"
          end
          
          greet # Prints "Greetings"
          
          alias oldgreet greet
          def greet
            oldgreet
            p "Welcome!"
          end
          
          greet # Prints "Greetings", then "Welcome!"
          
          
          # Now this is what your script does:
          def greet
            p "Greetings"
            # Custom functionality
          end
          
          greet # Prints "Greetings"
          So as you can see in this example, you lose the p "Welcome!" code because it was overwritten. Now imagine the p "whatever" statements is actual code which is of importance such as setting the Pokémon's form upon creation, you lose that code. So either you could add that code yourself by simply copy-pasting what was in the alias like below:

          Code:
          def greet
            p "Greetings"
            p "Welcome!"
            p # Custom functionality
          end
          That would be one way to fix it. "Greetings" being the old code, "Welcome" being the aliased code, and then your custom logic. However, you could also use an alias which automatically also has the other changes made to the method with other aliases:

          Code:
          alias oldgreet greet
          def greet
            oldgreet # This would be "Greetings" and "Welcome!"
            # Custom functionality
          end
          This way you don't need to copy any other code and you keep support for other custom scripts (and even all Essentials-native scripts).


          I hope this has made it a little more clear. If not, you could try looking at what alias is and how it's used online. I also have a detailed Ruby basics tutorial if you need any more clarification about methods: https://www.pokecommunity.com/showthread.php?t=410026
          Reply With Quote
            #207    
          Old October 11th, 2018 (7:22 AM).
          Lucidious89 Lucidious89 is offline
             
            Join Date: Apr 2014
            Gender: Male
            Posts: 208
            Quote:
            Originally Posted by Marin View Post
            I hope this has made it a little more clear. If not, you could try looking at what alias is and how it's used online.
            Yes, I think this helped out a lot. By using what you wrote, and looking at other examples in the script, I ended up changing the original code:
            Code:
            def initialize(species,level,player=nil,withMoves=true)
                if species.is_a?(String) || species.is_a?(Symbol)
                  species = getID(PBSpecies,species)
                end
                cname = getConstantName(PBSpecies,species) rescue nil
                if !species || species<1 || species>PBSpecies.maxValue || !cname
                  raise ArgumentError.new(_INTL("The species number (no. {1} of {2}) is invalid.",species,PBSpecies.maxValue))
                  return nil
                end
                @species       = species
                @name          = PBSpecies.getName(@species)
                @personalID    = rand(256)
                @personalID    |= rand(256)<<8
                @personalID    |= rand(256)<<16
                @personalID    |= rand(256)<<24
                @hp            = 1
                @totalhp       = 1
                @ev            = [0,0,0,0,0,0]
                @iv            = []
                for i in 0...6
                  @iv[i]       = rand(32)
                end
                @moves         = []
                @status        = 0
                @statusCount   = 0
                @item          = 0
                @mail          = nil
                @fused         = nil
                @ribbons       = []
                @ballused      = 0
                @eggsteps      = 0
                #===========================================================================
                # Newly generated Pokemon have all flags set to neutral
                #===========================================================================
                @zodiacflag    = 0
                @leafflag      = 0
                @celestial     = false
                @blessed       = false
                #===========================================================================
                if player
                  @trainerID   = player.id
                  @ot          = player.name
                  @otgender    = player.gender
                  @language    = player.language
                else
                  @trainerID   = 0
                  @ot          = ""
                  @otgender    = 2
                end
                if $game_map
                  @obtainMap   = $game_map.map_id
                  @obtainText  = nil
                  @obtainLevel = level
                else
                  @obtainMap   = 0
                  @obtainText  = nil
                  @obtainLevel = level
                end
                @obtainMode    = 0   # Met
                @obtainMode    = 4 if $game_switches && $game_switches[FATEFUL_ENCOUNTER_SWITCH]
                @hatchedMap    = 0
                @timeReceived  = pbGetTimeNow.to_i
                self.level     = level
                calcStats
                @hp            = @totalhp
                dexdata = pbOpenDexData
                pbDexDataOffset(dexdata,self.fSpecies,19)
                @happiness     = dexdata.fgetb
                dexdata.close
                if withMoves
                  self.resetMoves
                else
                  for i in 0...4
                    @moves[i] = PBMove.new(0)
                  end
                end
              end


            into this updated code:
            Code:
            alias birthsign_initialize initialize  
              def initialize(*args)
                birthsign_initialize(*args)
                #===========================================================================
                # Newly generated Pokemon have all flags set to neutral
                #===========================================================================
                @zodiacflag    = 0
                @leafflag      = 0
                @celestial     = false
                @blessed       = false
                #===========================================================================
              end

            Everything seems to work as intended. I tested this out against wild Unown, and I can see the difference. Previously, the way I had the code set up before would only spawn Unown in their default "A" form. But now they properly spawn in randomized forms. Ill update my script in the link with these changes. Perhaps there are other areas of my scripts I can utilize aliasing with to condense the code a bit?
            Reply With Quote
              #208    
            Old October 12th, 2018 (1:35 AM).
            BIGFriv BIGFriv is offline
               
              Join Date: Jun 2012
              Posts: 1
              Hi!
              I was wondering if it would be possible for you to explain how you did the art used for the birthsigns?
              I wanted to change the birthsigns with some other mons etc. And I wanted to know if you could explain how you did the art?
              Reply With Quote
                #209    
              Old October 12th, 2018 (2:52 AM).
              Richard PT's Avatar
              Richard PT Richard PT is offline
                 
                Join Date: Aug 2014
                Location: Portugal
                Gender: Male
                Nature: Calm
                Posts: 123
                Quote:
                Originally Posted by Lucidious89 View Post
                Yes, I think this helped out a lot. By using what you wrote, and looking at other examples in the script, I ended up changing the original code:
                Code:
                def initialize(species,level,player=nil,withMoves=true)
                    if species.is_a?(String) || species.is_a?(Symbol)
                      species = getID(PBSpecies,species)
                    end
                    cname = getConstantName(PBSpecies,species) rescue nil
                    if !species || species<1 || species>PBSpecies.maxValue || !cname
                      raise ArgumentError.new(_INTL("The species number (no. {1} of {2}) is invalid.",species,PBSpecies.maxValue))
                      return nil
                    end
                    @species       = species
                    @name          = PBSpecies.getName(@species)
                    @personalID    = rand(256)
                    @personalID    |= rand(256)<<8
                    @personalID    |= rand(256)<<16
                    @personalID    |= rand(256)<<24
                    @hp            = 1
                    @totalhp       = 1
                    @ev            = [0,0,0,0,0,0]
                    @iv            = []
                    for i in 0...6
                      @iv[i]       = rand(32)
                    end
                    @moves         = []
                    @status        = 0
                    @statusCount   = 0
                    @item          = 0
                    @mail          = nil
                    @fused         = nil
                    @ribbons       = []
                    @ballused      = 0
                    @eggsteps      = 0
                    #===========================================================================
                    # Newly generated Pokemon have all flags set to neutral
                    #===========================================================================
                    @zodiacflag    = 0
                    @leafflag      = 0
                    @celestial     = false
                    @blessed       = false
                    #===========================================================================
                    if player
                      @trainerID   = player.id
                      @ot          = player.name
                      @otgender    = player.gender
                      @language    = player.language
                    else
                      @trainerID   = 0
                      @ot          = ""
                      @otgender    = 2
                    end
                    if $game_map
                      @obtainMap   = $game_map.map_id
                      @obtainText  = nil
                      @obtainLevel = level
                    else
                      @obtainMap   = 0
                      @obtainText  = nil
                      @obtainLevel = level
                    end
                    @obtainMode    = 0   # Met
                    @obtainMode    = 4 if $game_switches && $game_switches[FATEFUL_ENCOUNTER_SWITCH]
                    @hatchedMap    = 0
                    @timeReceived  = pbGetTimeNow.to_i
                    self.level     = level
                    calcStats
                    @hp            = @totalhp
                    dexdata = pbOpenDexData
                    pbDexDataOffset(dexdata,self.fSpecies,19)
                    @happiness     = dexdata.fgetb
                    dexdata.close
                    if withMoves
                      self.resetMoves
                    else
                      for i in 0...4
                        @moves[i] = PBMove.new(0)
                      end
                    end
                  end


                into this updated code:
                Code:
                alias birthsign_initialize initialize  
                  def initialize(*args)
                    birthsign_initialize(*args)
                    #===========================================================================
                    # Newly generated Pokemon have all flags set to neutral
                    #===========================================================================
                    @zodiacflag    = 0
                    @leafflag      = 0
                    @celestial     = false
                    @blessed       = false
                    #===========================================================================
                  end

                Everything seems to work as intended. I tested this out against wild Unown, and I can see the difference. Previously, the way I had the code set up before would only spawn Unown in their default "A" form. But now they properly spawn in randomized forms. Ill update my script in the link with these changes. Perhaps there are other areas of my scripts I can utilize aliasing with to condense the code a bit?
                Did you update the birthsigns with this recent change? In my pokemon essentials v17.2, i had problems with pokemon forms, i already told about that to Maruno, he said that some people had the same error after capturing a pokemon that contain forms. I used a fix from him, but pokemon like unown, don't randomize itself in battles. So, maybe, with your update, i can get the thing "fixed".
                __________________
                Reply With Quote
                  #210    
                Old October 12th, 2018 (8:06 AM).
                Lucidious89 Lucidious89 is offline
                   
                  Join Date: Apr 2014
                  Gender: Male
                  Posts: 208
                  Quote:
                  Originally Posted by Richard PT View Post
                  Did you update the birthsigns with this recent change? In my pokemon essentials v17.2, i had problems with pokemon forms, i already told about that to Maruno, he said that some people had the same error after capturing a pokemon that contain forms. I used a fix from him, but pokemon like unown, don't randomize itself in battles. So, maybe, with your update, i can get the thing "fixed".
                  Yes, I already updated my script with this yesterday. So if you've recently reinstalled it, you should be good. If not, just replace that section of code in my post with the new one.
                  Reply With Quote
                    #211    
                  Old October 12th, 2018 (8:18 AM).
                  Lucidious89 Lucidious89 is offline
                     
                    Join Date: Apr 2014
                    Gender: Male
                    Posts: 208
                    Quote:
                    Originally Posted by BIGFriv View Post
                    Hi!
                    I was wondering if it would be possible for you to explain how you did the art used for the birthsigns?
                    I wanted to change the birthsigns with some other mons etc. And I wanted to know if you could explain how you did the art?
                    It's rather easy. All I did was copy/paste the official art of a species (taken off Bulbapedia) into whatever image editing program you use. I used paint.net since it's free. Then I just adjust the darkness of the image to make it completely black so it looks like a silhouette. Then merge it on top of that starry sky image I use, then use the magic wand tool to highlight the Pokemon image and press delete to cut a pokemon-shaped hole in the starry sky. Then just layer a new sky image underneath the cut-out, and darken the bottom sky image a little. Now it'll look like there's a pokemon-shaped shadow in the sky.

                    After that you just find a star graphic on Google images and paste them around the Pokemon, and connect the dots to create a constellation.
                    Reply With Quote
                      #212    
                    Old October 13th, 2018 (4:30 AM).
                    Richard PT's Avatar
                    Richard PT Richard PT is offline
                       
                      Join Date: Aug 2014
                      Location: Portugal
                      Gender: Male
                      Nature: Calm
                      Posts: 123
                      Quote:
                      Originally Posted by Lucidious89 View Post
                      Yes, I already updated my script with this yesterday. So if you've recently reinstalled it, you should be good. If not, just replace that section of code in my post with the new one.
                      It worked like a charm. :D

                      Thx and i will give credits in my game final credits, like i did for others too.
                      __________________
                      Reply With Quote
                        #213    
                      Old 3 Weeks Ago (9:24 AM).
                      p.claydon p.claydon is offline
                         
                        Join Date: Jan 2011
                        Gender: Female
                        Posts: 390
                        theres a fix for the catch form crash?
                        __________________
                        Still learning how to sprite but if you want to look at my progress then here you go
                        http://pclaydon.deviantart.com/gallery/
                        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
                        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:33 AM.