Incin
Gamer
- 4
- Posts
- 5
- Years
- Pennsylvania
- Seen Mar 12, 2020
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.
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.