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

[Scripting Question] HUD bar overlap

23
Posts
8
Years
    • Seen Apr 4, 2018
    I have used the simple hud (fixed) bar script from the Pokemon Essentials wikia page. When I go from one connected map to another, the map overlaps the HUD bar. The screenshot is given at the bottom. Here's the full script

    #===============================================================================
    # * Simple HUD - by FL, fixed by SunakazeKun (Credits will be apreciated)
    #===============================================================================
    #
    # This script is for Pokémon Essentials. It displays a simple HUD with the
    # party icons and some small text.
    #
    # To manually refresh the HUD use the line '$hud_need_refresh = true'
    #
    #===============================================================================
    # * Settings
    #===============================================================================
    BGPATH="Graphics/Pictures/HUDBar"
    # Put the image path between the two ". I recommend a 512x64 picture.

    USEBAR=false
    # Make as 'true' to show a coded blue bar. Make sure to remove "BGPATH".

    DRAWATBOTTOM=true
    # Make as 'true' to draw the HUD at bottom.

    UPDATESPERSECONDS=1.00
    # More updates = more lag.

    HUDTEXT=true
    # Make as 'false' to disable the HUD text.
    #===============================================================================
    # * Main
    #===============================================================================
    class Spriteset_Map

    alias :initializeOldFL :initialize
    alias :disposeOldFL :dispose
    alias :updateOldFL :update

    def initialize(map=nil)
    @hud = []
    initializeOldFL(map)
    $hud_need_refresh = true
    end

    def dispose
    disposeOldFL
    disposeHud
    end

    def update
    updateOldFL
    updateHud
    end

    #===============================================================================
    # * HUD Data
    #===============================================================================

    def createHud
    return if !$Trainer # Don't draw the hud if the player wasn't defined
    yposition = DRAWATBOTTOM ? Graphics.height-64 : 0
    @hud = []
    #===============================================================================
    # * Coded Blue Bar
    #===============================================================================
    if USEBAR
    bar=IconSprite.new(0,yposition,@viewport1)
    bar.bitmap=Bitmap.new(Graphics.width,64)
    bar.bitmap.fill_rect(Rect.new(0,0,bar.bitmap.width,bar.bitmap.height),
    Color.new(128,128,192))
    @hud.push(bar)
    end
    #===============================================================================
    # * Image
    #===============================================================================
    if BGPATH != "" # Make sure that there is nothing between the two ".
    bgbar=IconSprite.new(0,yposition,@viewport1)
    bgbar.setBitmap(BGPATH)
    @hud.push(bgbar)
    end
    #===============================================================================
    # * Text
    #===============================================================================
    if HUDTEXT
    baseColor=Color.new(72,72,72)
    shadowColor=Color.new(160,160,160)
    @hud.push(BitmapSprite.new(Graphics.width,Graphics.height,@viewport1))
    text1=_INTL("{1}",$Trainer.name)
    text2=_INTL("${1}",$Trainer.money)
    textPosition=[
    [text1,Graphics.width-64,yposition,2,baseColor,shadowColor],
    [text2,Graphics.width-64,yposition+32,2,baseColor,shadowColor]
    ]
    pbSetSystemFont(@hud[-1].bitmap)
    pbDrawTextPositions(@hud[-1].bitmap,textPosition)
    end
    #===============================================================================
    # * Pokémon Icons
    #===============================================================================
    for i in 0...$Trainer.party.size
    pokeicon=IconSprite.new(16+64*i,yposition-0,@viewport1)
    pokeicon.setBitmap(pbPokemonIconFile($Trainer.party))
    pokeicon.src_rect=Rect.new(0,0,64,64)
    @hud.push(pokeicon)
    end
    for sprite in @hud
    sprite.z+=600
    end
    end

    #===============================================================================

    def updateHud
    for sprite in @hud
    sprite.update
    end
    end

    def disposeHud
    for sprite in @hud
    sprite.dispose
    end
    @hud.clear
    end
    end

    #===============================================================================

    class Scene_Map
    alias :updateOldFL :update
    alias :miniupdateOldFL :miniupdate
    alias :createSpritesetsOldFL :createSpritesets

    UPDATERATE = (Spriteset_Map::UPDATESPERSECONDS>0) ?
    (Graphics.frame_rate/Spriteset_Map::UPDATESPERSECONDS).floor : 0x3FFF

    def update
    updateOldFL
    checkAndUpdateHud
    end

    def miniupdate
    miniupdateOldFL
    checkAndUpdateHud
    end

    def createSpritesets
    createSpritesetsOldFL
    checkAndUpdateHud
    end

    def checkAndUpdateHud
    $hud_need_refresh = (Graphics.frame_count%UPDATERATE==0 ||
    $hud_need_refresh)
    if $hud_need_refresh
    for s in @spritesets.values
    s.disposeHud
    s.createHud
    end
    $hud_need_refresh = false
    end
    end
    end
     

    Attachments

    • HUD bar overlap
      hud overlap.PNG
      26.1 KB · Views: 51

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen May 16, 2024
    As far as I know, the "fixed" script is broken and the original works. Try to use this, instead.
     

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen May 16, 2024
    It did? Well, then, what might be the problem? O.o
    I copy-pasted your script into a vanilla Essentials v16.2 and it's working too. This problem is something about your Essentials.
     
    Back
    Top