- 25
- Posts
- 17
- Years
- Minnesota, USA
- Seen Jul 19, 2022
Yeah, swarming shouldn't be too difficult to implement (although as with Burmy's alternate forms, it will vary from game to game which species swarm and where they do so).
Define a variable (e.g. 42 - "Swarmers"), where a value of 0 for that variable means "nothing swarming", a "1" means Rattata are swarming on Route 17, a "2" means Nidoran male are swarming on Route 3, etc. Plan all that out first.
Then go into PokemonEncounters and edit the def pbEncounteredPokemon to add a line like:
Put that near the top, just after the "return nil if etc." line, and put similar lines like it there as well for each of the other swarming species/locations. (You can expand on this to give the swarmer a range of levels to choose from.)Code:return [PBSpecies::RATTATA,15] if rnd[9]<3 && $game_variables[42]==1 && $game_map.map_id==17 && enctype==0
The example line there gives a 30% chance of encountering a Level 15 Rattata, and a 70% chance of "choose a random Pokémon native to the current map as usual" otherwise. It will only do this if game variable 42 equals 1, the player is currently on map number 17 and it's looking for a tall grass encounter.
All that's left after that is to change game variable 42 to a different number depending on whatever (whether it's random each day, triggered by an event, etc.). I'll leave that to you to figure out.
After that, you can use the game variable value to decide what's swarming, and to generate a relevant TV broadcast.
Is it possible to do this as an array such as:
swarms=[[17,PBSpecies::RATTATA,10,15],[18,PBSpecies::NIDORANmA,10,15],...]
(ie [map id, species, min level, max level])
And then pick a random map that will reset each day (unsure how to do this):
swarmData=swarms[rand(swarms.size)]
And then do something along the lines of:
if rnd[9]<3 && $game_variables[42]==1 && $game_map.map_id==swarmData[0] && enctype==0
return [PBSpecies::swarmData[1],rand(swarmData[3]-swarmData[2])+swarmData[2]]
else
I have no idea how to piece it all together though...any assistance? Also sorry if my syntax is bad, it was meant to be more of pseudocode as my ruby is sketchy at best and I've been busy with beginning java lately so I had a hard time not thinking in java.
Last edited: