• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

HGSS Shiny Leaf display in summary/storage

UPDATE!

This script is now compatible with Essentials v20.1 as part of my Enhanced UI plugin. Refer to that plugin for the features found in this thread.

This will add the Shiny Leaf from HGSS to your game. With this, you'll be able to set a number of shiny leaves onto a Pokemon which will be displayed in the Pokemon's summary pages, as well as on the PC screen. These scripts do NOT add the Shiny Leaf mechanic, it simply adds the ability to set them onto a Pokemon. How you trigger this is up to you.

Shiny Leaf

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage
[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage
 
Last edited:
Accidentally left an extra "end" in Step 2 of the Shiny Leaf scripts. It's been removed from the post, and should work fine now.
 
I love this script, but i found an error, when an event add a shiny leaf to me i get this error:

I followed your instalation instructions and i used the forum option "show printed version" here, so i can avoid problems, but i've got this error and i don't know to fix it.

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage
 
I love this script, but i found an error, when an event add a shiny leaf to me i get this error:

I followed your instalation instructions and i used the forum option "show printed version" here, so i can avoid problems, but i've got this error and i don't know to fix it.

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage

Well, the "pokemon" part of the code is replaced with whatever variable you need. For example, if you want the first non-egg member of your party to have 3 shiny leaves, you would write:

$Trainer.pokemonParty[0].setShinyLeaf(3)

Or, for example, if you wanted to open up the party screen and allow the player to choose a pokemon to give a shiny leaf to, you would write:

pbChoosePokemon(1,3)
pbGetPokemon(1).addShinyLeaf

Or you could do something like this:

pbChooseNonEggPokemon(1,3)
pokemon=pbGetPokemon(1)
pokemon.removeShinyLeaf

There are probably dozens of ways to set it up. It's up to you to decide how you want to trigger it in your own game. But "pokemon" alone wont do anything, unless you set it up as something first. I'm using it more as a placeholder for demonstration purposes. Sorry if that wasn't clear.
 
I'm using the shiny leafs in events where the first pokemon in the party receives a shiny leaf or lost 1 shiny leaf, also im using this as reward in type quiz minigame, if player wins a question the pokemon gains 1 leaf and if the player answer wrong it loses 1 leaf.

I typed in an event the piece of code: $Trainer.pokemonParty[0].setShinyLeaf(3) and it worked

but the following codes always give me errors and i don't know what causing it:

pokemon.addShinyLeaf
pokemon.removeShinyLeaf

or

pbChoosePokemon(1,3)
pbGetPokemon(1).addShinyLeaf

pbChooseNonEggPokemon(1,3)
pokemon=pbGetPokemon(1)
pokemon.removeShinyLeaf

I only want a piece of code to give 1 leaf to first pokemon in party, 1 to remove and 1 to check how many leafs that first party pokemon have.
 
Hmm try

$Trainer.pokemonParty[0].addShinyLeaf

To add 1 shiny leaf to your non-egg lead Pokemon. Not sure why the other methods arent working, though.
 
I used that new piece of code in an event and i got the same error that appears in the other codes:

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage

Hmm that's weird. I know it was working for me. I wont be home until tomorrow to actually test it, though.

But I'm curious...try this first and see what happens. Use the Debug tool on the pokemon first, and select "Remove All" to clear all Shiny Leaves on the Pokemon. THEN run the .addShinyLeaf event, and tell me what happens. I have a hunch I know what's wrong.
 
ok, i'll do that, im trying hard in various possible ways myself to, but i not have a clue what's causing that weird error.

I used the Debug tool and i removed all leafs first, after this i called the event script "pokemon.addShinyLeaf" or the other ways, and i get the error below:

But if i want to add or remove the leafs when using the debug tool it works fine but through events don't. Weird no? Your script use some variable or switch or something? I checked the codes and i not see a variable or switch on it.

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage
 
Last edited by a moderator:
I think the issue is that since youre adding a new flag to an existing game, its automatically being set as "nil" for all your Pokemon. So whenever you use the "addShinyLeaf" code to ADD an amount to "nil", its giving you an error. Unlike the "setShinyLeaf" script that simply changes nil to a different value. Thats why i think that changing it from nil to zero first (using a script, or the debug tool) will resolve the issue, and let you add values to the leaf flag properly.

This wont be a solution the general problem, but if the debug tool fixes the issue, itll tell me what i have to do to fix things. Weird that i didnt have this problem...maybe because i started a new game after installing the code?

I used the Debug tool and i removed all leafs first, after this i called the event script "pokemon.addShinyLeaf" or the other ways, and i get the error below:

But if i want to add or remove the leafs when using the debug tool it works fine but through events don't. Weird no? Your script use some variable or switch or something? I checked the codes and i not see a variable or switch on it.

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage

Youre using "pokemon" again in the code without defining it. Try it again with $Trainer.party[0].addShinyLeaf, after using the debug tool.
 
Last edited by a moderator:
After using debug tool to remove all leafs and called the event using your piece of code, it worked without errors or problems but when i load my saved game and call the same event this error appear:

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage
 
After using debug tool to remove all leafs and called the event using your piece of code, it worked without errors or problems but when i load my saved game and call the same event this error appear:

[PokeCommunity.com] HGSS Shiny Leaf display in summary/storage
Yeah, i thought so. The issue is that you have an existing game, and so the new flag that you installed with these scripts is being automatically set to "nil" instead of zero. This would probably be resolved by simply starting a new game.

I'm wondering if sticking this bit after the line "def addShinyLeaf" in Step 2 would also fix things (again, im not at home to test anything).

Code:
if self.leafflag==nil
  self.leafflag==0
end

If not, then for the time being, starting a new game is the simplest and easiest fix.
 
First i put that piece of code in that place and load the game to see if it crash when i called it in an event, the earlier error appear.
Second, i started a new game to see if i got the same problem, and the problem remains.
So, the script in my pc only works well when using debug tools.
By the way thx for your assist in this matter, i'm only have problems in this script of yours the other script that you created works all fine.

And another thing, im working in an script for an item called "Unown Report" where is listed all the unows but i don't know to slide down or up like pokemon in pokedex, if you understand me. The script is almost finished, it only needs that part. So, if you like to help me in this script i appreciated and i'll give you credits too, if you are not interested its ok.
 
First i put that piece of code in that place and load the game to see if it crash when i called it in an event, the earlier error appear.
Second, i started a new game to see if i got the same problem, and the problem remains.
So, the script in my pc only works well when using debug tools.
By the way thx for your assist in this matter, i'm only have problems in this script of yours the other script that you created works all fine.

And another thing, im working in an script for an item called "Unown Report" where is listed all the unows but i don't know to slide down or up like pokemon in pokedex, if you understand me. The script is almost finished, it only needs that part. So, if you like to help me in this script i appreciated and i'll give you credits too, if you are not interested its ok.

Hey, so I'm finally home and I just did some testing and found a real solution to your issue. I was able to replicate it in my game, and I added a few lines of code for a simple fix. This is all you have to do (the main post has been updated with these changes):

In Step 2, add the bolded lines to the base code you already installed:
Code:
#=======================================================================================
#  Defining Shiny Leaf
#=======================================================================================  
# Defines shiny leaf
  def shinyleaf
    return @leafflag if @leafflag!=nil
  end
  
# Sets a number of shiny leaves on a Pokemon. 6 leaves make a crown.
  def setShinyLeaf(value)
    @leafflag=value
  end
  
# Adds 1 shiny leaf to a Pokemon's total, up to 6.
  def addShinyLeaf
[B]    if self.leafflag==nil
      self.setShinyLeaf(0)
    end[/B]
    if self.leafflag<0
      self.leafflag+=-self.leafflag
    end
    if self.leafflag<6
      self.leafflag+=1
    end
  end
  
# Subtracts 1 shiny leaf from a Pokemon's total, down to 0.
  def removeShinyLeaf
[B]    if self.leafflag==nil
      self.setShinyLeaf(0)
    end[/B]
    if self.leafflag>6
      self.leafflag-=self.leafflag
      self.leafflag+=6
    end
    if self.leafflag>0
      self.leafflag-=1
    end
  end
    
# Checks to see if the Pokemon has a leaf crown.  
  def hasLeafCrown?
[B]    if self.leafflag==nil
      self.setShinyLeaf(0)
    end[/B]
    if self.leafflag==6 || self.leafflag>6
      return true
    end
  end

I tested this in a new game and it solved the issue.



As far as your request, I'm not sure how much help I can be. I don't really have much practice with implementing those sorts of things.
 
It's ok, i will test that codes and thx for all the support you gave me, you deserve credits for this. Keep the good work.

Hmm... This is really odd, the error still appears when calling event, i start a new game to see if it appears and i get that same error above, even in load games but using debug tools it don't crash or don't show any errors. I will not add this script because i tested it several times and still got issues, maybe my fault or not it doesn't matter, but i have lots of things to do and i'm short of time, so maybe i will try again in another day with more time to spent on this matter. Thx again for your support.
 
Last edited by a moderator:
Hmm... This is really odd, the error still appears when calling event, i start a new game to see if it appears and i get that same error above, even in load games but using debug tools it don't crash or don't show any errors. I will not add this script because i tested it several times and still got issues, maybe my fault or not it doesn't matter, but i have lots of things to do and i'm short of time, so maybe i will try again in another day with more time to spent on this matter. Thx again for your support.

Yeah, I don't know what to tell you. I installed the updated script into a fresh copy of Essentials, and it works perfectly for me. I was able to replicate your "Nil" error, but with the new code it no longer appears. It shouldn't even matter anymore if you start a new game or not - the code specifically changes any nil flags to zero when using the add/remove codes. So it shouldn't be possible for that error to even occur anymore.

If you're getting the "pokemon" error, then that's on your end due to not using a correct method in the event. Remember that the term "pokemon" that I used in the main post is merely for display purposes, you're not supposed to actually type in "pokemon.addShinyLeaf". You're supposed to replace the word "pokemon" with whatever method you need for your own purposes.
 
You forgot for v16.1 it uses pokemon.isEgg?
 
Back
Top