• 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,452
Posts
13
Years
    • Seen yesterday
    How do I play Hud to the edges? I tried to move by changing the x and y values, but when they reach the edge they seem to be under the edge and do not overlap ...
    To move the sprites/texts on any position on screen, you need to do 2 things:

    1. Change the rect of bar, so it cover more space. I will put at entire screen
    2. Stops blue mask for covering entire screen.

    For both things, change:

    Code:
            barBitmap = Bitmap.new(Graphics.width,BARHEIGHT)
            barRect = Rect.new(0,0,barBitmap.width,barBitmap.height)

    Into:

    Code:
            barBitmap = Bitmap.new(Graphics.width,Graphics.height)
            barRect = Rect.new(0,0,barBitmap.width,BARHEIGHT)

    This compatible with 18.x?
    I'm almost sure that people are using with v18.1 without issues.
     
    232
    Posts
    7
    Years
    • Seen Apr 24, 2024
    To move the sprites/texts on any position on screen, you need to do 2 things:

    1. Change the rect of bar, so it cover more space. I will put at entire screen
    2. Stops blue mask for covering entire screen.

    For both things, change:

    Code:
            barBitmap = Bitmap.new(Graphics.width,BARHEIGHT)
            barRect = Rect.new(0,0,barBitmap.width,barBitmap.height)

    Into:

    Code:
            barBitmap = Bitmap.new(Graphics.width,Graphics.height)
            barRect = Rect.new(0,0,barBitmap.width,BARHEIGHT)

    I'm almost sure that people are using with v18.1 without issues.

    Nice! Its Works!

    Would anyone know how to make a second experiment bar, which would be below the HP bar?
     

    FL

    Pokémon Island Creator
    2,452
    Posts
    13
    Years
    • Seen yesterday
    Nice! Its Works!

    Would anyone know how to make a second experiment bar, which would be below the HP bar?
    This isn't hard, you need to copy the HP Bar logic and transform into exp bar. A step-by-step:

    After line '@partyTotalHP = Array.new(6, 0)' add line '@partyExp = Array.new(6, 0)'. Before line 'for sprite in @sprites.values' add

    Code:
          if SHOWHPBARS
            borderWidth = 36
            borderHeight = 10
            fillWidth = 32
            fillHeight = 6
            for i in 0...6
              x=64*i+48
              y=@yposition+45
    
              @sprites["expbarborder#{i}"] = BitmapSprite.new(
                borderWidth,borderHeight,@viewport1
              )
              @sprites["expbarborder#{i}"].x = x-borderWidth/2
              @sprites["expbarborder#{i}"].y = y-borderHeight/2
              @sprites["expbarborder#{i}"].bitmap.fill_rect(
                Rect.new(0,0,borderWidth,borderHeight),
                Color.new(32,32,32)
              )
              @sprites["expbarborder#{i}"].bitmap.fill_rect(
                (borderWidth-fillWidth)/2,
                (borderHeight-fillHeight)/2,
                fillWidth,
                fillHeight,
                Color.new(96,96,96)
              )
              @sprites["expbarborder#{i}"].visible = false
    
              @sprites["expbarfill#{i}"] = BitmapSprite.new(
                fillWidth,fillHeight,@viewport1
              )
              @sprites["expbarfill#{i}"].x = x-fillWidth/2
              @sprites["expbarfill#{i}"].y = y-fillHeight/2
            end
            refreshExpBars
          end

    Before line 'def refreshHPBars' add

    Code:
        def refreshExpBars
          for i in 0...6
            startexp = 0
            endexp = 0
            hasExp = i<$Trainer.party.size && !$Trainer.party[i].egg?
            if hasExp
              exp = $Trainer.party[i].exp
              growthrate = $Trainer.party[i].growthrate
              startexp = PBExperience.pbGetStartExperience($Trainer.party[i].level,growthrate)
              endexp   = PBExperience.pbGetStartExperience($Trainer.party[i].level+1,growthrate)
            end
            
            lastTimeWasExp = @partyExp [i] != 0
            @sprites["expbarborder#{i}"].visible = hasExp if lastTimeWasExp != hasExp
    
            redrawFill = exp != @partyExp[i]
            if redrawFill
              @partyExp[i] = exp
              @sprites["expbarfill#{i}"].bitmap.clear
              
              width = @sprites["expbarfill#{i}"].bitmap.width
              height = @sprites["expbarfill#{i}"].bitmap.height
              fillAmount = (endexp==0) ? 0 : (exp - startexp)*width/(endexp - startexp)
              if fillAmount > 0
                hpColors=[Color.new(24,144,248),Color.new(72,120,160)]
                shadowHeight = 2
                rect = Rect.new(0,0,fillAmount,shadowHeight)
                @sprites["expbarfill#{i}"].bitmap.fill_rect(rect, hpColors[1])
                rect = Rect.new(0,shadowHeight,fillAmount,height-shadowHeight)
                @sprites["expbarfill#{i}"].bitmap.fill_rect(rect, hpColors[0])
              end
            end
          end
        end

    After line 'refreshHPBars if SHOWHPBARS' add line 'refreshExpBars if SHOWHPBARS'.
     
    26
    Posts
    5
    Years
    • Seen Nov 25, 2021
    Hey! Thanks for the script, there is some way to make an option just like Windowskins to change the HUD graphic?
     

    FL

    Pokémon Island Creator
    2,452
    Posts
    13
    Years
    • Seen yesterday
    Hey! Thanks for the script, there is some way to make an option just like Windowskins to change the HUD graphic?
    Yes!

    Copy an Option on Option menu and call something like "hudBar". Remove the line '@sprites["bgbar"].setBitmap(BGPATH)':

    After
    Code:
    @partyTotalHP = Array.new(6, 0)
    Add
    @lastHUDBar = -1

    After the two
    Code:
    refreshPartyIcons
    Add
    Code:
    refreshHUDBar

    Before
    Code:
    def refreshPartyIcons
    Add
    Code:
    def refreshHUDBar
    	drawBarFromPath = BGPATH != ""
          	return if !drawBarFromPath || $PokemonSystem.hudBar==@lastHUDBar
    	@lastHUDBar = $PokemonSystem.hudBar
    	@sprites["bgbar"].setBitmap(case $PokemonSystem.hudBar
       		when 0 then ""
       		when 1 then "Graphics/Pictures/hud1"
       		when 2 then "Graphics/Pictures/hud2"
    	end)
    end

    Untested.
     

    Luxintra

    Pokémon trainer
    64
    Posts
    6
    Years
    • UK
    • Seen May 6, 2024
    Hey, was there anyway of getting the HUD to update in other menus as it would only update when returning to the game?
     

    FL

    Pokémon Island Creator
    2,452
    Posts
    13
    Years
    • Seen yesterday
    Hey, was there anyway of getting the HUD to update in other menus as it would only update when returning to the game?
    After 'def initialize(viewport1)' add

    Code:
        @@instanceArray.compact! 
        @@instanceArray.push(self)

    And before 'def initialize(viewport1)' add:

    Code:
        @@instanceArray = []
        def self.updateAll
          for hud in @@instanceArray
            hud.update if hud && hud.hasSprites?
          end
        end
        def hasSprites?
          return [email protected]?
        end
    Call `Spriteset_Map::HUD.updateAll` on each menu script (on update method).
     

    obliu

    obliu
    3
    Posts
    6
    Years
  • Thank you for the script, i've been using it for a while now, i haven't had anybody any kind of problem but i have a question how do i hide it in the intro? I would like to know if it is possible to deactivate it and re-activate it with a event thank you so much
     

    FL

    Pokémon Island Creator
    2,452
    Posts
    13
    Years
    • Seen yesterday
    An update is coming!

    Thank you for the script, i've been using it for a while now
    Oh! I noticed a HUD in your video and I wondered if it is this HUD.

    how do i hide it in the intro? I would like to know if it is possible to deactivate it and re-activate it with a event thank you so much
    Put a switch number on SWITCHNUMBER and toggle it on/off.
     

    obliu

    obliu
    3
    Posts
    6
    Years
  • Hola FL, thanks for answering me I appreciate it❤️

    Put a switch number on SWITCHNUMBER and toggle it on/off.

    yes I had understood from the script that you had also written it above siwtchnumber, but I wanted to know how I can call it from an event I don't know what to write, I just wanted to deactivate it in the intro and make it appear at the beginning of the game, then I sent you a video if you can kindly watch it is still in WIP but i'm at the point of releasing it and i will update it slowly, i'm using a lot of your scripts so you are already in my credits for years, i'm developing it since 5 years alone.
    the only thing I don't want to update the version of pokemon essentilas to v20 on colosseum if not it won't work half of the scripts, then I also wanted to know about the character selection maybe is offtopic here but i need your help, I wanted to know how to put the sound while selecting, because this part is without sounds you can check the video for what i meaning ( i send you the yt video link privately checks the dm, I can not send it here tells me that I have to create at least 5 posts



    An update is coming!

    Happy to hear it, you are the best, this script deserves to be updated!

    Oh! I noticed a HUD in your video and I wondered if it is this HUD.

    I'm using a lot of your scripts so you are already in my credits for years now xD
     
    Last edited:

    FL

    Pokémon Island Creator
    2,452
    Posts
    13
    Years
    • Seen yesterday
    yes I had understood from the script that you had also written it above siwtchnumber, but I wanted to know how I can call it from an event I don't know what to write, I just wanted to deactivate it in the intro and make it appear at the beginning of the game
    Let's say that your SWITCHNUMBER is 99. At professor lecture start, add the event command to change switch 99 as off as the first command.

    When you finished your intro and want to the HUD appears, do the event command to change the switch 99 as on.

    then I sent you a video if you can kindly watch it is still in WIP but i'm at the point of releasing it and i will update it slowly, i'm using a lot of your scripts so you are already in my credits for years, i'm developing it since 5 years alone.
    So you are a veteran, nice!

    then I also wanted to know about the character selection maybe is offtopic here but i need your help, I wanted to know how to put the sound while selecting, because this part is without sounds you can check the video for what i meaning ( i send you the yt video link privately checks the dm, I can not send it here tells me that I have to create at least 5 post
    This happens because the sound name was changed on Essentials v17 and no one reported since. Anyway, there is a better way of doing this, I gonna update this script soon. In meantime, change all 'pbSEPlay("Choose",80)' to 'pbPlayCursorSE'.
     

    obliu

    obliu
    3
    Posts
    6
    Years
  • Everything works great thank you very much 🙏

    Let's say that your SWITCHNUMBER is 99. At professor lecture start, add the event command to change switch 99 as off as the first command.

    When you finished your intro and want to the HUD appears, do the event command to change the switch 99 as on.

    ahhh with the switches at the beginning I didn't understand the word switchnumber lol my bad, I thought I had to call some command with the script but now i understood and everything works perfectly, i put the switchnumber at 99 and i use it the control switches to turn it On /Off


    So you are a veteran, nice!

    More or less xD I have quit and resumed several times since I am alone and sometimes it becomes difficult to continue but slowly it is taking shape, also thanks to your awasome scripts!

    This happens because the sound name was changed on Essentials v17 and no one reported since. Anyway, there is a better way of doing this, I gonna update this script soon. In meantime, change all 'pbSEPlay("Choose",80)' to 'pbPlayCursorSE'.

    understood that's why the sound didn't work, now it's perfect!
     
    Back
    Top