• 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.

Script: Simple HUD

FL

Pokémon Island Creator
2,450
Posts
13
Years
    • Seen today
    gif.gif
    screen.png

    Displays a HUD with the party icons (with tones for status), HP bars and some small text.

    Link

    Tested on Essentials v13, v20.1 and v21.1. If this script isn't working on latest Essentials version, please inform on this thread.
     
    Last edited:

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    What changed from the previous version?
    Or is it simply faster?
    This new one keeps a cache of pokémon specie numbers, HP values and strings, so it only updates when these values change, resulting in a huge performance gain. The previous one updates every N seconds, redrawing everything.

    I also put the HP bars as default option.
     
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    Haven't come in and said it's a job well done yet. Just want to say that it looks very helpful for other people (I won't be using it, sadly).
     
    • Like
    Reactions: FL

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Spoiler:

    This works great, thanks.
    Here's what I made of it, I plan to add badges when the player gets them on those circles ~
    Nice!

    I suggest you for put the badges images on "create" method, since badges almost don't change (only eight times in the entire game).
     
    465
    Posts
    7
    Years
    • Seen Apr 26, 2024
    hiya sorry for being new to... well essentials (in actually doing it) and scripting but i get an error after i up it in above main x.x

    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NoMethodError

    Message: undefined method `egg?' for #<PokeBattle_Pokemon:0x732e5b0>

    Simple_Hud:157:in `refreshPartyIcons'

    Simple_Hud:151:in `each'

    Simple_Hud:151:in `refreshPartyIcons'

    Simple_Hud:77:in `create'

    Simple_Hud:219:in `update'

    Simple_Hud:258:in `update'

    Spriteset_Map:181:in `_animationSprite_initialize'

    AnimationSprite:45:in `shadow_initialize'

    DynamicShadows:220:in `initializeOldFL'

    Simple_Hud:247:in `initialize'


    ---------------------------

    is this just me breaking things (earlier this day my data files corrupted and lost everything x.x) or something else?)
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    hiya sorry for being new to... well essentials (in actually doing it) and scripting but i get an error after i up it in above main x.x

    ---------------------------
    Pokemon Essentials
    ---------------------------
    Exception: NoMethodError

    Message: undefined method `egg?' for #<PokeBattle_Pokemon:0x732e5b0>

    Simple_Hud:157:in `refreshPartyIcons'

    Simple_Hud:151:in `each'

    Simple_Hud:151:in `refreshPartyIcons'

    Simple_Hud:77:in `create'

    Simple_Hud:219:in `update'

    Simple_Hud:258:in `update'

    Spriteset_Map:181:in `_animationSprite_initialize'

    AnimationSprite:45:in `shadow_initialize'

    DynamicShadows:220:in `initializeOldFL'

    Simple_Hud:247:in `initialize'


    ---------------------------

    is this just me breaking things (earlier this day my data files corrupted and lost everything x.x) or something else?)
    This was a small compatibility issue that Essentials V16.0 and V16.1 was with some scripts.

    To solve it, add above main script section the line 'class PokeBattle_Pokemon; def egg?; return isEgg?; end; end'.
     
    465
    Posts
    7
    Years
    • Seen Apr 26, 2024
    oh okay thanks for getting back to me about this, appreciate this very much ^^ i'll go test now
     
    35
    Posts
    7
    Years
    • Seen Nov 1, 2018
    It works perfectly! thanks!
    I have a question though, what values need to put to change transparency of the background, I don't want to make it false.
    And how to make it like, only the first party pokemon will display.
     
    Last edited:

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    It works perfectly! thanks!
    I have a question though, what values need to put to change transparency of the background, I don't want to make it false.
    And how to make it like, only the first party pokemon will display.
    I believe that a image with alpha value works.
    For only show the first party member, change the four lines 'for i in 0...6' to 'for i in 0...1'.
     
    35
    Posts
    7
    Years
    • Seen Nov 1, 2018
    I believe that a image with alpha value works.
    For only show the first party member, change the four lines 'for i in 0...6' to 'for i in 0...1'.

    Thank you! The only problem I have is it lags when the HUD is on.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    Thank you! The only problem I have is it lags when the HUD is on.
    I tested right now and I don't have the lag issue, did you change more things on script?

    On other hand, contrary as I said, alpha channel on HUD image doesn't works well, since this script creates a HUD for every map on connection, so the pictures overlaps. This is an error caused by the standard way of initialize pictures, since there is a picture for each map loaded on Essentials.
     
    1
    Posts
    7
    Years
    • Seen May 2, 2017
    looks great, i would like to use but i want to only enabled in the pause menu. how can i do that ?
     
    35
    Posts
    7
    Years
    • Seen Nov 1, 2018
    I tested right now and I don't have the lag issue, did you change more things on script?

    On other hand, contrary as I said, alpha channel on HUD image doesn't works well, since this script creates a HUD for every map on connection, so the pictures overlaps. This is an error caused by the standard way of initialize pictures, since there is a picture for each map loaded on Essentials.

    I didn't change much, only make 1 pokemon in the party to show and some draw text, I tried to remove everything in the HUD still it lags the same for me, it happens in the map with some few events, but with an empty map it is normal. Also you are correct using transparent background showed unwanted interface, if we can only find the script for map interface and restrict the HUD to refresh when near?
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen today
    I didn't change much, only make 1 pokemon in the party to show and some draw text, I tried to remove everything in the HUD still it lags the same for me, it happens in the map with some few events, but with an empty map it is normal.
    First, I fixed right now a performance issue (and an error in regard to text update), I changed 'drawText if @currentTexts != newTexts' to:

    Code:
    if @currentTexts != newTexts
      @currentTexts = newTexts
      drawText
    end

    If this won't solve, other thing that you can try is to raise the FRAMESPERUPDATE number (maybe something between 5-20 should be good).

    Also you are correct using transparent background showed unwanted interface, if we can only find the script for map interface and restrict the HUD to refresh when near?
    I aren't sure if I understand your question. The way that Spriteset_Map draw things isn't that simple. Essentials connections load maps when you are near, so the HUDs (since there is one per Spriteset_Map instance) are already drawed only when you're near.

    The solution is to change the way that the HUD (or pictures) are loaded, stopping using the Spriteset_Map, so always only one HUD (and background) is loaded. I guess that I can use z as 99999 instead of a viewport, but this also requires to bind the create/disponse methods in the correct entrypoints.
     
    35
    Posts
    7
    Years
    • Seen Nov 1, 2018
    Code:
    if @currentTexts != newTexts
      @currentTexts = newTexts
      drawText
    end

    Text are refreshing fine and lag was reduce nicely, still some few pauses but very rare.
    Only problem is when you toggle off and on again the icon of pokemon won't show the second time unless you switch places the pokemon or when something happen on the said pokemon, I think it is the way the refresh is handled.
     
    465
    Posts
    7
    Years
    • Seen Apr 26, 2024
    So not an issue of sorts? just a question if or how i can fix this in the most lag-less way possible!

    So i finally figured out Inputs and key presses as well as toggle-able inputs etc. now i have one for the HUD

    But after the toggle is turn back to when the HUD appears the party pokemon dont show till their position is changed in the party!

    just remembered this also happens with mega's! they still have the sprites but even if they are back to normal (and shows so in the party menu) it still has the mega sprite
     
    35
    Posts
    7
    Years
    • Seen Nov 1, 2018
    So not an issue of sorts? just a question if or how i can fix this in the most lag-less way possible!

    So i finally figured out Inputs and key presses as well as toggle-able inputs etc. now i have one for the HUD

    But after the toggle is turn back to when the HUD appears the party pokemon dont show till their position is changed in the party!

    just remembered this also happens with mega's! they still have the sprites but even if they are back to normal (and shows so in the party menu) it still has the mega sprite

    I'm not the OP but I can try to give some point.
    find def refreshPartyIcons
    and copy over this code.
    Code:
    def refreshPartyIcons
          for i in 0...1
            partyMemberExists = $Trainer.party.size > i 
            partySpecie = 0
            partyIsEgg = false
            if partyMemberExists
              partySpecie = $Trainer.party[i].species
              partyIsEgg = $Trainer.party[i].egg?
            end
            #refresh = @partySpecies[i]!=partySpecie || @partyIsEgg[i]!=partyIsEgg
            #if refresh
              @partySpecies[i] = partySpecie
              @partyIsEgg[i] = partyIsEgg
              if partyMemberExists
                pokemonIconFile = pbPokemonIconFile($Trainer.party[i])
                @sprites["pokeicon#{i}"].setBitmap(pokemonIconFile)
                @sprites["pokeicon#{i}"].src_rect=Rect.new(0,0,64,64)
              end
              @sprites["pokeicon#{i}"].visible = partyMemberExists
            #end
          end
        end

    It is the same code I just commented it out. Not tested. But expect some small lag.
     
    Back
    Top