Firstly I handled all bugs relating to the script not working as intended
- Pokémon will now spawn accordingly
Also I changed the script to now use
RainefallUtils to handle event spawning and despawning, so you no longer need to premake your events on your maps.
I also added some new stuff to the config:
MAX_DISTANCE
: Will handle how far a Pokémon can be from the player before it despawns, this only affects non-shiny Pokémon. It also determines how far away it will start spawning events from the player, this is 75% of this value. Default is 12 tiles.
MAX_PER_MAP
: Will determine how many Pokémon will appear on each map. All you have to do is plug in your map_id with a value of how many Pokémon will appear. If your map is not defined it will default to whatever is set for map_id 0 (which is 5 Pokémon).
DELETE_EVENTS
: Will determine if events should be deleted after the encounter disappears. This should be set to true to prevent your game from lagging after a while. However this was added in case there are issues with deleting the events.
Ive also optimized the way it checks whether a Pokémon can spawn and how it checks for a possible tile. This also includes a check if a trainer can see the Pokémon. It will even despawn the Pokémon if it happens to wander into the vision of a trainer. This will prevent players from sneaking by a trainer due to a Pokémon blocking its vision.