• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Enemy Hp Gauge position and Name Position

  • 7
    Posts
    8
    Years
    • Seen Sep 10, 2016
    I've got two questions
    1st. How do i move only the Enemy's hp gauge without moving the players.
    2nd. How do i move the Name positions.
    If i didn't explain it very well then here's a picture
    [PokeCommunity.com] Enemy Hp Gauge position and Name Position

    Btw don't mind the sprites and other stuff it's just for testing (I know it's really messy)
    Sorry if i'm bad at english and Scripting xD
     
    Last edited by a moderator:
    So now that I've gotten to my copy of Essentials, I can assist. To change these things you need to navigate to:
    Scripts > PokeBattle_Scene > class PokemonDataBox > def refresh

    For 1.) You'll need to add a check that will handle how the HP bar gets drawn depending on the Pokemon's index. (0 and 2 are the player's, 1 and 3 are the enemy's) The final thing would look something like this:
    Code:
    # fill with HP color
        if (@battler.index&1)==0 # if player's Pokémon
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x1[/COLOR][/B],[B][COLOR="Red"]y1[/COLOR][/B],hpgauge,2,hpcolors[hpzone*2])
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x1[/COLOR][/B],[B][COLOR="Red"]y1[/COLOR][/B]+2,hpgauge,4,hpcolors[hpzone*2+1])
        else # if enemy's Pokémon
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x2[/COLOR][/B],[B][COLOR="Red"]y2[/COLOR][/B],hpgauge,2,hpcolors[hpzone*2])
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x2[/COLOR][/B],[B][COLOR="Red"]y2[/COLOR][/B]+2,hpgauge,4,hpcolors[hpzone*2+1])
        end
    (The values in red are the coordinates you want to change)

    For 2.) This part handles the name positioning:
    Code:
        textpos=[
           [pokename,[B][COLOR="Blue"]@spritebaseX+8[/COLOR][/B],[B][COLOR="Red"]6[/COLOR][/B],false,base,shadow]
        ]
    (The value in blue is the X coordinate, the value in red is the Y coordinate)
     
    So now that I've gotten to my copy of Essentials, I can assist. To change these things you need to navigate to:
    Scripts > PokeBattle_Scene > class PokemonDataBox > def refresh

    For 1.) You'll need to add a check that will handle how the HP bar gets drawn depending on the Pokemon's index. (0 and 2 are the player's, 1 and 3 are the enemy's) The final thing would look something like this:
    Code:
    # fill with HP color
        if (@battler.index&1)==0 # if player's Pokémon
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x1[/COLOR][/B],[B][COLOR="Red"]y1[/COLOR][/B],hpgauge,2,hpcolors[hpzone*2])
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x1[/COLOR][/B],[B][COLOR="Red"]y1[/COLOR][/B]+2,hpgauge,4,hpcolors[hpzone*2+1])
        else # if enemy's Pokémon
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x2[/COLOR][/B],[B][COLOR="Red"]y2[/COLOR][/B],hpgauge,2,hpcolors[hpzone*2])
          self.bitmap.fill_rect(@spritebaseX+[B][COLOR="Red"]x2[/COLOR][/B],[B][COLOR="Red"]y2[/COLOR][/B]+2,hpgauge,4,hpcolors[hpzone*2+1])
        end
    (The values in red are the coordinates you want to change)

    For 2.) This part handles the name positioning:
    Code:
        textpos=[
           [pokename,[B][COLOR="Blue"]@spritebaseX+8[/COLOR][/B],[B][COLOR="Red"]6[/COLOR][/B],false,base,shadow]
        ]
    (The value in blue is the X coordinate, the value in red is the Y coordinate)

    I might just be really stupid but now i get this error
    [PokeCommunity.com] Enemy Hp Gauge position and Name Position


    Edit: i tried removing the end which was in that line. It fixed that error and i was able to acctually play in the game but now i get this battle error when i try to enter a battle
    [PokeCommunity.com] Enemy Hp Gauge position and Name Position
     
    Last edited:
    *sigh* I hope you realize that you have to change the variables I bolded in red to actual numerical values.
     
    Ohh sorry i'm the biggest noob at scripting. It worked but the databoxes disappeared.
    [PokeCommunity.com] Enemy Hp Gauge position and Name Position


    *sigh* I hope you realize that you have to change the variables I bolded in red to actual numerical values.

    Ohh sorry i'm the biggest noob at scripting. But now the databoxes disappeared.
    [PokeCommunity.com] Enemy Hp Gauge position and Name Position
     
    Last edited by a moderator:
    Back
    Top