• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Resource Vial of Glitter - An item that makes your pokemon shiny! 1.0.0

Asforcia

Novice
Member
Joined
Feb 22, 2022
Posts
12
Asforcia submitted a new resource:

Vial of Glitter - An item that makes your pokemon shiny! - Quick and short guide on how to add an item that makes your pokemon shiny!

So, first, define your item in Item.txt (PBS)
Here's an example of how it could look:
#-------------------------------
[VIALOFGLITTER]
Name = Vial of Glitter
NamePlural = Vials of Glitter
Pocket = 1
FieldUse = OnPokemon
Price = 15000
Flags = Fling_30
Description = If this item is used, the pokemon is turned shiny.

Then scroll till you find Item_Effects

and paste this at the bottom:


Ruby:
ItemHandlers::UseOnPokemon.add(:VIALOFGLITTER, proc { |item, qty, pkmn, scene|
  if pkmn.shiny...

Read more about this resource...
 

TeraPulse

Silver Pinap Collector
Member
Joined
Nov 13, 2022
Posts
26
Would there be a way to tell that the Pokemon has had a vial of glitter been used on? I don't really want people "flexing" their shinies only for it to turn out to be a VoG shiny.
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
Would there be a way to tell that the Pokemon has had a vial of glitter been used on? I don't really want people "flexing" their shinies only for it to turn out to be a VoG shiny.
Had a little free time, so I worked out something in Stock V20.
In UI_Party, add this below def draw_shiny_icon
Ruby:
  def draw_shiny_icon
    return if @pokemon.egg? || !@pokemon.shiny?
    pbDrawImagePositions(@overlaysprite.bitmap,
                         [["Graphics/Pictures/shiny", 80, 48, 0, 0, 16, 16]])
  end
#This is what it should look like. This will draw your icon in your party menu.
def draw_fake_shiny_icon
    return if @pokemon.egg? || !@pokemon.fake_shiny?
    pbDrawImagePositions(@overlaysprite.bitmap,
                         [["Graphics/Pictures/fakeshiny", 80, 48, 0, 0, 16, 16]])
  end
In UI_Summary add this below is @pokemon_shiny?
Ruby:
    # Show shininess star
    if @pokemon.shiny?
      imagepos.push([sprintf("Graphics/Pictures/shiny"), 2, 134])
    end
#Should look like this
           #added
    if @pokemon.fake_shiny?
      imagepos.push([sprintf("Graphics/Pictures/fakeshiny"), 2, 134])
    end
In Pokemon add below def shiny
if #shiny.nil
Ruby:
def fake_shiny=(value)
    @fake_shiny = value
    @shiny = true if @fake_shiny
  end
  def fake_shiny?
    if @fake_shiny.nil?
      a = @personalID ^ @owner.id
      b = a & 0xFFFF
      c = (a >> 16) & 0xFFFF
      d = b ^ c
    @fake_shiny = (d == 0)
  end
  return @fake_shiny
end
    def fake_shiny=(value)
    @fake_shiny = value
    @shiny = true if @fake_shiny
  end
Also in Pokemon, add this at the top, in the attr_writer lines. Probably below attr_writer :shiny so you can keep them together.
attr_writer :fake_shiny

In UI_PokemonStorage add this below if pokemon.shiny?

Ruby:
      if pokemon.fake_shiny?
        imagepos.push(["Graphics/Pictures/fakeshiny", 156, 198])
      end

Lastly, the bread and butter:
Ruby:
ItemHandlers::UseOnPokemon.add(:VIALOFGLITTER, proc { |item, qty, pkmn, scene|
  if pkmn.fake_shiny? == false
    pbSEPlay('Item Used', 100, 100)
    pbMessage(_INTL("The sparkled glitter changed the color of your pokemon!"))
    pkmn.fake_shiny = true
  elsif pkmn.fake_shiny? == true
    pbMessage(_INTL("The sparkled glitter won't have any effect."))
    next false
  end
})

I'm fairly new to Ruby, so I'm not sure if this is the best way, or if I missed anything, but I did this with a clean V20, and it works without error.
You can change "fake_shiny" to whatever, just make sure you change it all to the same. For the picture, make sure you have an icon (i just recolored the stock star) in your picture folder, and name it to match the UI scripts. Let me know if you need any help, and I'll do my best.
If anyone would like to correct / add to / critique, please feel free. I'm learning as I'm building my game.

**For reference: The red star is shiny, the blue star is super shiny, and the green star is fake shiny. I had already built a super shiny, but just wanted to showcase the possibilities.
 

Attachments

  • Shiny.png
    Shiny.png
    8.1 KB · Views: 75
Last edited:
Back
Top