• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Reminder: AI-generated content is not allowed on the forums per the Rules and Regulations. Please contact us if you have any questions!

[v21.1] Calling for an event after catching a specific shiny.

Zyrne

Rookie
Member
Joined
Jan 13, 2026
Posts
1
First of all, Thank you for all these resources to make all these wonderful fangames. I'm working on my own with all pokemon and familiar setting with a twist. Hitting a snag with an attempt of recognizing when the player catches a shiny pokemon for the first time then throws a common event. This is after completing a "quest". Trying to make it so if the player wishes they can find the pokemon they helped in a bush at normal shiny odds. The issue is it doesn't trigger the common event.

Ruby:
Expand Collapse Copy
#===============================================================================
# One-time shiny event triggers for individual species
#===============================================================================
module ShinySpeciesEvents
  # Format:
  #   :SPECIES => common_event_id
  EVENTS = {
    :RATTATA   => 3
    # Add as many species as you want ( add a , )
  }

  # Variable storing species already triggered
  VARIABLE_ID = 100
end

#===============================================================================
# Helpers
#===============================================================================
def pbGetTriggeredShinySpecies
  arr = $game_variables[ShinySpeciesEvents::VARIABLE_ID]
  arr.is_a?(Array) ? arr : []
end

def pbAddTriggeredShinySpecies(species_id)
  list = pbGetTriggeredShinySpecies
  list.push(species_id) unless list.include?(species_id)
  $game_variables[ShinySpeciesEvents::VARIABLE_ID] = list
end

#===============================================================================
# Hook into capture
#===============================================================================
alias shiny_species_event_pbStorePokemon pbStorePokemon
def pbStorePokemon(pkmn)
  if pkmn.shiny?
    ShinySpeciesEvents::EVENTS.each do |species, event_id|
      next unless GameData::Species.get(species).id == pkmn.species

      triggered = pbGetTriggeredShinySpecies
      unless triggered.include?(species)
        pbAddTriggeredShinySpecies(species)
        pbCommonEvent(event_id)
      end
    end
  end

  shiny_species_event_pbStorePokemon(pkmn)
end

Game compiles fine and no errors are thrown. Not sure why it's not working.
 
Back
Top