• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

An item that makes one of your Pokemon Shiny

  • 4
    Posts
    8
    Years
    • Seen Aug 31, 2015
    How would I go about adding an item that makes one of your Pokemon shiny when used. What would the Itemeffects script for this look like?
     
  • 824
    Posts
    9
    Years
    How would I go about adding an item that makes one of your Pokemon shiny when used. What would the Itemeffects script for this look like?

    Do you want the item to be used to permanently make your Pokemon Shiny?
    Code:
    ItemHandlers::UseOnPokemon.add(:SHINYJUICE,proc{|item,pokemon,scene|
       pokemon.makeShiny
       next
    })
    Place that anywhere in PItem_ItemEffects

    Do you want the Pokemon to temporarily make the Pokemon Shiny while they are holding it?
    Find "def isShiny?" in PokeBattle_Pokemon, which should look something like this. I say "something like this" because I changed how shininess works in my game and the lines where b-d are defined are most likely wrong since I'm going from memory how they worked:
    Code:
    def isShiny?
        [COLOR="Red"]return true if isConst?(self.item,PBItems,:SHINYJUICE)[/COLOR]
        return @shinyflag if @shinyflag!=nil
        a=@trainerID^@personalID
        b=a>>16
        c=(a%16)>>0xFF
        d=b^c
        return d<SHINYPOKEMONCHANCE
      end
    add in the red line of code.
     
  • 68
    Posts
    9
    Years
    • Seen Dec 3, 2016
    Hmm I added the code in PITem_ItemEffects but i get an argument error if I use the Item on a Pokémon
     
  • 11
    Posts
    9
    Years
    • Seen May 25, 2021
    Code:
    ItemHandlers::UseOnPokemon.add(:SHINYJUICE,proc{|item,pokemon,scene|
       pokemon.makeShiny
       next
    })
    Place that anywhere in PItem_ItemEffects


    Thats works fine, but ''Shiny Juice'' item never disappears after use. Its like a infinite use item, some help?
     
  • 824
    Posts
    9
    Years
    Code:
    ItemHandlers::UseOnPokemon.add(:SHINYJUICE,proc{|item,pokemon,scene|
       pokemon.makeShiny
       next
    })
    Place that anywhere in PItem_ItemEffects


    Thats works fine, but ''Shiny Juice'' item never disappears after use. Its like a infinite use item, some help?

    I think that has to do with the way you added Shiny Juice in the pbs file. One of the arguments is how the item is used outside of battle - on a Pokemon and disappearing afterwards like an evolution stone, on a Pokemon but staying like the Pokeflute, on the Trainer like a Repel, etc.
     
  • 11
    Posts
    9
    Years
    • Seen May 25, 2021
    I think that has to do with the way you added Shiny Juice in the pbs file. One of the arguments is how the item is used outside of battle - on a Pokemon and disappearing afterwards like an evolution stone, on a Pokemon but staying like the Pokeflute, on the Trainer like a Repel, etc.

    I used essentials Editor.exe to add Shiny Juice. I have no idea what are you talking about but I will check the pbs file...

    Edit: Solved, i forgot use the return value in the script
     
    Last edited:
  • 1,224
    Posts
    10
    Years
    For anyone wondering what the return values are, they are listed at the top of the PItem_ItemEffects section
    Code:
    #===============================================================================
    # UseFromBag handlers
    # Return values: 0 = not used
    #                1 = used, item not consumed
    #                2 = close the Bag to use, item not consumed
    #                3 = used, item consumed
    #                4 = close the Bag to use, item consumed
    #===============================================================================
     
    Back
    Top