• 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.

[Eventing Question] Using Debug commands in game when talking to an NPC

  • 12
    Posts
    3
    Years
    • Seen Oct 2, 2023
    Hi,
    I'm super new to Pokemon Essentials and I was wondering if there was a way to call the debug function to fill the player's PC with one of every type of pokemon through talking to an in-game NPC. My game is going to be an Elite 4 Boss Gauntlet (more than 5 trainers) and I want the player to be able to pick any pokemon they wish for their team. When I found this in the debug menu I thought it was perfect for what I need. However, I have no idea how to call it in the event page for the NPC I want to assign it to. I tried reading through the script files and seeing how it was being called for the Debug Menu but I couldn't find it.

    Is it possible to do this through talking with an NPC or do I need to write a new script to handle it?
    If I can do it this way, what would be the command/code I need to use for my NPC Event Page?
    If I have to write a new script, how would I go about doing that? Would I take the Fill Player PC function from Debug.Menu and make that into a separate script?

    My background in coding is intermediate although I've never worked with Ruby before, but I am able to read it.

    Please help. Thank you!
     

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen yesterday
    Hi,
    I'm super new to Pokemon Essentials and I was wondering if there was a way to call the debug function to fill the player's PC with one of every type of pokemon through talking to an in-game NPC. My game is going to be an Elite 4 Boss Gauntlet (more than 5 trainers) and I want the player to be able to pick any pokemon they wish for their team. When I found this in the debug menu I thought it was perfect for what I need. However, I have no idea how to call it in the event page for the NPC I want to assign it to. I tried reading through the script files and seeing how it was being called for the Debug Menu but I couldn't find it.

    Is it possible to do this through talking with an NPC or do I need to write a new script to handle it?
    If I can do it this way, what would be the command/code I need to use for my NPC Event Page?
    If I have to write a new script, how would I go about doing that? Would I take the Fill Player PC function from Debug.Menu and make that into a separate script?

    My background in coding is intermediate although I've never worked with Ruby before, but I am able to read it.

    Please help. Thank you!

    So, actually it's not a function, it's a part of a function.
    In the script Debug_Menu, find the function:
    Code:
    def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
    This function has a very big switch ("switch" from C++ = "case" in Ruby).
    Find the condition:
    Code:
      when "fillboxes"
    and all the code below, until:
    Code:
      when "clearboxes"
    is the code that you want.
    I suggest you make a function for it, for example:
    Code:
    def pbFillAllBoxes
      # Paste the whole code here
    end
    And then, in the event, call that function in a script (double-click in the "List of Event Commands", go to tab 3, and click "Script", and then call the function pbFillAllBoxes).
    You can also add a few dialogue lines or conditions.
     
  • 12
    Posts
    3
    Years
    • Seen Oct 2, 2023
    So, actually it's not a function, it's a part of a function.
    In the script Debug_Menu, find the function:
    Code:
    def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
    This function has a very big switch ("switch" from C++ = "case" in Ruby).
    Find the condition:
    Code:
      when "fillboxes"
    and all the code below, until:
    Code:
      when "clearboxes"
    is the code that you want.
    I suggest you make a function for it, for example:
    Code:
    def pbFillAllBoxes
      # Paste the whole code here
    end
    And then, in the event, call that function in a script (double-click in the "List of Event Commands", go to tab 3, and click "Script", and then call the function pbFillAllBoxes).
    You can also add a few dialogue lines or conditions.

    Hey StCooler!

    Thanks so much for the reply!

    For the code you suggested, where do I put the new function? Do I have to create a new script for it?

    If I have to put it in an existing script, please tell me where explicitly. I really don't want to mess something up and have to restart my project.

    Can't wait for your reply~! :)
     

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen yesterday
    Hey StCooler!

    Thanks so much for the reply!

    For the code you suggested, where do I put the new function? Do I have to create a new script for it?

    If I have to put it in an existing script, please tell me where explicitly. I really don't want to mess something up and have to restart my project.

    Can't wait for your reply~! :)

    You're welcome :)
    The safest way is to make a new script for all your new functions, so you can find them easily a month later when you don't remember ^^
    Besides, Ruby allows you to define a class in several files and it allows you to make additions to functions, so it's basically asking for you to make a new script :)
     
  • 12
    Posts
    3
    Years
    • Seen Oct 2, 2023
    You're welcome :)
    The safest way is to make a new script for all your new functions, so you can find them easily a month later when you don't remember ^^
    Besides, Ruby allows you to define a class in several files and it allows you to make additions to functions, so it's basically asking for you to make a new script :)

    I made a new script, edited a little because I was getting some compiling errors from all the 'end' at the end of the function and the debug message that appears at the end of that code, and tested it on an npc.
    WORKS LIKE A CHARM! ~chef's kiss~

    Thank you so much StCooler for not only a great response but a fast one at that, honestly expected my question to be answered like a week from now!
    This has been extremely helpful!
     

    StCooler

    Mayst thou thy peace discover.
  • 9,304
    Posts
    4
    Years
    • Seen yesterday
    I made a new script, edited a little because I was getting some compiling errors from all the 'end' at the end of the function and the debug message that appears at the end of that code, and tested it on an npc.
    WORKS LIKE A CHARM! ~chef's kiss~

    Thank you so much StCooler for not only a great response but a fast one at that, honestly expected my question to be answered like a week from now!
    This has been extremely helpful!

    :)
     
    Back
    Top