Vendily

roam

Jul 4th, 2018
153
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Fill the array "points" with all squares of the region map in which the
  2. # species can be found
  3. points = []
  4. mapwidth = 1+PokemonRegionMap_Scene::RIGHT-PokemonRegionMap_Scene::LEFT
  5. encdata = load_data("Data/encounters.dat")
  6. for enc in encdata.keys
  7. enctypes = encdata[enc][1]
  8. j=-1
  9. for i in 0...RoamingSpecies.length
  10. s=getID(PBSpecies,RoamingSpecies[i][0])
  11. if s==@species
  12. j=i
  13. break
  14. end
  15. end
  16. if pbFindEncounter(enctypes,@species) || (j>-1 && enc==$PokemonGlobal.roamPosition[j])
  17. mappos = pbGetMetadata(enc,MetadataMapPosition)
  18. if mappos && mappos[0]==@region
  19. showpoint = true
  20. for loc in @mapdata[@region][2]
  21. showpoint = false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
  22. loc[7] && !$game_switches[loc[7]]
  23. end
  24. if showpoint
  25. mapsize = pbGetMetadata(enc,MetadataMapSize)
  26. if mapsize && mapsize[0] && mapsize[0]>0
  27. sqwidth = mapsize[0]
  28. sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
  29. for i in 0...sqwidth
  30. for j in 0...sqheight
  31. if mapsize[1][i+j*sqwidth,1].to_i>0
  32. points[mappos[1]+i+(mappos[2]+j)*mapwidth] = true
  33. end
  34. end
  35. end
  36. else
  37. points[mappos[1]+mappos[2]*mapwidth] = true
  38. end
  39. end
  40. end
  41. end
  42. end
RAW Paste Data