Advertiser Content

How to add IV/EV screen in essentials 15.1? Page 2

Started by Applesauce262 September 26th, 2015 3:59 PM
  • 5767 views
  • 38 replies

Rot8er_ConeX

Male
The Dissa Region
Seen February 22nd, 2018
Posted May 8th, 2017
822 posts
4.5 Years
That did the trick! Thanks a lot! I'm still new to essentials so I don't really know the scripts yet.

EDIT: Something odd happens, on the moves page, I cannot select the moves, I have to go to the IV/EV/HP screen to select moves. Also the ribbon screen is not available. I assume this is because of the new page inserted. Is there any way to fix this?
Earlier in that same function, you should see code for if you press the C button. There's a line that reads "elsif @page==3", change that to 4. I forgot this myself initially. This is so that pressing the enter button on the Moves page, not the IVs/EVs/Hidden Power page, allows you to rearrange moves.
This should have fixed the first issue. As for the second issue,
  def pbScene
    pbPlayCry(@pokemon)
    loop do
      Graphics.update
      Input.update
      pbUpdate
      if Input.trigger?(Input::B)
        break
      end
      dorefresh=false
      if Input.trigger?(Input::C)
        if @page==0
          break
        elsif @page==4
          pbMoveSelection
          dorefresh=true
          drawPageFour(@pokemon)
        end
      end
      if Input.trigger?(Input::UP) && @partyindex>0
        pbGoToPrevious
        @pokemon=@party[@partyindex]
        @sprites["pokemon"].setPokemonBitmap(@pokemon)
        @sprites["pokemon"].color=Color.new(0,0,0,0)
        pbPositionPokemonSprite(@sprites["pokemon"],40,144)
        dorefresh=true
        pbPlayCry(@pokemon)
      end
      if Input.trigger?(Input::DOWN) && @partyindex<@party.length-1
        pbGoToNext
        @pokemon=@party[@partyindex]
        @sprites["pokemon"].setPokemonBitmap(@pokemon)
        @sprites["pokemon"].color=Color.new(0,0,0,0)
        pbPositionPokemonSprite(@sprites["pokemon"],40,144)
        dorefresh=true
        pbPlayCry(@pokemon)
      end
      if Input.trigger?(Input::LEFT) && !@pokemon.isEgg?
        oldpage=@page
        @page-=1
        @page=5 if @page<0
        dorefresh=true
        if @page!=oldpage # Move to next page
          pbPlayCursorSE()
          dorefresh=true
        end
      end
      if Input.trigger?(Input::RIGHT) && !@pokemon.isEgg?
        oldpage=@page
        @page+=1
        @page=0 if @page>5
        if @page!=oldpage # Move to next page
          pbPlayCursorSE()
          dorefresh=true
        end
      end
      if dorefresh
        case @page
          when 0
            drawPageOne(@pokemon)
          when 1
            drawPageTwo(@pokemon)
          when 2
            drawPageThree(@pokemon)
          when 3
            drawPageSix(@pokemon)
          when 4
            drawPageFour(@pokemon)
          when 5
            drawPageFive(@pokemon)
        end
      end
    end
    return @partyindex
  end
Replace your def pbScene with this. It should fix both issues.
Features of Pokemon Entropy

The black circular "doodles" in the lower right corner of my avatar are actually my username written in Gallifreyan. Yes I'm a Whovian.
Male
Seen December 16th, 2018
Posted December 16th, 2018
52 posts
6.4 Years
This should have fixed the first issue. As for the second issue,
  def pbScene
    pbPlayCry(@pokemon)
    loop do
      Graphics.update
      Input.update
      pbUpdate
      if Input.trigger?(Input::B)
        break
      end
      dorefresh=false
      if Input.trigger?(Input::C)
        if @page==0
          break
        elsif @page==4
          pbMoveSelection
          dorefresh=true
          drawPageFour(@pokemon)
        end
      end
      if Input.trigger?(Input::UP) && @partyindex>0
        pbGoToPrevious
        @pokemon=@party[@partyindex]
        @sprites["pokemon"].setPokemonBitmap(@pokemon)
        @sprites["pokemon"].color=Color.new(0,0,0,0)
        pbPositionPokemonSprite(@sprites["pokemon"],40,144)
        dorefresh=true
        pbPlayCry(@pokemon)
      end
      if Input.trigger?(Input::DOWN) && @partyindex<@party.length-1
        pbGoToNext
        @pokemon=@party[@partyindex]
        @sprites["pokemon"].setPokemonBitmap(@pokemon)
        @sprites["pokemon"].color=Color.new(0,0,0,0)
        pbPositionPokemonSprite(@sprites["pokemon"],40,144)
        dorefresh=true
        pbPlayCry(@pokemon)
      end
      if Input.trigger?(Input::LEFT) && !@pokemon.isEgg?
        oldpage=@page
        @page-=1
        @page=5 if @page<0
        dorefresh=true
        if @page!=oldpage # Move to next page
          pbPlayCursorSE()
          dorefresh=true
        end
      end
      if Input.trigger?(Input::RIGHT) && !@pokemon.isEgg?
        oldpage=@page
        @page+=1
        @page=0 if @page>5
        if @page!=oldpage # Move to next page
          pbPlayCursorSE()
          dorefresh=true
        end
      end
      if dorefresh
        case @page
          when 0
            drawPageOne(@pokemon)
          when 1
            drawPageTwo(@pokemon)
          when 2
            drawPageThree(@pokemon)
          when 3
            drawPageSix(@pokemon)
          when 4
            drawPageFour(@pokemon)
          when 5
            drawPageFive(@pokemon)
        end
      end
    end
    return @partyindex
  end
Replace your def pbScene with this. It should fix both issues.
Perfect, everything works now! Thanks again!
Male
Seen March 4th, 2016
Posted October 5th, 2015
36 posts
6.8 Years
I've tried a tutorial found on this site for adding EV/IV screen however whenever having compiled the script and trying to start up the game, I receive this error.

Script PScreen_Summary Line 625 Syntax Error occurred, which is the last few lines with the overlay.fill

Here is the script in question

def drawPageSix(pokemon)
    overlay=@sprites["overlay"].bitmap
    overlay.clear
    @sprites["background"].setBitmap("Graphics/Pictures/summary6")
    imagepos=[]
    if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
      status=6 if pbPokerus(pokemon)==1
      status=@pokemon.status-1 if @pokemon.status>0
      status=5 if pokemon.hp==0
      if status==1 && @pokemon.statusCount>0
        status=7
      end
      imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
    end
    if pokemon.isShiny?
      imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
    end
    if pbPokerus(pokemon)==2
      imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
    end
    ballused=@pokemon.ballused ? @pokemon.ballused : 0
    ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
    imagepos.push([ballimage,14,60,0,0,-1,-1])
    pbDrawImagePositions(overlay,imagepos)
    base=Color.new(248,248,248)
    shadow=Color.new(104,104,104)
    statshadows=[]
    for i in 0...5; statshadows[i]=shadow; end
    natup=(pokemon.nature/5).floor
    natdn=(pokemon.nature%5).floor
    statshadows[natup]=Color.new(128,32,64) if natup!=natdn
    statshadows[natdn]=Color.new(32,64,128) if natup!=natdn
    pbSetSystemFont(overlay)
    abilityname=PBAbilities.getName(pokemon.ability)
    abilitydesc=pbGetMessage(MessageTypes::AbilityDescs,pokemon.ability)
    itemname=pokemon.hasItem? ? PBItems.getName(pokemon.item) : _INTL("None")
    pokename=@pokemon.name
    brenda=overlay.font.size
    pbSetLargestFont(overlay,pokename,170-46-2)
    brenda -= overlay.font.size
    textpos=[[pokename,46,62+(brenda/2),0,base,shadow]]
    pbDrawTextPositions(overlay,textpos)
    pbSetSystemFont(overlay)
    textpos=[
       [_INTL("IVs, EVs, Hidden Power"),26,16,0,base,shadow],
       [pokemon.level.to_s,46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
       [_INTL("Item"),16,320,0,base,shadow],
       [itemname,16,352,0,Color.new(64,64,64),Color.new(176,176,176)],
       [_INTL("HP"),248,89,0,base,shadow],
       [sprintf("%d",pokemon.iv[0]),358,89,0,Color.new(96,0,96),Color.new(176,176,176)],
       [_INTL("{1}/252",pokemon.ev[0]),485,89,1,Color.new(0,96,96),Color.new(176,176,176)],
       [_INTL("Attack"),248,120,0,base,statshadows[0]],
       [sprintf("%d",pokemon.iv[1]),358,120,0,Color.new(96,0,96),Color.new(176,176,176)],
       [_INTL("{1}/252",pokemon.ev[1]),485,120,1,Color.new(0,96,96),Color.new(176,176,176)],
       [_INTL("Defense"),248,152,0,base,statshadows[1]],
       [sprintf("%d",pokemon.iv[2]),358,152,0,Color.new(96,0,96),Color.new(176,176,176)],
       [_INTL("{1}/252",pokemon.ev[2]),485,152,1,Color.new(0,96,96),Color.new(176,176,176)],
       [_INTL("Sp. Atk"),248,184,0,base,statshadows[3]],
       [sprintf("%d",pokemon.iv[4]),358,184,0,Color.new(96,0,96),Color.new(176,176,176)],
       [_INTL("{1}/252",pokemon.ev[4]),485,184,1,Color.new(0,96,96),Color.new(176,176,176)],
       [_INTL("Sp. Def"),248,216,0,base,statshadows[4]],
       [sprintf("%d",pokemon.iv[5]),358,216,0,Color.new(96,0,96),Color.new(176,176,176)],
       [_INTL("{1}/252",pokemon.ev[5]),485,216,1,Color.new(0,96,96),Color.new(176,176,176)],
       [_INTL("Speed"),248,248,0,base,statshadows[2]],
       [sprintf("%d",pokemon.iv[3]),358,248,0,Color.new(96,0,96),Color.new(176,176,176)],
       [_INTL("{1}/252",pokemon.ev[3]),485,248,1,Color.new(0,96,96),Color.new(176,176,176)],
       [_INTL("Hidden Power"),221,284,0,base,shadow],
    ]
    if pokemon.isMale?
      textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
    elsif pokemon.isFemale?
      textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
    end
    pbDrawTextPositions(overlay,textpos)
    hp=pbHiddenPower(pokemon.iv)
    type1rect=Rect.new(0,hp[0]*28,64,28)
    overlay.blt(410,283,@typebitmap.bitmap,type1rect)[/COLOR]
    drawMarkings(overlay,15,291,72,20,pokemon.markings)
    if pokemon.hp>0    hpcolors=[
         Color.new(24,192,32),Color.new(0,144,0),     # Green
         Color.new(248,184,0),Color.new(184,112,0),   # Orange
         Color.new(240,80,32),Color.new(168,48,56)    # Red
      ]
      hpzone=0
      totalEV=pokemon.ev[0]+pokemon.ev[1]+pokemon.ev[2]+pokemon.ev[3]+pokemon.ev[4]+pokemon.ev[5]
      overlay.fill_rect(360,110,pokemon.hp*96/pokemon.totalhp,2,hpcolors[hpzone*2+1])
      overlay.fill_rect(360,112,pokemon.hp*96/pokemon.totalhp,4,hpcolors[hpzone*2])
    end
  end

Rot8er_ConeX

Male
The Dissa Region
Seen February 22nd, 2018
Posted May 8th, 2017
822 posts
4.5 Years
overlay.fill_rect(360,110,pokemon.hp*96/pokemon.totalhp,2,Color.new(0,144,0))
overlay.fill_rect(360,112,pokemon.hp*96/pokemon.totalhp,4,Color.new(24,192,32))
Features of Pokemon Entropy

The black circular "doodles" in the lower right corner of my avatar are actually my username written in Gallifreyan. Yes I'm a Whovian.

Maruno

Lead Dev of Pokémon Essentials

England
Seen 10 Hours Ago
Posted 1 Day Ago
5,192 posts
11.8 Years
Make sure you're not blindly using code without knowing what it does or how it works. There appears to be a single line which says:

 if pokemon.hp>0    hpcolors=[
This should be two separate lines.

I also spotted this line, which has something at the end of it which it shouldn't:

overlay.blt(410,283,@typebitmap.bitmap,type1rect)[/COLOR]
Go to the Essentials Docs Wiki

Essentials Docs Wiki

Follow me on Twitter: @maruno42


Marin

Not Bored

Age 17
Male
Seen 1 Week Ago
Posted July 11th, 2019
827 posts
3 Years
You realise that makes little difference since versions are by and large backwards compatible?
That is not to say they are. And even if they are, he has an error that doesn't seem to have popped up before, making blaming the version difference very attractive. This thread is almost 2 years old first of all, and, generally, posting errors on versions something isn't meant for isn't the best move.
Advertiser Content