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

Battle Points and Buena's Password Points

220
Posts
9
Years
Battle Points and Buena's Password Points Scripts

This scripts will work the same as game corner coins system.

First of all, put them above MAIN script to avoid trouble.

Instructions for Battle Points:

1- Add this as a new script:

Code:
#===============================================================================
# * Battle Points by Richard PT
#===============================================================================
# * Global Metadata
#===============================================================================
class PokemonGlobalMetadata
  attr_accessor :bpoints
  def initialize
    @bpoints = 0
  end
end

2- In SETTINGS add the highlighted line:

Code:
INITIALMONEY = 3000
MAXMONEY     = 999999
MAXCOINS     = 99999
[COLOR=Red]MAXBPOINTS   = 99999[/COLOR]

3- In PItem_ItemEffects add the lines:

Code:
ItemHandlers::UseFromBag.add(POINTCARD,proc{|item|
  Kernel.pbMessage(_INTL("Battle Points:{1}",$PokemonGlobal.bpoints))
  next 1 # Continue
})

ItemHandlers::UseInField.add(POINTCARD,proc{|item|
  Kernel.pbMessage(_INTL("Battle Points:{1}",$PokemonGlobal.bpoints))
  next 1 # Continue
})

Note: You can put this below Coin Case item.

Also in PBS folder in Items notepad, add this:

Code:
459,POINTCARD,POINT CARD,8,0,"A card that lists the Battle Points you have earned.",2,0,6,

Note that 459 is my internal number, you must change it for yours in your project.

4- In DEBUG add the highlighted line:

Code:
commands.add("setmoney",_INTL("Set Money"))
  commands.add("setcoins",_INTL("Set Coins"))
  [COLOR=Red]commands.add("setbpoints",_INTL("Set BPoints"))[/COLOR]

Add this too:

Code:
elsif cmd=="setmoney"
      params=ChooseNumberParams.new
      params.setMaxDigits(6)
      params.setDefaultValue($Trainer.money)
      $Trainer.money=Kernel.pbMessageChooseNumber(
         _INTL("Set the player's money."),params)
      Kernel.pbMessage(_INTL("You now have ${1}.",$Trainer.money))
    elsif cmd=="setcoins"
      params=ChooseNumberParams.new
      params.setRange(0,MAXCOINS)
      params.setDefaultValue($PokemonGlobal.coins)
      $PokemonGlobal.coins=Kernel.pbMessageChooseNumber(
         _INTL("Set the player's Coin amount."),params)
      Kernel.pbMessage(_INTL("You now have {1} Coins.",$PokemonGlobal.coins))
    [COLOR=Red]elsif cmd=="setbpoints"
      params=ChooseNumberParams.new
      params.setRange(0,MAXBPOINTS)
      params.setDefaultValue($PokemonGlobal.bpoints)
      $PokemonGlobal.bpoints=Kernel.pbMessageChooseNumber(
         _INTL("Set the player's Battle Points amount."),params)
      Kernel.pbMessage(_INTL("You now have {1} Battle Points.",$PokemonGlobal.bpoints))[/COLOR]

5- In Messages add the highlighted lines:

Code:
def pbDisplayCoinsWindow(msgwindow,goldwindow)
  coinString=($PokemonGlobal) ? $PokemonGlobal.coins : "0"
  coinwindow=Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>",coinString))
  coinwindow.setSkin("Graphics/Windowskins/goldskin")
  coinwindow.resizeToFit(coinwindow.text,Graphics.width)
  coinwindow.width=160 if coinwindow.width<=160
  if msgwindow.y==0
    coinwindow.y=(goldwindow) ? goldwindow.y-coinwindow.height : Graphics.height-coinwindow.height
  else
    coinwindow.y=(goldwindow) ? goldwindow.height : 0
  end
  coinwindow.viewport=msgwindow.viewport
  coinwindow.z=msgwindow.z
  return coinwindow
end

[COLOR=Red]def pbDisplayBPWindow(msgwindow,goldwindow)
  bpString=($PokemonGlobal) ? $PokemonGlobal.bpoints : "0"
  bpwindow=Window_AdvancedTextPokemon.new(_INTL("Battle Points:\n<ar>{1}</ar>",bpString))
  bpwindow.setSkin("Graphics/Windowskins/goldskin")
  bpwindow.resizeToFit(bpwindow.text,Graphics.width)
  bpwindow.width=160 if bpwindow.width<=160
  if msgwindow.y==0
    bpwindow.y=(goldwindow) ? goldwindow.y-bpwindow.height : Graphics.height-bpwindow.height
  else
    bpwindow.y=(goldwindow) ? goldwindow.height : 0
  end
  bpwindow.viewport=msgwindow.viewport
  bpwindow.z=msgwindow.z
  return bpwindow
end[/COLOR]

Add this too:

Code:
def Kernel.pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
  return if !msgwindow
  oldletterbyletter=msgwindow.letterbyletter
  msgwindow.letterbyletter=(letterbyletter ? true : false)
  ret=nil
  count=0
  commands=nil
  facewindow=nil
  goldwindow=nil
  coinwindow=nil
  [COLOR=Red]bpointswindow=nil[/COLOR]
  cmdvariable=0

And this too:

Code:
elsif control=="cn" # Display coins window
          coinwindow.dispose if coinwindow
          coinwindow=pbDisplayCoinsWindow(msgwindow,goldwindow)
        [COLOR=Red]elsif control=="bp" # Display battle points window
          bpwindow.dispose if bpwindow
          bpwindow=pbDisplayBPWindow(msgwindow,goldwindow)[/COLOR]

And this:

Code:
while text[/(?:\\([WwFf]|[Ff][Ff]|[Tt][Ss]|[Cc][Ll]|[Mm][Ee]|[Ss][Ee]|[Ww][Tt]|[Ww][Tt][Nn][Pp]|[Cc][Hh])\[([^\]]*)\]|\\([Gg]|[Cc][Nn]|[Ww][Dd]|[Ww][Mm]|[Oo][Pp]|[Cc][Ll]|[COLOR=Red][Bb][Pp][/COLOR]|[Ww][Uu]|[\.]|[\|]|[\!]|[\x5E])())/i]

6- Done. And don't forget to add an image for Battle Points Card in Graphics/Icons folder.

In events:

"points" is the point number. Call one of these scripts:

Adding points clamping: '$PokemonGlobal.bpoints=[$PokemonGlobal.bpoints+points,MAXBPOINTS].min'.
Adding points without clamping: '$PokemonGlobal.bpoints+=points'.
Removing points clamping: '$PokemonGlobal.bpoints=[$PokemonGlobal.bpoints-points,0].max'.
Removing points without clamping: '$PokemonGlobal.bpoints-=points'.

________________________________________________________________________________________________

Instructions for Buena's Password Points:

1- Add this as a new script:

Code:
#===============================================================================
# * Buenas Password Points by Richard PT
#===============================================================================
# * Global Metadata
#===============================================================================
class PokemonGlobalMetadata
  attr_accessor :upoints
  def initialize
    @upoints = 0
  end
end

2- In SETTINGS add the highlighted line:

Code:
INITIALMONEY = 3000
MAXMONEY     = 999999
MAXCOINS     = 99999
[COLOR=Red]MAXUPOINTS   = 99999[/COLOR]

3- In PItem_ItemEffects add the lines:

Code:
ItemHandlers::UseFromBag.add(:BLUECARD,proc{|item|
  Kernel.pbMessage(_INTL("Buena's Password Points:{1}",$PokemonGlobal.upoints))
  next 1 # Continue
})

ItemHandlers::UseInField.add(:BLUECARD,proc{|item|
  Kernel.pbMessage(_INTL("Buena's Password Points:{1}",$PokemonGlobal.upoints))
  next 1 # Continue
})

Note: You can put this below Coin Case item.

Also in PBS folder in Items notepad, add this:

Code:
491,BLUECARD,BLUE CARD,8,0,"A card to save points for the BUENA's Password show.",2,0,6,

Note that 491 is my internal number, you must change it for yours in your project.

4- In DEBUG add the highlighted line:

Code:
commands.add("setmoney",_INTL("Set Money"))
  commands.add("setcoins",_INTL("Set Coins"))
  [COLOR=Red]commands.add("setupoints",_INTL("Set UPoints"))[/COLOR]

Add this too:

Code:
elsif cmd=="setmoney"
      params=ChooseNumberParams.new
      params.setMaxDigits(6)
      params.setDefaultValue($Trainer.money)
      $Trainer.money=Kernel.pbMessageChooseNumber(
         _INTL("Set the player's money."),params)
      Kernel.pbMessage(_INTL("You now have ${1}.",$Trainer.money))
    elsif cmd=="setcoins"
      params=ChooseNumberParams.new
      params.setRange(0,MAXCOINS)
      params.setDefaultValue($PokemonGlobal.coins)
      $PokemonGlobal.coins=Kernel.pbMessageChooseNumber(
         _INTL("Set the player's Coin amount."),params)
      Kernel.pbMessage(_INTL("You now have {1} Coins.",$PokemonGlobal.coins))
    [COLOR=Red]elsif cmd=="setupoints"
      params=ChooseNumberParams.new
      params.setRange(0,MAXUPOINTS)
      params.setDefaultValue($PokemonGlobal.upoints)
      $PokemonGlobal.upoints=Kernel.pbMessageChooseNumber(
         _INTL("Set the player's Buena's Points amount."),params)
      Kernel.pbMessage(_INTL("You now have {1} Buena's Points.",$PokemonGlobal.upoints))[/COLOR]


5- In Messages add the highlighted lines:

Code:
def pbDisplayCoinsWindow(msgwindow,goldwindow)
  coinString=($PokemonGlobal) ? $PokemonGlobal.coins : "0"
  coinwindow=Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>",coinString))
  coinwindow.setSkin("Graphics/Windowskins/goldskin")
  coinwindow.resizeToFit(coinwindow.text,Graphics.width)
  coinwindow.width=160 if coinwindow.width<=160
  if msgwindow.y==0
    coinwindow.y=(goldwindow) ? goldwindow.y-coinwindow.height : Graphics.height-coinwindow.height
  else
    coinwindow.y=(goldwindow) ? goldwindow.height : 0
  end
  coinwindow.viewport=msgwindow.viewport
  coinwindow.z=msgwindow.z
  return coinwindow
end

[COLOR=Red]def pbDisplayUPWindow(msgwindow,goldwindow)
  upString=($PokemonGlobal) ? $PokemonGlobal.upoints : "0"
  upwindow=Window_AdvancedTextPokemon.new(_INTL("Buena's Password Points:\n<ar>{1}</ar>",upString))
  upwindow.setSkin("Graphics/Windowskins/goldskin")
  upwindow.resizeToFit(upwindow.text,Graphics.width)
  upwindow.width=160 if upwindow.width<=160
  if msgwindow.y==0
    upwindow.y=(goldwindow) ? goldwindow.y-upwindow.height : Graphics.height-upwindow.height
  else
    upwindow.y=(goldwindow) ? goldwindow.height : 0
  end
  upwindow.viewport=msgwindow.viewport
  upwindow.z=msgwindow.z
  return upwindow
end[/COLOR]

Add this too:

Code:
def Kernel.pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
  return if !msgwindow
  oldletterbyletter=msgwindow.letterbyletter
  msgwindow.letterbyletter=(letterbyletter ? true : false)
  ret=nil
  count=0
  commands=nil
  facewindow=nil
  goldwindow=nil
  coinwindow=nil
  [COLOR=Red]upointswindow=nil[/COLOR]
  cmdvariable=0

And this too:

Code:
elsif control=="cn" # Display coins window
          coinwindow.dispose if coinwindow
          coinwindow=pbDisplayCoinsWindow(msgwindow,goldwindow)
        [COLOR=Red]elsif control=="up" # Display buenas points window
          upwindow.dispose if upwindow
          upwindow=upDisplayUPWindow(msgwindow,goldwindow)[/COLOR]

And this:

Code:
while  text[/(?:\\([WwFf]|[Ff][Ff]|[Tt][Ss]|[Cc][Ll]|[Mm][Ee]|[Ss][Ee]|[Ww][Tt]|[Ww][Tt][Nn][Pp]|[Cc][Hh])\[([^\]]*)\]|\\([Gg]|[Cc][Nn]|[Ww][Dd]|[Ww][Mm]|[Oo][Pp]|[Cc][Ll]|[COLOR=Red][Uu][Pp][/COLOR]|[Ww][Uu]|[\.]|[\|]|[\!]|[\x5E])())/i]

6- Done. And don't forget to add an image for Blue Points Card in Graphics/Icons folder.

In events:

"points" is the point number. Call one of these scripts:

Adding points clamping: '$PokemonGlobal.upoints=[$PokemonGlobal.upoints+points,MAXUPOINTS].min'.
Adding points without clamping: '$PokemonGlobal.upoints+=points'.
Removing points clamping: '$PokemonGlobal.upoints=[$PokemonGlobal.upoints-points,0].max'.
Removing points without clamping: '$PokemonGlobal.upoints-=points'.
 
Last edited:
Back
Top