Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Reply
 
Thread Tools
  #1    
Old December 14th, 2012 (11:34 AM).
reddevilz reddevilz is offline
     
    Join Date: Apr 2009
    Posts: 14
    I am trying to add a pokemon to the player from anouther trainer.

    pbAddForeignPokemon(PBSpecies:ANDSHREW,5,_I("Jake"),_I("Sorex"),0)

    if i understand from the tutorial that would work but it brings up an error everytime. I would also like to make added pokemon shiny if possible too.
    Reply With Quote

    Relevant Advertising!

      #2    
    Old December 14th, 2012 (5:49 PM).
    Maruno's Avatar
    Maruno Maruno is offline
    Lead Dev of Pokémon Essentials
       
      Join Date: Jan 2008
      Location: England
      Posts: 5,171
      An important thing to watch out for is how the code looks when you type it into an event. The code itself is fine, but it probably looks like this:

      Code:
      pbAddForeignPokemon
      (PBSpecies::SANDSHREW,5,_I
      ("Jake"),_I("Sorex"),0)
      RMXP is stupid, and thinks these are three separate and unrelated lines of code, rather than one long one. What you need to do is to tell RMXP that, when it gets to the end of the first line, that there's more of that line still to come. You do this by putting the open bracket "(" at the end of the first line rather than the beginning of the second line. You also need to do something similar with the second line, but make sure it ends on a comma (an open bracket would work as well; you'll develop your own style eventually).

      What you should end up with is something that looks like this:

      Code:
      pbAddForeignPokemon(
      PBSpecies::SANDSHREW,5,
      _I("Jake"),_I("Sorex"),0)
      The open bracket and the comma are useful things, because they indicate that the line hasn't finished yet, and the continuation is on the next line. There are one or two other such characters (probably), but you don't need to worry about them as the open bracket and comma will work for you just fine - they do for me.

      The alternative is to use ExtendText (the .exe in the game's folder) to make the script box much wider, allowing you to fit everything on the same line. It's certainly useful, although it's probably best if you do some clever lining as I described above, if you can afford the space.



      Having said all that, though, this particular script is best used as the argument of a Conditional Branch. It will return true if the Pokémon was added, and false if not. This allows you to "deactivate" the Pokémon-giving event once it's done its job (perhaps by playing with its Self Switches).

      To make the Pokémon shiny, read the wiki. There's also an example of exactly what you want in the example maps (far right NPC in the Pokémon Fan Club).
      __________________
      Go to the Pokémon Essentials Wiki

      | Downloads | Tutorials | Fangames |
      | All Animations Project |

      Follow me on Twitter: @maruno42


      Reply With Quote
        #3    
      Old December 16th, 2012 (7:44 AM).
      FL's Avatar
      FL FL is offline
      Pokémon Island Creator
         
        Join Date: Sep 2010
        Gender: Male
        Posts: 1,692
        Quote:
        Originally Posted by Maruno View Post
        RMXP is stupid
        This is a Ruby syntax problem, isn't? This language has an auto line break without use semicolon, although its support this symbol.

        The big problem is that RMXP has a small box for enter script, so the alternative is ExtendText like Maruno said.
        __________________
        Reply With Quote
          #4    
        Old December 17th, 2012 (6:03 AM).
        reddevilz reddevilz is offline
           
          Join Date: Apr 2009
          Posts: 14
          Thank you for explaining that to me and the script works perfectly now.
          Reply With Quote
          Reply
          Quick Reply

          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 4:07 PM.