• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Battle Foregrounds

Resource Battle Foregrounds N/A

TechSkylander1518 submitted a new resource:

Battle Foregrounds - Add a graphic layer above Pokemon in battle!

View attachment 3466View attachment 3467
To see this script in action, check out Pokémon Champions!
This script creates a "battle foreground"- an image that with a priority above the battlers, but still below the UI!


Code

Paste in a new section above main!
Ruby:
Expand Collapse Copy
class PokeBattle_Battle
  attr_accessor :foreground # Filename fragment used...

Read more about this resource...
 
TechSkylander1518 updated Battle Foregrounds with a new update entry:

v19 Update

This script is technically already perfectly compatible with v19, it's just the way that I made it plug-and-play isn't compatible with v19. So I've changed it to be step-by-step instructions for how to put it in rather than a plug-and-play script, because:
  • It feels cleaner to me to just put in a few lines rather than re-define several large sections for a minor change
  • Since the steps are the same, I only need one section for v18 and v19 (plus it'll make it easier to test...

Read the rest of this update entry...
 
TechSkylander1518 updated Battle Foregrounds with a new update entry:

v20 Update

Quick update to the instructions to explain how to add this in v20. Like the v19 update, nothing about the code has changed, just where you're putting it. Because of this, I've just written the instructions for v20 and noted where things are different for prior versions, but if it's too jumbled up with all the "for x version do y", I might begin splitting it up.

Read the rest of this update entry...
 

pokepoke1

Novice
Member
Joined
Nov 11, 2022
Posts
34
The pokemon's name its looking bad at my game x.x. Why?
 

Attachments

  • Screenshot_4.png
    Screenshot_4.png
    122 KB · Views: 98
The pokemon's name its looking bad at my game x.x. Why?
This doesn’t seem to have anything to do with this script? Your screenshot doesn’t even have a foreground.

If your names were fine before adding this script, please let me know what other plugins you have so I can check for any incompatibilities. But this looks to me like you’re missing a step to adding the dark battle UI, and that’s not what this thread is about.
 

pokepoke1

Novice
Member
Joined
Nov 11, 2022
Posts
34
This doesn’t seem to have anything to do with this script? Your screenshot doesn’t even have a foreground.

If your names were fine before adding this script, please let me know what other plugins you have so I can check for any incompatibilities. But this looks to me like you’re missing a step to adding the dark battle UI, and that’s not what this thread is about.
The foreground is working fine!, i just was triying things when i did the screenshot and about the names its allright now, i just changed :
NAME_BASE_COLOR to white, and it's fine :D
 

overlordnigel

Novice
Member
Joined
Jul 19, 2017
Posts
16
I put the code in the places it was to on the page and double checked then before the battel with the camper from the base essentials I added the script setBattleRule("foreground","spotlight") (spotlight is the name of the file it was sent with) and I get this message:

[Pokémon Essentials version 20.1]

[v20.1 Hotfixes 1.0.7]

Script error in event 7 (coords 13,19), map 2 (Lappet Town)

Exception: SyntaxError

Message: (eval):2: syntax error, unexpected ',', expecting ')'

("foreground","spotlight")

^

***Line '("foreground","spotlight")' shouldn't begin with '('. Try putting the '('

at the end of the previous line instead, or using 'extendtext.exe'.

***Full script:

setBattleRule

("foreground","spotlight")

sady that doesn’t mean much to me.
 
***Line '("foreground","spotlight")' shouldn't begin with '('. Try putting the '('

at the end of the previous line instead, or using 'extendtext.exe'.
It tells you what to do right here- put the ( at the end of the previous line, like this-
Ruby:
Expand Collapse Copy
setBattleRule(
“foreground","spotlight")

or use extendtext.exe to make the box bigger so you can fit it all on one line.
 

overlordnigel

Novice
Member
Joined
Jul 19, 2017
Posts
16
i have tryed that and i got this message

[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Script error in event 7 (coords 13,19), map 2 (Lappet Town)
Exception: SyntaxError
Message: (eval):4: syntax error, unexpected local variable or method, expecting ')'
“foreground","spotlight")
^~~~~~~~~
(eval):4: unterminated string meets end of file
“foreground","spotlight")
^


***Full script:
pbTrainerIntro(:CAMPER)
pbNoticePlayer(get_self)
setBattleRule(
“foreground","spotlight")

It tells you what to do right here- put the ( at the end of the previous line, like this-
Ruby:
Expand Collapse Copy
setBattleRule(
“foreground","spotlight")

or use extendtext.exe to make the box bigger so you can fit it all on one line.
 

nomists

Novice
Member
Joined
Sep 2, 2023
Posts
39
Quick bug fix recommendation for v. 20:


I have your foreground plugin installed and was trying to play with Safari battles today. However, it kept crashing because the Safari Battle would check for @battle.foreground in Scene_Initialize, not find foreground as it was uninitialized, and then crash. I've included a quick fix below


In SafariBattle, two lines have to be added. In the blocks of code below, this are marked by #kwat add
Ruby:
Expand Collapse Copy
class SafariBattle
  attr_reader   :battlers         # Array of fake battler objects
  attr_accessor :sideSizes        # Array of number of battlers per side
  attr_accessor :backdrop         # Filename fragment used for background graphics
  attr_accessor :backdropBase     # Filename fragment used for base graphics
  attr_accessor :time             # Time of day (0=day, 1=eve, 2=night)
  attr_accessor :environment      # Battle surroundings (for mechanics purposes)
  attr_reader   :weather
  attr_reader   :player
  attr_accessor :party2
  attr_accessor :canRun           # True if player can run from battle
  attr_accessor :canLose          # True if player won't black out if they lose
  attr_accessor :switchStyle      # Switch/Set "battle style" option
  attr_accessor :showAnims        # "Battle scene" option (show anims)
  attr_accessor :expGain          # Whether Pokémon can gain Exp/EVs
  attr_accessor :moneyGain        # Whether the player can gain/lose money
  attr_accessor :rules
  attr_accessor :ballCount
  attr_accessor :foreground #kwat add

And also
Code:
Expand Collapse Copy
  #=============================================================================
  # Initialize the battle class
  #=============================================================================
  def initialize(scene, player, party2)
    @scene         = scene
    @peer          = Battle::Peer.new
    @backdrop      = ""
    @backdropBase  = nil
    @time          = 0
    @environment   = :None   # e.g. Tall grass, cave, still water
    @weather       = :None
    @decision      = 0
    @caughtPokemon = []
    @player        = [player]
    @party2        = party2
    @sideSizes     = [1, 1]
    @battlers      = [Battle::FakeBattler.new(self, 0),
                      Battle::FakeBattler.new(self, 1)]
    @rules         = {}
    @ballCount     = 0
    @foreground        = "" #kwat add
  end


Anyway, I'm not playing around with the BugContestBattle/BattlePalaceBattle/BattleArenaBattle right now, but I'm curious if this error may also be in them (in which case, I assume the fix is just as simple)

Hope all is well!
 
Back
Top