• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • 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] [Pokemon Essentials v18] Giving the player types like Pokemon

zedcoeur

Zed Coeur
  • 29
    Posts
    5
    Years
    • Seen Apr 15, 2022
    So I'm working on making a whole concept where the player and other trainers have mono/dual-types within them, much like Pokemon do, and I want to have there be like a connection between the trainer and pokemon and allow them to do certain things, like a close bond if you will.

    My current struggle stands at giving the player said Pokemon types. Currently, I have two attr accessors for type1 and type2 in the PokeBattle_Trainer class, and I've defined them in the initialize method. I've also written small methods to allow the types of the trainers to be altered in events based on what's in the parentheses (i.e. pbChangePrimaryType(:FIRE)). I'm sure there are other aspects within these scripts that I'm missing, but I currently don't know what.

    Here is the script I've written:

    Code:
    def pbSoulTypes
        ret = [@soultype1]
        ret.push(@soultype2) if @soultype2!=@soultype1
      end
      
      def pbChangePrimarySoulType(type)
        @soultype1 = type
        pbSoulTypes
      end
      
      def pbChangeSecondarySoulType(type)
        @soultype2 = type
        pbSoulTypes
      end
     
    Why doesn't pbChangePrimarySoulType(type) work?
     
    I'm not quite sure, but I do get a NoMethodError when I try to run the method as pbChangePrimarySoulType(:NORMAL) in an event.

    It also looks like it's saying pbChangePrimarySoulType(type) is an undefined method for the Interpreter's pbExecuteScript.
     
    Could I see the whole error? I'm not an expert in Ruby, but I may be able to tell more
     
    sure:
    [Sat Aug 07 12:25:46 Central Daylight Time 2021]
    [Pokémon Essentials version 18]
    Exception: RuntimeError
    Message: Script error within event 15 (coords 19,18), map 82 (Route 301):
    Exception: NoMethodError
    Message: (eval):1:in `pbExecuteScript'undefined method `pbChangePrimarySoulType' for #<Interpreter:0xc9d6d50>

    ***Full script:
    pbChangePrimarySoulType(:NORMAL)


    Backtrace:
    Interpreter:201:in `pbExecuteScript'
    Interpreter:1466:in `eval'
    Interpreter:201:in `pbExecuteScript'
    Interpreter:1466:in `command_355'
    Interpreter:366:in `execute_command'
    Interpreter:155:in `update'
    Interpreter:102:in `loop'
    Interpreter:158:in `update'
    Scene_Map:162:in `update'
    Scene_Map:160:in `loop'


    Backtrace:
    Interpreter:237:in `pbExecuteScript'
    Interpreter:1466:in `command_355'
    Interpreter:366:in `execute_command'
    Interpreter:155:in `update'
    Interpreter:102:in `loop'
    Interpreter:158:in `update'
    Scene_Map:162:in `update'
    Scene_Map:160:in `loop'
    Scene_Map:169:in `update'
    Scene_Map:229:in `main'
     
    Back
    Top