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?
ItemHandlers::UseOnPokemon.add(:SHINYJUICE,proc{|item,pokemon,scene|
pokemon.makeShiny
next
})
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
Place that anywhere in PItem_ItemEffectsCode:ItemHandlers::UseOnPokemon.add(:SHINYJUICE,proc{|item,pokemon,scene| pokemon.makeShiny next })
Thats works fine, but ''Shiny Juice'' item never disappears after use. Its like a infinite use item, some help?
Place that anywhere in PItem_ItemEffectsCode:ItemHandlers::UseOnPokemon.add(:SHINYJUICE,proc{|item,pokemon,scene| pokemon.makeShiny next })
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.
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
#===============================================================================
# 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
#===============================================================================