Lufia Styled Battle Report V1.2

Lufia Styled Battle Report
Version: 1.2

Introduction

Another script from one of my upcoming CBS's. This edits the original Battle Report window to make it more like the result window in those Lufia series.

Features
  • Easily change the text used
  • Shows skills learned
  • Shows exp to next level
  • Shows stat gains when leveling up
  • Removes the 6 item limit on enemy item drops

Screenshots
http://img205.imageshack.us/img205/3456/screen1xu6.th.png[/IMG]
http://img50.imageshack.us/img50/2092/screen2kx8.th.png[/IMG]
http://img80.imageshack.us/img80/1619/screen3wb5.th.png[/IMG]

Demo
In the demo the battle is automatically set to end on turn 0, the battle isn't really that important for this script

Download

Instructions

If not using SDK remove the SDK log and check lines and the last end from each script in the demo

Add the scripts from the demo above main below all scripts. You may change the options/text in the script named Configuration it has been commented with further instructions.

FAQ

Compatibility

Incompatible with RTAB

SDK Compliant but not dependent

May be incompatible with your battle system
Very sharp, Trickster. I don't know if I'll use it in my current project or not, but if I decide to use a battle report script, I'll make yours my first port of call.
Really neat and clean, the script works nice. I like it ^^
I liked this part most:
Trickster wrote:
Features
  • Shows stat gains when leveling up
xD

And Lufia II is a great game btw...
ahh this is not just Lufia2 level up. They have this in every Lufia game
[QUOTE=Sol_Fury]Very sharp, Trickster. I don't know if I'll use it in my current project or not, but if I decide to use a battle report script, I'll make yours my first port of call.[/QUOTE]

Thanks

[QUOTE=Linkin_T]Really neat and clean, the script works nice. I like it ^^
I liked this part most:

Shows stat gains when leveling up
xD

And Lufia II is a great game btw...[/QUOTE]

thanks, well one thing I would fix in my script is the scrolling make the script continue scrolling if the next line is blank, heh something for me to do for later.

Just a few extra notes
You can move the text to right align by using in the string where you want right aligned text It will not work if you use it before an [icon] tag it will take a few modifications to get it to work that way, something for me to do later

  # Level up text [name] = Actor name [level] = Level
  LEVEL_UP_TEXT = "[name] Levels Up." #[level]
Expand to see the code.


I forgot to comment to tell what this is but LAST_WAIT is the wait before the battle ends or if the player pushes SPACE whatever comes first
if you use the [level] tag here it will be replaced by the actors current level

EDIT
@Mega_Flare They are based the same way, but each one has a few small cosmetic changes to them,
How can i download it when i press on the download it goes on some type of profile and when i press the icon that there is named lufia II ecc.. it goes to register any ideas?
So another part of the Lufia source code has been released by TricksterSpawn :P It looks nice on the screens, but unfortunately, it won't fit in my game's style, so it's another nice script from you I can't use... argh, damn you :P
What up with the name switch up? Trickers ^ Seph = Unknown
Very great script, but when I implement it in a different game, or attempt to modify the configuration, the text disappears. I still have to scroll through it, so I assume it's being drawn, but I just can't see it.
I tryed the demo, and everything is good, but the window's contents scroll really slowly.

I just beat Lufia II for my first time yesterday, by the way. Great game!
Ummm Daniel3579

  # Wait count for contents to move downward
  WAIT_COUNT = 40 #in frames
  #Instant, Faster, Fast, Slow, Slower, Slowest
  SCROLL_SPEED = "slowest"
Expand to see the code.


JarHead wrote:
How can i download it when i press on the download it goes on some type of profile and when i press the icon that there is named lufia II ecc.. it goes to register any ideas?


You have to be validated to download any files from there, check your email and your junk or spam boxes or ask that the email be resent and then check it

BlueScope wrote:
So another part of the Lufia source code has been released by TricksterSpawn It looks nice on the screens, but unfortunately, it won't fit in my game's style, so it's another nice script from you I can't use... argh, damn you


heh I'm still working on some parts of the game, I just got finished with this I have the BattleStatus Windows partially done, but I may redo them since I don't like the way they look

rpgmaker wrote:
What up with the name switch up? Trickers ^ Seph = Unknown

What switch up?
Actually, as it turns out, I was wrong--I don't have to press a button to scroll through the inivisible text. I can just sit there, and the window appears, and then passes. push_button is on, too, so that doesn't even make sense.

I tried adding those lines to the initialize method, but I still couldn't see anything. Maybe the text isn't getting drawn for some reason?
Hmm replace method initiailize with this one
  def initialize(exp, gold, treasures, level_flags)
    @exp = exp
    @gold = gold
    @treasures = treasures
    @level_flags = level_flags
    super(80, 0, 480, 256)
    self.back_opacity = 160
    self.visible = false
    @index = 0
    @wait_count = LufiaII_Result::WAIT_COUNT
    @data = []
    setup_text
    self.contents = Bitmap.new(width - 32, @data.size * 32)
    self.contents.font.name = "Arial" #or whatever
    self.contents.font.size = 32
  end
Expand to see the code.
Awesome, that worked--thanks a bunch!
Trickster
I AM SEPHIROTHSPAWN!!!!

SephirothSpawn
I AM TRICKSTER

that!
This script saved me (literally) My game was getting very buggy with a different script and this one actually worked, Yay.

P.S. I 'm curious over the whole I AM SEPHIROPTH/I AM TRIKSTER thing.
[QUOTE=YellowSubmarine]Awesome, that worked--thanks a bunch![/QUOTE]You sure you have a legal version of RMXP, buddy?

@Sasuke: We're all curious, but TricksterSpawn won't tell :P
This script has been revised, enjoy

Pretty soon I will finish up the Lufia CBS :)
Out of curiousity, what's been updated?

Since I use the old version of this script, should I update it to this new one?
If you would have asked sooner, I'd be able to answer your question. I forgot what was changed exactly or if I fixed any bugs.

But you should update, since if you find any errors I'll assume that you are using the latest version (since I do not keep records of previous versions of my scripts).
I'm having a problem with it I can't figure out...

Okay, so I was playing through my game just to make sure there were no bugs. All the battles before had gone fine, but once one of my characters was paralyzed at the end of a battle, I got the following script error:

Window_BattleResult line 88: NoMethod Error occurred.
undefined method '[]' for nil:NilClass
(the line in the script is: if @level_flags[actor_index][0] == false)

I changed "false" to "true", knowing I could just go back and change it if this screwed it up anymore. Then, I tried my game again and got the following error in the same situation:

Scene_Battle#Edits line 154: TypeError occurred
no implicit conversion from nil to integer
(the line in the script is: last = $data_actors[@actor_id].parameters[stat, last_level])

EDIT: Just to clarify, this error only occurs when a character is paralyzed or dead at the end of the battle.
Also, from an earlier post:
Quote:
You probably have the font error just add this to the initialize method
self.contents.font.name = "Arial" #whatever font you want
self.contents.font.size = 32

What is the initialize method? Sorry, I'm not a scripter, so I don't know. It's just looking funny to have the font in the battle result script different than the rest of my game, so it would be great to be able to add this.
How do you make it so you have to press the button to scroll down?

I don't want it to auto scroll.

Cool script, by the way.
@freakishfae - I don't see why being paralyzed or dead would cause such an error, what other scripts are you using

@Armor_King_108 - I'm pretty sure added an option for that look over the setup section again as I don't have this script on this computer atm
I'm using your animated gradient bars script, AMS, and the day and night and light effect scripts by Near Fantasia. Thing is, I removed all other custom scripts and it still had the error. But, when I put them in a new game it worked. The error also takes place with the sleep status. I'm confused. ><
I also had the same problem as FreakishFae, that the battle result hung and died when a character was dead at the end of a battle; so I went looking at the script...
Though the script hangs on the Window_Battleresult script; it seems to do so because it cannot find a value for @level_flags
So I went and found where this is defined... Its in the Scene_Battle under the comment #Obtaining EXP

# Obtaining EXP
    level_flags = []
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        #EDITS
        if last_level != actor.level
          level_flags[i] = [true, last_level]
        else
          level_flags[i] = [false]
        end
      end
    end
Expand to see the code.

Yup, this is the criminal. Its all well and good when the actor.cant_get_exp? == false, like it would be under most circumstances. But theres no contingency. What if its true? Then it can't return a value for level_flags, right?

I fixed it with this
    # Obtaining EXP
    level_flags = []
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        #EDITS
        if last_level != actor.level
          level_flags[i] = [true, last_level]
        else
          level_flags[i] = [false]
        end
        #EDITS
        [B]elsif actor.cant_get_exp? == true
        last_level = actor.level
        level_flags[i] = [false][/B]
      end
    end
Expand to see the code.

Now, I'm no coder, so that is probably crap coding; but it works now. I tested it with an item that KO's a character, then finished a battle against a wussy monster, and it now seems OK.

Hope that helps you too.
Updated the script Version 1.2

@eharper256 yes it works, but I didn't go in that direction

Also it would have been helpful to tell me the line (whats on the line in the script editor) and the error message since 99% of the time my version is different from yours
Someone fixed the audio bug, and now it works with all systems including RTAB, so update the script or add a new section for RTAB. Not sure if it works with all of them, but oh well this might help some for people that use RTAB.

RTAB Fix Spoiler
Scene_Battle#Edits RTAB
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Lufia Style Battle Report') == true
 
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Start Phase 5
  #--------------------------------------------------------------------------
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp, gold, treasures = 0, 0, []
    # Loop
    $game_troop.enemies.each do |enemy|
      # Skip id enemy is hidden
      next if enemy.hidden
      # Add EXP and amount of gold obtained
      exp += enemy.exp
      gold += enemy.gold
      # Skip if no treasure
      next if rand(100) > enemy.treasure_prob
      # Push Treasures if defined
      treasures << $data_items[enemy.item_id] if enemy.item_id > 0
      treasures << $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0
      treasures << $data_armors[enemy.armor_id] if enemy.armor_id > 0
    end
    # Obtaining EXP
    level_flags = Array.new($game_party.actors.size) {false}
    # Run Through Each Actor With Index
    $game_party.actors.each_with_index do |actor, index|
      # Skip if can't get exp
      next if actor.cant_get_exp?
      # Get Last Level
      last_level = actor.level
      # Add Exp
      actor.exp += exp
      # Skip if no level change
      next if last_level == actor.level
      # Set Level Flags
      level_flags[index] = last_level
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    treasures.each do |item|
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures, level_flags)
    # Set Wait
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Update Phase 5
  #--------------------------------------------------------------------------
  def update_phase5
    # If wait count is larger than 0
    if @phase5_wait_count > 0
      # Decrease wait count
      @phase5_wait_count -= 1
      # If wait count reaches 0
      if @phase5_wait_count == 0
        # Show result window
        @result_window.visible = true
        # Clear main phase flag
        $game_temp.battle_main_phase = false
        # Refresh status window
        @status_window.refresh
      end
      return
    end
    # If result window
    if not @result_window.disposed?
      # Update Result
      @result_window.update
      # Get final wait count
      @final_wait = LufiaII_Result::Last_Wait
      # Return
      return
    end
    # If Final Wait is greater than 0 and C is not triggered
    if @final_wait > 0 and not Input.trigger?(Input::C)
      # Reduce By 1
      @final_wait -= 1
      # Return
      return
    end
    # Set Result Window to nil
    @result_window = nil
    # Battle End
    Audio.me_stop
    battle_end(0)
  end
end

module RPG
class Class
  #--------------------------------------------------------------------------
  # * Learn Skills
  #--------------------------------------------------------------------------
  def learn_skills(level)
    # Setup Data Array
    data = []
    # Run Through Each Learning Skill
    @learnings.each do |learning|
      # Push if levels are the same
      data << learning.skill_id if learning.level == level
    end
    # Return Data
    return data
  end
end
end

class Game_Actor
  #--------------------------------------------------------------------------
  # * Get the current EXP
  #--------------------------------------------------------------------------
  def now_exp
    return @exp - @exp_list[@level]
  end
  #--------------------------------------------------------------------------
  # * Get the next level's EXP
  #--------------------------------------------------------------------------
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
  #--------------------------------------------------------------------------
  # * Learn Skills
  #--------------------------------------------------------------------------
  def stat_change(stat, last_level, new_level = nil)
    last = $data_actors[@actor_id].parameters[stat, last_level]
    new_level = self.level if new_level == nil
    now = $data_actors[@actor_id].parameters[stat, new_level]
    return now - last
  end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=6216