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

external editor and new encounter types

89
Posts
15
Years
    • Seen Apr 5, 2016
    The past 2 days I have been attempting to implement 3 new types of encounters using the method described in the wiki. They are WaterMorning, WaterDay, and WaterNight, and I am near positive I have followed the instructions properly, but the external editor does not show them no matter what I do. I remember having the same problem when poccil was the one making the kit so is this something I am doing wrong or is this normal for the kit?

    Defining them:
    Code:
    module EncounterTypes
      Land         = 0
      Cave         = 1
      Water        = 2
      RockSmash    = 3
      OldRod       = 4
      GoodRod      = 5
      SuperRod     = 6
      HeadbuttLow  = 7
      HeadbuttHigh = 8
      LandMorning  = 9
      LandDay      = 10
      LandNight    = 11
      BugContest   = 12
      WaterMorning = 13
      WaterDay     = 14
      WaterNight   = 15
      Names=[
        "Land",
        "Cave",
        "Water",
        "RockSmash",
        "OldRod",
        "GoodRod",
        "SuperRod",
        "HeadbuttLow",
        "HeadbuttHigh",
        "LandMorning",
        "LandDay",
        "LandNight",
        "BugContest",
        "WaterMorning",
        "WaterDay",
        "WaterNight"
      ]
      EnctypeChances=[
        [20,20,10,10,10,10,5,5,4,4,1,1],
        [20,20,10,10,10,10,5,5,4,4,1,1],
        [60,30,5,4,1],
        [60,30,5,4,1],
        [70,30],
        [60,20,20],
        [40,40,15,4,1],
        [30,25,20,10,5,5,4,1],
        [30,25,20,10,5,5,4,1],
        [20,20,10,10,10,10,5,5,4,4,1,1],
        [20,20,10,10,10,10,5,5,4,4,1,1],
        [20,20,10,10,10,10,5,5,4,4,1,1],
        [20,20,10,10,10,10,5,5,4,4,1,1],
        [60,30,5,4,1],
        [60,30,5,4,1],
        [60,30,5,4,1]
      ]
    Compiler
    Code:
          lastmapid=mapid
          if thisenc && (thisenc[1][EncounterTypes::Land] ||
                         thisenc[1][EncounterTypes::LandMorning] ||
                         thisenc[1][EncounterTypes::LandDay] ||
                         thisenc[1][EncounterTypes::BugContest] ||
                         thisenc[1][EncounterTypes::LandNight]
                         thisenc[1][EncounterTypes::WaterMorning] ||
                         thisenc[1][EncounterTypes::WaterDay] ||
                         thisenc[1][EncounterTypes::WaterNight] ||) &&
                         thisenc[1][EncounterTypes::Cave]
            raise _INTL("Can't define both Land and Cave encounters in the same area (map ID {1})",mapid)
          end
          thisenc=[[25,10,10,0,0,0,0,0,0,25,25,25,25,10,10,10],[]]
          encounters[mapid.to_i]=thisenc
          needdensity=true
          i+=1
          next
        end
        enclines=[12,12,5,5,2,3,5,8,8,12,12,12,12,5,5,5]
    So that it cant be used on a cave map
    Code:
        elsif needdensity
          needdensity=false
          nums=strsplit(line,/,/)
          if nums && nums.length>=3
            thisenc[0][EncounterTypes::Land]=nums[0].to_i
            thisenc[0][EncounterTypes::LandMorning]=nums[0].to_i
            thisenc[0][EncounterTypes::LandDay]=nums[0].to_i
            thisenc[0][EncounterTypes::LandNight]=nums[0].to_i
            thisenc[0][EncounterTypes::BugContest]=nums[0].to_i
            thisenc[0][EncounterTypes::Cave]=nums[1].to_i
            thisenc[0][EncounterTypes::Water]=nums[2].to_i
            thisenc[0][EncounterTypes::WaterMorning]=nums[2].to_i
            thisenc[0][EncounterTypes::WaterDay]=nums[2].to_i
            thisenc[0][EncounterTypes::WaterNight]=nums[2].to_i
    Enabling it:


    Code:
      def isGrass?
        return false if @density==nil
        return (@enctypes[EncounterTypes::Land] ||
                @enctypes[EncounterTypes::LandMorning] ||
                @enctypes[EncounterTypes::LandDay] ||
                @enctypes[EncounterTypes::LandNight] ||
                @enctypes[EncounterTypes::BugContest]) ? true : false
      end
    
      def isWater?
        return false if @density==nil
        return (@enctypes[EncounterTypes::Water] ||
                @enctypes[EncounterTypes::WaterMorning] ||
                @enctypes[EncounterTypes::WaterDay] ||
                @enctypes[EncounterTypes::WaterNight]) ? true : false
      end
    Encounter Method
    Code:
    def pbEncounterType
        if $PokemonGlobal && $PokemonGlobal.surfing
          time=pbGetTimeNow
          enctype=EncounterTypes::Water
          enctype=EncounterTypes::WaterNight if self.hasEncounter?(EncounterTypes::WaterNight) && PBDayNight.isNight?(time)
          enctype=EncounterTypes::WaterDay if self.hasEncounter?(EncounterTypes::WaterDay) && PBDayNight.isDay?(time)
          enctype=EncounterTypes::WaterMorning if self.hasEncounter?(EncounterTypes::WaterMorning) && PBDayNight.isMorning?(time)
        elsif self.isCave?
          return EncounterTypes::Cave
        elsif self.isGrass?
          time=pbGetTimeNow
          enctype=EncounterTypes::Land
          enctype=EncounterTypes::LandNight if self.hasEncounter?(EncounterTypes::LandNight) && PBDayNight.isNight?(time)
          enctype=EncounterTypes::LandDay if self.hasEncounter?(EncounterTypes::LandDay) && PBDayNight.isDay?(time)
          enctype=EncounterTypes::LandMorning if self.hasEncounter?(EncounterTypes::LandMorning) && PBDayNight.isMorning?(time)
    Allowing the Editor to Use the method:

    Again so it cant be used on a cave map
    Code:
    elsif i==1
            dogen=true unless enc[1][EncounterTypes::Land] || 
                              enc[1][EncounterTypes::LandMorning] || 
                              enc[1][EncounterTypes::LandDay] || 
                              enc[1][EncounterTypes::LandNight] || 
                              enc[1][EncounterTypes::BugContest] || 
                              enc[1][EncounterTypes::WaterMorning] || 
                              enc[1][EncounterTypes::WaterDay] || 
                              enc[1][EncounterTypes::WaterNight]
    and for its density
    Code:
      enc[0][EncounterTypes::LandMorning]=enc[0][EncounterTypes::Land]
      enc[0][EncounterTypes::LandDay]=enc[0][EncounterTypes::Land]
      enc[0][EncounterTypes::LandNight]=enc[0][EncounterTypes::Land]
      enc[0][EncounterTypes::BugContest]=enc[0][EncounterTypes::Land]
      enc[0][EncounterTypes::WaterMorning]=enc[0][EncounterTypes::Water]
      enc[0][EncounterTypes::WaterDay]=enc[0][EncounterTypes::Water]
      enc[0][EncounterTypes::WaterNight]=enc[0][EncounterTypes::Water]
    With all of it like that I still get this
    external editor and new encounter types


    I've Probably done something wrong in all of this, but I'm terrible with scripting so I have no idea what it is so I could really use some help here.

    Edit: here is the tutorial I was following https://pokemonessentials.wikia.com/wiki/Adding_new_encounter_methods
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Code:
          lastmapid=mapid
          if thisenc && (thisenc[1][EncounterTypes::Land] ||
                         thisenc[1][EncounterTypes::LandMorning] ||
                         thisenc[1][EncounterTypes::LandDay] ||
                         thisenc[1][EncounterTypes::BugContest] ||
                         thisenc[1][EncounterTypes::LandNight] [S-HIGHLIGHT][COLOR=Green]||[/COLOR][/S-HIGHLIGHT]
                         thisenc[1][EncounterTypes::WaterMorning] ||
                         thisenc[1][EncounterTypes::WaterDay] ||
                         thisenc[1][EncounterTypes::WaterNight] [S-HIGHLIGHT][COLOR=Red]||[/COLOR][/S-HIGHLIGHT]) &&
                         thisenc[1][EncounterTypes::Cave]
            raise _INTL("Can't define both Land and Cave encounters in the same area (map ID {1})",mapid)
          end
          thisenc=[[25,10,10,0,0,0,0,0,0,25,25,25,25,10,10,10],[]]
          encounters[mapid.to_i]=thisenc
          needdensity=true
          i+=1
          next
        end
        enclines=[12,12,5,5,2,3,5,8,8,12,12,12,12,5,5,5]
    Code:
    def pbEncounterType
        if $PokemonGlobal && $PokemonGlobal.surfing
          time=pbGetTimeNow
          enctype=EncounterTypes::Water
          enctype=EncounterTypes::WaterNight if self.hasEncounter?(EncounterTypes::WaterNight) && PBDayNight.isNight?(time)
          enctype=EncounterTypes::WaterDay if self.hasEncounter?(EncounterTypes::WaterDay) && PBDayNight.isDay?(time)
          enctype=EncounterTypes::WaterMorning if self.hasEncounter?(EncounterTypes::WaterMorning) && PBDayNight.isMorning?(time)
          [S-HIGHLIGHT][COLOR=Green]return enctype[/COLOR][/S-HIGHLIGHT]
        elsif self.isCave?
          return EncounterTypes::Cave
        elsif self.isGrass?
          time=pbGetTimeNow
          enctype=EncounterTypes::Land
          enctype=EncounterTypes::LandNight if self.hasEncounter?(EncounterTypes::LandNight) && PBDayNight.isNight?(time)
          enctype=EncounterTypes::LandDay if self.hasEncounter?(EncounterTypes::LandDay) && PBDayNight.isDay?(time)
          enctype=EncounterTypes::LandMorning if self.hasEncounter?(EncounterTypes::LandMorning) && PBDayNight.isMorning?(time)
    I've tried out the exact same thing, and discovered two problems which I've highlighted above. The first has the || in the wrong place, which I'm surprised doesn't cause a bigger problem, and the second wouldn't actually allow any encounters on water because no encounter method is returned. Add in the green bits, and remove the red bit.

    I fixed those two things, and I got the new methods in the Editor. I didn't test what happened before I fixed those bugs, though, but that's not important.
     
    89
    Posts
    15
    Years
    • Seen Apr 5, 2016
    I've tried out the exact same thing, and discovered two problems which I've highlighted above. The first has the || in the wrong place, which I'm surprised doesn't cause a bigger problem, and the second wouldn't actually allow any encounters on water because no encounter method is returned. Add in the green bits, and remove the red bit.

    I fixed those two things, and I got the new methods in the Editor. I didn't test what happened before I fixed those bugs, though, but that's not important.

    Well thanks for bailing me out again Maruno, and sorry for having you be a glorified code checker on the first mistake, and as for the second one.... well I suck at scripting soooo I had no idea XD
     
    Back
    Top