• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Scripting Question] Registering a Partner

Incin

Gamer
  • 4
    Posts
    5
    Years
    I should start off by saying I'm working on a project in the GS version of Pokemon Essentials, which is using Essentials v13, and is slightly different from the updated version of v17.2. Also it may be pretty apparent that my Ruby skills are quite limited.

    Anyways, heregoes:


    the pbRegisterPartner method was already defined in this version of essentials, however slightly different from the one from v17.2, but it shouldn't affect the ability to run. I tried the same command in v17.2 and it works without a hitch, I'm just not understanding the problem, and maybe someone can help shine a light.

    Thanks in advance, I need to gain a better understanding so I know what to do when encountering problems like this.

    Here are the different versions of the code for comparison:

    Essentials GS(v13):

    def pbRegisterPartner(trainerid,trainername,partyid=0)
    Kernel.pbCancelVehicles
    trainer=pbLoadTrainer(trainerid,trainername,partyid)
    trainerobject=PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)
    trainerobject.setForeignID($Trainer)
    for i in trainer[2]
    i.trainerID=trainerobject.id
    i.ot=trainerobject.name
    i.calcStats
    end
    $PokemonGlobal.partner=[trainerid,trainerobject.name,trainerobject.id,trainer[2]]
    end


    Essentials v17.2:

    def pbRegisterPartner(trainerid,trainername,partyid=0)
    if trainerid.is_a?(String) || trainerid.is_a?(Symbol)
    trainerid = getID(PBTrainers,trainerid)
    end
    Kernel.pbCancelVehicles
    trainer = pbLoadTrainer(trainerid,trainername,partyid)
    Events.onTrainerPartyLoad.trigger(nil,trainer)
    trainerobject = PokeBattle_Trainer.new(_INTL(trainer[0].name),trainerid)
    trainerobject.setForeignID($Trainer)
    for i in trainer[2]
    i.trainerID = trainerobject.id
    i.ot = trainerobject.name
    i.calcStats
    end
    $PokemonGlobal.partner = [trainerid,trainerobject.name,trainerobject.id,trainer[2]]
    end


    This is the error message that displays:
    ---------------------------
    Pokemon Essentials GS
    ---------------------------
    Exception: RuntimeError
    Message: Script error within event 5, map 90 (Route 1):
    Exception: NoMethodError
    Message: Section084:1949:in `pbRegisterPartner'undefined method `[]' for nil:NilClass
    ***Full script:
    pbRegisterPartner(:CAMPER,"Liam",0)

    Interpreter:243:in `pbExecuteScript'
    (eval):1:in `pbExecuteScript'
    Interpreter:1600:in `eval'
    Interpreter:243:in `pbExecuteScript'
    Interpreter:1600: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'


    Interpreter:276:in `pbExecuteScript'
    Interpreter:1600: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'

    I tried multiple different combinations, even using the number of the trainerid in the trainertypes.txt file, to no avail.

    it's probably something simple and I am going to slap myself for not realizing, but that's the nature of the game I suppose.
     
    The issue was only a syntax error. I was trying to get a partner battle with Ash to ensue, and the command line goes like this in Essentials v13:

    pbRegisterPartner(67,"ASH",1)
    The number of the trainerid needs to be typed in because the line for converting the string into it's accomodating trainerid type isn't in the old version, and the string for the trainer's name needs to be in all caps because that's just how the older generation games did it.

    I worked it out myself and feel like a fool now for posting this thread.
     
    Back
    Top