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

[Scripting Question] How to code an item that, when used, consumes itself to trigger a Horde Battle with Pokemon determined by what route you're on?

  • 413
    Posts
    5
    Years
    I was playing a Pokemon ORAS mod that made the Honey Item trigger a horde battle with predetermined Pokemon when used in certain wild routes. The route determines what the Wild Pokemon are. This is great for early-game EV training, because the Pokemon on each route were specifically chosen to boost EVs by a lot.

    How do I rip this off- I mean, take creative inspiration from this? My goal is to have an item in the items pocket that triggers a horde battle when used from the bag, but does nothing in towns/buildings/any location that's not a Route or Forest.
     
    I don't know how to pull off horde battles, but regarding the trigger of the item this function should help.
    Code:
    pbMapHasEncounter?(mapID,enctype)
     
    This piece of code only checks if a specifc encounter type has been defined for this map.
    For example you could use it like this on map number 2:
    Code:
    pbMapHasEncounter?(2,Land)
    to ensure that this map has any Land encounters defined.
    Then you could use this:
    Code:
    pbGetEncounterTable(Land,2)
    to get all the encounters of the given map and type as an array (example:[PALKIA,10,DIALGA,10...ZARUDE,15]) which means you can use that array to always get the first defined encounter for the map (in this case Palkia) as the horde encounter.
    Code:
    pbGetEncounterTable(Land,2)[1]
    should get Palkia.
    Now you just need to setup your horde battle. I haven't tried it yet but if you use V18 5vs1 may be possible with some modifications.
     
    Back
    Top