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

[Error] Pokemon Essentials Version 17.2 Terrain Tags causing compiler problem

  • 6
    Posts
    5
    Years
    I have created a new Terrain Tag for Lava and I assigned it to a few tiles and now when I try to playtest this pops up:

    [Pokemon Essentials Version 17]
    Exception: NoMethodError
    Message: undefined method '-' for nil:NilClass
    Compiler:2966:in 'pbCompileEncounters'
    Compiler:2962:in 'each'
    Compiler:2962:in 'pbCompileEncounters'
    Compiler:4421:in 'pbCompileAllData'
    Compiler:4523
     
    This is what my current wild encounters part of the compiler looks like.

    #===============================================================================
    # Compile wild encounters
    #===============================================================================
    def pbCompileEncounters
    lines = []
    linenos = []
    FileLineData.file = "PBS/encounters.txt"
    File.open("PBS/encounters.txt","rb"){|f|
    lineno = 1
    f.each_line {|line|
    if lineno==1 && line[0]==0xEF && line[1]==0xBB && line[2]==0xBF
    line = line[3,line.length-3]
    end
    line = prepline(line)
    if line.length!=0
    lines[lines.length] = line
    linenos[linenos.length] = lineno
    end
    lineno += 1
    }
    }
    encounters = {}
    thisenc = nil
    lastenc = -1
    lastenclen = 0
    needdensity = false
    lastmapid = -1
    i = 0; while i<lines.length
    line = lines
    FileLineData.setLine(line,linenos)
    mapid = line[/^\d+$/]
    if mapid
    lastmapid = mapid
    if thisenc && (thisenc[1][EncounterTypes::Land] ||
    thisenc[1][EncounterTypes::LandMorning] ||
    thisenc[1][EncounterTypes::LandDay] ||
    thisenc[1][EncounterTypes::LandNight] ||
    thisenc[1][EncounterTypes::BugContest]) &&
    thisenc[1][EncounterTypes::Cave]
    raise _INTL("Can't define both Land and Cave encounters in the same area (map ID {1})",mapid)
    end
    thisenc = [EncounterTypes::EnctypeDensities.clone,[]]
    encounters[mapid.to_i] = thisenc
    needdensity = true
    i += 1
    next
    end
    enc = findIndex(EncounterTypes::Names){|val| val==line}
    if enc>=0
    needdensity = false
    enclines = EncounterTypes::EnctypeChances[enc].length
    encarray = []
    j = i+1; k = 0; while j<lines.length && k<enclines
    line = lines[j]
    FileLineData.setLine(lines[j],linenos[j])
    splitarr = strsplit(line,/\s*,\s*/)
    if !splitarr || splitarr.length<2
    raise _INTL("Expected a species entry line in encounters.txt,\r\ngot "{1}" instead (probably too few entries in an encounter type).\r\nPlease check the format of the section numbered {2},\r\nwhich is just before this line.\r\n{3}",line,lastmapid,FileLineData.linereport)
    end
    splitarr[2] = splitarr[1] if splitarr.length==2
    splitarr[1] = splitarr[1].to_i
    splitarr[2] = splitarr[2].to_i
    maxlevel = PBExperience::MAXLEVEL
    if splitarr[1]<=0 || splitarr[1]>maxlevel
    raise _INTL("Level number is not valid: {1}\r\n{2}",splitarr[1],FileLineData.linereport)
    end
    if splitarr[2]<=0 || splitarr[2]>maxlevel
    raise _INTL("Level number is not valid: {1}\r\n{2}",splitarr[2],FileLineData.linereport)
    end
    if splitarr[1]>splitarr[2]
    raise _INTL("Minimum level is greater than maximum level: {1}\r\n{2}",line,FileLineData.linereport)
    end
    splitarr[0] = parseSpecies(splitarr[0])
    linearr = splitarr
    encarray.push(linearr)
    thisenc[1][enc] = encarray
    j += 1; k += 1
    end
    if j==lines.length && k<enclines
    raise _INTL("Reached end of file unexpectedly. There were too few entries in the last section, expected {1} entries.\r\nPlease check the format of the section numbered {2}.\r\n{3}",enclines,lastmapid,FileLineData.linereport)
    end
    i = j
    elsif needdensity
    needdensity = false
    nums = strsplit(line,/,/)
    if nums && nums.length>=3
    for j in 0...EncounterTypes::EnctypeChances.length
    next if !EncounterTypes::EnctypeChances[j] ||
    EncounterTypes::EnctypeChances[j].length==0
    next if EncounterTypes::EnctypeCompileDens[j]==0
    thisenc[0][j] = nums[EncounterTypes::EnctypeCompileDens[j]-1].to_i
    end
    else
    raise _INTL("Wrong syntax for densities in encounters.txt; got "{1}"\r\n{2}",line,FileLineData.linereport)
    end
    i += 1
    else
    raise _INTL("Undefined encounter type {1}, expected one of the following:\r\n{2}\r\n{3}",line,EncounterTypes::Names.inspect,FileLineData.linereport)
    end
    end
    save_data(encounters,"Data/encounters.dat")
    end
     
    Back
    Top