• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Difficulties with modifying mining game

  • 72
    Posts
    6
    Years
    • Seen Jan 24, 2021
    Hello, all. I've been having difficulties with a mechanic I wish to add to mining. I wanted to be able to change the probability of discovering certain items depending on location. For example, one map would have a higher chance of the player finding fossils, while another map would have a higher chance of finding shards. I thought I could probably achieve this by checking for the game map

    Code:
    if $game_map.map_id==7
    ITEMS = [...]
    else
    ITEMS = [...]
    end

    But when I tried that, I got the error

    Code:
    Script 'PMinigame_Mining' line 142: NoMethodError occurred.
    undefined method 'map_id' for nil:NilClass

    I wasn't really sure what to do, so I added things the below code to class MiningGameScene

    Code:
    attr_accessor :map_id
    @map_id = 0

    But it wasn't any good. I'm not really sure what to do next. Does anyone know what I'm doing wrong? Thank you for any help in advance.
     
    Never mind everyone. I found a way to achieve what I wanted. Thank you for any consideration.
     
    Never mind everyone. I found a way to achieve what I wanted. Thank you for any consideration.

    Can you share with us what you did? :D
     
    I just create a copy of PMinigame_Mining, and changed the item list in the copy to only the fossils. Then I changed the name of pbMiningGame in the copy to pbMiningGameFossil. I changed every mention of MiningGameScene to MiningGameScene2 and every mention of MiningGame to MiningGame2. It is very inelegant but does work.
     
    Back
    Top