• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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] A Unique Fossil NPC

  • 40
    Posts
    4
    Years
    • Seen Jan 13, 2022
    I already have the base Fossil NPC for every pre-Gen 8 Fossil, but I want to make an NPC that does what the Fossil person in Gen 8 does with the Fossilized Bird, Drake, etc.
    How would I go about this? If you decide to help, thanks, but if you dont thats fine.
    Version of Essentials is up to date, so the latest one.
     
    Make sure the new Fossil Pokemon are in your pokemon.txt in the PBS folder. You will also need to use 2 Control Variables. For this example I will be using variables 51 and 52, but you can use any free variables you have just make sure to adjust the script.

    Add the new fossils to your items.txt file in the PBS folder and change the letters in front to match the numbers of the next item on the list.
    Code:
    AAA,FOSSILIZEDBIRD,Fossilized Bird,Fossilized Birds,1,5000,"The fossil of an ancient Pokémon that once soared through the sky. What it looked like is a mystery.",0,0,8,
    BBB,FOSSILIZEDFISH,Fossilized Fish,Fossilized Fishes,1,5000,"The fossil of an ancient Pokémon that once lived in the sea. What it looked like is a mystery.",0,0,8,
    CCC,FOSSILIZEDDRAKE,Fossilized Drake,Fossilized Drakes,1,5000,"The fossil of an ancient Pokémon that once roamed the land. What it looked like is a mystery.",0,0,8,
    DDD,FOSSILIZEDDINO,Fossilized Dino,Fossilized Dinos,1,5000,"The fossil of an ancient Pokémon that once lived in the sea. What it looked like is a mystery.",0,0,8,

    We need to divide these new fossils into 2 groups, the head and the body. Change the number at the end to 13 for the head fossils and 14 for the body fossils.
    Code:
    AAA,FOSSILIZEDBIRD,Fossilized Bird,Fossilized Birds,1,5000,"The fossil of an ancient Pokémon that once soared through the sky. What it looked like is a mystery.",0,0,13,
    BBB,FOSSILIZEDFISH,Fossilized Fish,Fossilized Fishes,1,5000,"The fossil of an ancient Pokémon that once lived in the sea. What it looked like is a mystery.",0,0,13,
    CCC,FOSSILIZEDDRAKE,Fossilized Drake,Fossilized Drakes,1,5000,"The fossil of an ancient Pokémon that once roamed the land. What it looked like is a mystery.",0,0,14,
    DDD,FOSSILIZEDDINO,Fossilized Dino,Fossilized Dinos,1,5000,"The fossil of an ancient Pokémon that once lived in the sea. What it looked like is a mystery.",0,0,14,

    Time to add the scripts!

    In PItem_Items find:
    Code:
    def pbIsFossil?(item)
      ret = pbGetItemData(item,ITEM_TYPE)
      return ret && ret==8
    end

    and add this under it.
    Code:
    def pbIsFossilHead?(item) #Fossil Head
      ret = pbGetItemData(item,ITEM_TYPE)
      return ret && ret==13
    end
    
    def pbIsFossilBody?(item) #Fossil Body
      ret = pbGetItemData(item,ITEM_TYPE)
      return ret && ret==14
    end

    in the same section find:
    Code:
    def pbChooseFossil(var=0)
      ret = 0
      pbFadeOutIn {
        scene = PokemonBag_Scene.new
        screen = PokemonBagScreen.new(scene,$PokemonBag)
        ret = screen.pbChooseItemScreen(Proc.new { |item| pbIsFossil?(item) })
      }
      $game_variables[var] = ret if var>0
      return ret
    end

    and add this under it.
    Code:
    def pbChooseFossilHead(var=0)
      ret = 0
      pbFadeOutIn {
        scene = PokemonBag_Scene.new
        screen = PokemonBagScreen.new(scene,$PokemonBag)
        ret = screen.pbChooseItemScreen(Proc.new { |item| pbIsFossilHead?(item) })
      }
      $game_variables[var] = ret if var>0
      return ret
    end
    
    def pbChooseFossilBody(var=0)
      ret = 0
      pbFadeOutIn {
        scene = PokemonBag_Scene.new
        screen = PokemonBagScreen.new(scene,$PokemonBag)
        ret = screen.pbChooseItemScreen(Proc.new { |item| pbIsFossilBody?(item) })
      }
      $game_variables[var] = ret if var>0
      return ret
    end

    Anywhere above Main paste this. Make sure to replace AAA, BBB, CCC, DDD with the numbers you assigned to each fossil.
    Code:
    def pbMergeFossils
      if $game_variables[51] == AAA && $game_variables[52] == CCC
        pbMessage(_INTL("Here is your new Pokemon!"))
        pbAddPokemon(:DRACOZOLT,20)
        $PokemonBag.pbDeleteItem(AAA,1)
        $PokemonBag.pbDeleteItem(CCC,1)
      elsif $game_variables[51] == AAA && $game_variables[52] == DDD
        pbMessage(_INTL("Here is your new Pokemon!"))
        pbAddPokemon(:ARCTOZOLT,20)
        $PokemonBag.pbDeleteItem(AAA,1)
        $PokemonBag.pbDeleteItem(DDD,1)
      elsif $game_variables[51] == BBB && $game_variables[52] == CCC
       pbMessage(_INTL("Here is your new Pokemon!"))
         pbAddPokemon(:DRACOVISH,20)
        $PokemonBag.pbDeleteItem(BBB,1)
        $PokemonBag.pbDeleteItem(CCC,1)
      elsif $game_variables[51] == BBB && $game_variables[52] == DDD
        pbMessage(_INTL("Here is your new Pokemon!"))
        pbAddPokemon(:ARCTOVISH,20)
        $PokemonBag.pbDeleteItem(BBB,1)
        $PokemonBag.pbDeleteItem(DDD,1)
      else
        pbMessage(_INTL("I will return this fossil to you then."))
      end
      $game_variables[51] = 0
      $game_variables[52] = 0
    end

    Now set up an event like I have attached to this post and you will have the new 2 part fossil Pokemon in your game!
    [PokeCommunity.com] A Unique Fossil NPC
     
    Last edited:
    Back
    Top