Status
Not open for further replies.

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,566
Reaction score
13,343
First Language
English
Primarily Uses
RMMZ
I've tried the usual Change Battleback command, and that didn't work.
Can this be done using event commands or will I need a snippet?

Thanks.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
38,395
Reaction score
10,835
First Language
German
Primarily Uses
RMMV
yes and no

the event command changes the setting for the map, that is why it doesn't work during battle.
However I once read a post here that there is a script command to force the battlescreen to update the battleback at any time from the then-current map setting.

So that way you'll need both - the event command to set the new battleback and the script command to force the update.

Unfortunately I don't remember the script command myself, but someone around here should be able to find the old post for it...
 
  • Like
Reactions: Kes

Faye Valentine

The Mapgician
Veteran
Joined
May 2, 2014
Messages
476
Reaction score
441
First Language
Spanish
Primarily Uses
RMMV
Searched. Found an Archeia post. I'll quote it:
Feb 12, 2014
There is a way. In troops tab:

Change Battleback to your desired graphic.

Script Call: SceneManager.scene.refresh_battleback

This will only work if you play in-game from Map -> Battle and not in test play.

Might as well try this?
 
  • Like
Reactions: Kes

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
7,316
Reaction score
10,998
First Language
Indonesian
Primarily Uses
N/A
Refresh battleback doesn't exist. Try this instead (which again, I'm too lazy to test)
Code:
spriteset = SceneManager.scene.instance_variable_get("@spriteset")
spriteset.dispose_battleback1
spriteset.dispose_battleback2
spriteset.create_battleback1
spriteset.create_battleback2
 

Faye Valentine

The Mapgician
Veteran
Joined
May 2, 2014
Messages
476
Reaction score
441
First Language
Spanish
Primarily Uses
RMMV
@TheoAllen: tested, it's not working. Tested under standard parameters (blank project)

Archeia script is working. Tested. Only in-game, though. Game crash on troops testing.
 
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
23,566
Reaction score
13,343
First Language
English
Primarily Uses
RMMZ
@TheoAllen and @Faye Valentine
I tried both ways.
With Archeia's method I got a crash with the error message
undefine method 'refresh battleback'

With TheoAllen's code in the script call, however, it worked like a charm.

Thank you both very much for your help with this.
I shall keep the thread open for a little while in case some oddity creeps out of the woodwork, but I'm hopeful that all will now be well.
 

Faye Valentine

The Mapgician
Veteran
Joined
May 2, 2014
Messages
476
Reaction score
441
First Language
Spanish
Primarily Uses
RMMV
@Kes: wow funny thing. I tested it in a blank project, but straight on the game and it showed no crash message whereas theo's crashed, both in-game and on troops tab. Well, glad you found a working solution, mate.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
7,316
Reaction score
10,998
First Language
Indonesian
Primarily Uses
N/A
@Faye Valentine I was going to reply u that I don't believe, but it's Kes that has the problem so I shrugged in the end.
What was the crash though? Those are really default script function, while "refresh_battleback" was never in default script.
It's funny it's working in your side actually.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,818
Reaction score
1,367
First Language
English
Primarily Uses
RMVXA
Using @TheoAllen 's code I got a script to work.
Ruby:
# Change Battle background with a spell
# Created by Roninator2
# Version 1.0
# free for commercial use

# How to use
# Name the graphic files whatever name you specify in the Filename below
# and numbered, with the second battleback with an a at the end.
# e.g.
# SpellBG1.png <- battleback 1
# SpellBG1a.png <- battleback 2
# SpellBG2.png <- battleback 1
# SpellBG2a.png <- battleback 2
# SpellBG3.png <- battleback 1
# SpellBG3a.png <- battleback 2

# files must be present even if they are empty
# then have the spell with the notetag <change_bbg: 1>

# it does not restore the original battleback if no battleback is
# setup before the battle starts. *You get the swirl image of the map.

module R2_change_bbg_by_skill
  Regex = /<change_bbg:[ ](\d+)>/i
  Filename = "SpellBG"
end

class Scene_Battle < Scene_Base
  alias r2_use_item_skill_bg    use_item
  def use_item
    r2_use_item_skill_bg
    item = @subject.current_action.item
    @setbg = false
    if item.is_a?(RPG::Skill) && item.note.split(/[\r\n]+/).each { |line|
      case line
      when R2_change_bbg_by_skill::Regex
        @bgnum = $1.to_i
        @setbg = true
      end
      }
    end
    if @original_bg1 == nil
      @original_bg1 = $game_map.battleback1_name
      @original_bg2 = $game_map.battleback2_name
    end
    if @setbg == true
      bbgimage = R2_change_bbg_by_skill::Filename.to_s
      spellbg1 = bbgimage.to_s + @bgnum.to_s
      spellbg2 = bbgimage.to_s + @bgnum.to_s + "a"
      Graphics.freeze
      $game_map.change_battleback(spellbg1, spellbg2)
      spriteset = SceneManager.scene.instance_variable_get("@spriteset")
      spriteset.dispose_battleback1
      spriteset.dispose_battleback2
      spriteset.create_battleback1
      spriteset.create_battleback2
      Graphics.transition(60)
    end
  end
  alias r2_terminate_bg   terminate
  def terminate
    r2_terminate_bg
    $game_map.change_battleback(@original_bg1, @original_bg2)
    @original_bg1 = nil
  end
end
 

Knight9910

Villager
Member
Joined
May 15, 2013
Messages
21
Reaction score
3
First Language
English
Primarily Uses
Neither of your codes works.

The Archeia code says "refresh_battleback" is undefined. For Theo's code, "instance_variable_get" is undefined.

Are you using plugins to do this?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
7,316
Reaction score
10,998
First Language
Indonesian
Primarily Uses
N/A
@Knight9910 without more information, I'm guessing you're using either MV or MZ. This was for none of them. It is for RPG Maker VXAce.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
45,986
Reaction score
16,775
First Language
English
Primarily Uses
RMMV

@Knight9910 , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.



Please start your own thread and give more details about your issue. Clearly you are not using the same engine, so this code will not work for you.
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

PC got fixed finally. Back online again. Turns out I have no business trying to self repair pcs because it was getting to like 176F / 80C. Shop installed a totally new cooling system and now it runs fine and is super quiet.
When you're making major progress, but have to stop to go to work.
Streaming making some Parallax maps if anyone wants to hang :)

Still alive, still kicking, still working on M
Just busy irl :)
Okay so... resetting BIOS to default settings causes a hard drive to take 9999 damage and become resistant to phoenix downs.... and pleads...

Forum statistics

Threads
131,480
Messages
1,220,171
Members
173,229
Latest member
ZecaVn
Top