TP and buff display errors in battle

Melkino

Villager
Member
Joined
Mar 17, 2012
Messages
9
Reaction score
1
First Language
English
Primarily Uses
I noticed some odd things going on while setting up Luna's battle config for my game:

 

1) Under TP Bar Settings, when :type is set to 2, the frame background animates just fine, but it disappears whenever the actor's TP is full. (There's supposed to be a gear like in the second screenshot)



 

2) While using DoubleX's compatibility scripts for Yanfly's Buff and State Manager and having :type in Luna's state settings set to 1, stray zeroes appear on actors who have no states on them:



 

Also, the turn counter for buffs and debuffs begins at 0 (even if the buff lasts like 5 turns or something) and the number doesn't change at all until it wears off normally. This happened with both state display types.

 

I tried testing with a freshly unzipped copy of the Luna Engine Base demo to make sure none of the other scripts in my game was causing the errors. The only changes I made to the base demo was pasting Yanfly's and DoubleX's scripts below Luna's. The bugs happened in there too, and I also found that buffing/debuffing a character twice (but not in the same turn) makes the number appear multiple times. 



 

At this point I dunno if I'm doing something wrong or completely overlooked something.  :unsure:  Does all this happen with the most recent version of Luna Engine? I bought it from the forum store, but that's still at v1.02a.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
I highly suspect that you didn't follow the below script ordering:

- Yanfly Engine Ace - Buff & State Manager

- DoubleX RMVXA Bug Fixes for Yanfly Engine Ace - Buff & State Manager

- YEA - Buff and State Manager Compatibility

But anyway, your demo speaks louder than words :)
 
Last edited by a moderator:

Melkino

Villager
Member
Joined
Mar 17, 2012
Messages
9
Reaction score
1
First Language
English
Primarily Uses
I highly suspect that you didn't follow the below script ordering:

- Yanfly Engine Ace - Buff & State Manager

- DoubleX RMVXA Bug Fixes for Yanfly Engine Ace - Buff & State Manager

- YEA - Buff and State Manager Compatibility

But anyway, your demo speaks louder than words :)
I already had the scripts in that order, but the bugs still happen. This is pretty weird!

I'll pm you guys what I did with the Luna Base demo if that's okay. I was able to replicate the issues in there without other third-party scripts messing with it. My main project's filesize is pretty big right now and would probably take a while to upload and download. >_>
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Your 1st problem is likely a bug of the Battle Luna(at least in your version), and the below snippet should fix that:

#------------------------------------------------------------------------------|#  * Edit class: SpriteHUD_Bar                                                 |#------------------------------------------------------------------------------|class SpriteHUD_Bar < Sprite   #----------------------------------------------------------------------------|  #  Rewrite method: refresh_type2                                     |  #----------------------------------------------------------------------------| def refresh_type2 self.bitmap = Cache.system(setting_type[:filename]) if self.bitmap.nil? frames = setting_type[:frames] rate = 1.0 / frames width = self.bitmap.width / frames height = self.bitmap.height # Rewritten to ensure x never points beyond the last frame of the bitmap x = [(@rate / rate).floor, frames - 1].min * width # self.src_rect.set(x, 0, self.width, self.height) endend # SpriteHUD_Bar
Reason behind the bug:

When tp = 100, @rate becomes 1, causing (@rate / rate).floor * width to set x as (1 / (1.0 / frames)).floor * (self.bitmap.width / frames), which is equal to self.bitmap.width.

So self.src_rect.set(self.bitmap.width, 0, self.bitmap.width / frames, self.bitmap.height) is called, which tries to display the portion of the bitmap with its position being out of the bitmap, causing nothing to be taken. Hence the tp bar disappears.
I wonder if Yami will take a look on that :)

Your 2nd problem is indeed a bug of YEA - Buff and State Manager Compatibility, so use this one instead:

#==============================================================================# ■ YEA - Buff and State Manager Compatibility by DoubleX#==============================================================================#==============================================================================# If you want to use Buff & State Manager with Luna engine, this script is# a must-have. This script requires DoubleX RMVXA Bug Fixes for YEA - Buff & # State Manager. Please credit DoubleX!#==============================================================================#==============================================================================# Editing anything past the engine's configuration script may potentially # result in causing computer damage, incontinence, explosion of user's head, # coma, death, and/or halitosis so edit at your own risk. # We're not liable for the risks you take should you pass this sacred grounds.#==============================================================================($imported ||= {})["YEL-BattleLuna YEA-Buff&StateManager Compatible"] = trueif $imported["YEA-Buff&StateManager"] && $imported["DoubleX RMVXA Bug Fixes for YEA-Buff&StateManager"]#------------------------------------------------------------------------------|#------------------------------------------------------------------------------|# * Edit class: Game_Battler |#------------------------------------------------------------------------------|class Game_Battler < Game_BattlerBase #----------------------------------------------------------------------------| # New public instance variables | #----------------------------------------------------------------------------| attr_accessor :turn_end attr_reader :buffs #----------------------------------------------------------------------------| # Alias method: on_turn_end | #----------------------------------------------------------------------------| alias game_battler_on_turn_end_bsm on_turn_end def on_turn_end game_battler_on_turn_end_bsm # Added to mark the use of this method @turn_end = true # end # on_turn_endend # Game_Battler#------------------------------------------------------------------------------|# * Edit class: SpriteHUD_States |#------------------------------------------------------------------------------|class SpriteHUD_States < Sprite #----------------------------------------------------------------------------| # Alias method: refresh_type0 | #----------------------------------------------------------------------------| alias spriteset_states_refresh_type0_bsm refresh_type0 def refresh_type0 spriteset_states_refresh_type0_bsm # Added to draw buff and state turns bitmap.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE bitmap.font.out_color.set(0, 0, 0, 255) (@battler.states.collect { |state| state.id } + @battler.buffs.select { |buff| buff != 0 }).each_with_index { |id, i| bitmap.draw_text(i * (24 + setting_type[:spacing]), YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, i < @battler.states.size ? @battler.state_turns(id) : @battler.buff_turns(id), 2) } # end # refresh_type0 #----------------------------------------------------------------------------| # Alias method: refresh_type1 | #----------------------------------------------------------------------------| alias spriteset_states_refresh_type1_bsm refresh_type1 def refresh_type1 spriteset_states_refresh_type1_bsm # Added to draw buff and state turns buffs_states = @battler.states.collect { |state| state.id } + @battler.buffs.select { |buff| buff != 0 } buff_state = buffs_states[@index] return unless buff_state bitmap.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE bitmap.font.out_color.set(0, 0, 0, 255) bitmap.draw_text(0, YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, @index < @battler.states.size ? @battler.state_turns(buff_state) : @battler.buff_turns(buff_state), 2) # end # refresh_type1 #----------------------------------------------------------------------------| # Alias method: states_change? | #----------------------------------------------------------------------------| alias spriteset_states_states_change_bsm? states_change? def states_change? # Rewritten to mark state change upon turn end return spriteset_states_states_change_bsm? unless @battler.turn_end @battler.turn_end = false true # end # states_change?end # SpriteHUD_States#------------------------------------------------------------------------------|end # $imported["YEA-Buff&StateManager"] && $imported["DoubleX RMVXA Bug Fixes for YEA-Buff&StateManager"]
Archeia may want to update this as well :D
 
Last edited by a moderator:

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
Thank you DoubleX! I'll make sure to inform Yami and apply the fixes :3
 

Melkino

Villager
Member
Joined
Mar 17, 2012
Messages
9
Reaction score
1
First Language
English
Primarily Uses
Your 1st problem is likely a bug of the Battle Luna(at least in your version), and the below snippet should fix that:

#------------------------------------------------------------------------------|#  * Edit class: SpriteHUD_Bar                                                 |#------------------------------------------------------------------------------|class SpriteHUD_Bar < Sprite   #----------------------------------------------------------------------------|  #  Rewrite method: refresh_type2                                     |  #----------------------------------------------------------------------------| def refresh_type2 self.bitmap = Cache.system(setting_type[:filename]) if self.bitmap.nil? frames = setting_type[:frames] rate = 1.0 / frames width = self.bitmap.width / frames height = self.bitmap.height # Rewritten to ensure x never points beyond the last frame of the bitmap x = [(@rate / rate).floor, frames - 1].min * width # self.src_rect.set(x, 0, self.width, self.height) endend # SpriteHUD_Bar
Reason behind the bug:

When tp = 100, @rate becomes 1, causing (@rate / rate).floor * width to set x as (1 / (1.0 / frames)).floor * (self.bitmap.width / frames), which is equal to self.bitmap.width.

So self.src_rect.set(self.bitmap.width, 0, self.bitmap.width / frames, self.bitmap.height) is called, which tries to display the portion of the bitmap with its position being out of the bitmap, causing nothing to be taken. Hence the tp bar disappears.
I wonder if Yami will take a look on that :)

Your 2nd problem is indeed a bug of YEA - Buff and State Manager Compatibility, so use this one instead:

#==============================================================================# ■ YEA - Buff and State Manager Compatibility by DoubleX#==============================================================================#==============================================================================# If you want to use Buff & State Manager with Luna engine, this script is# a must-have. This script requires DoubleX RMVXA Bug Fixes for YEA - Buff & # State Manager. Please credit DoubleX!#==============================================================================#==============================================================================# Editing anything past the engine's configuration script may potentially # result in causing computer damage, incontinence, explosion of user's head, # coma, death, and/or halitosis so edit at your own risk. # We're not liable for the risks you take should you pass this sacred grounds.#==============================================================================($imported ||= {})["YEL-BattleLuna YEA-Buff&StateManager Compatible"] = trueif $imported["YEA-Buff&StateManager"] && $imported["DoubleX RMVXA Bug Fixes for YEA-Buff&StateManager"]#------------------------------------------------------------------------------|#------------------------------------------------------------------------------|# * Edit class: Game_Battler |#------------------------------------------------------------------------------|class Game_Battler < Game_BattlerBase #----------------------------------------------------------------------------| # New public instance variables | #----------------------------------------------------------------------------| attr_accessor :turn_end attr_reader :buffs #----------------------------------------------------------------------------| # Alias method: on_turn_end | #----------------------------------------------------------------------------| alias game_battler_on_turn_end_bsm on_turn_end def on_turn_end game_battler_on_turn_end_bsm # Added to mark the use of this method @turn_end = true # end # on_turn_endend # Game_Battler#------------------------------------------------------------------------------|# * Edit class: SpriteHUD_States |#------------------------------------------------------------------------------|class SpriteHUD_States < Sprite #----------------------------------------------------------------------------| # Alias method: refresh_type0 | #----------------------------------------------------------------------------| alias spriteset_states_refresh_type0_bsm refresh_type0 def refresh_type0 spriteset_states_refresh_type0_bsm # Added to draw buff and state turns bitmap.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE bitmap.font.out_color.set(0, 0, 0, 255) (@battler.states.collect { |state| state.id } + @battler.buffs.select { |buff| buff != 0 }).each_with_index { |id, i| bitmap.draw_text(i * (24 + setting_type[:spacing]), YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, i < @battler.states.size ? @battler.state_turns(id) : @battler.buff_turns(id), 2) } # end # refresh_type0 #----------------------------------------------------------------------------| # Alias method: refresh_type1 | #----------------------------------------------------------------------------| alias spriteset_states_refresh_type1_bsm refresh_type1 def refresh_type1 spriteset_states_refresh_type1_bsm # Added to draw buff and state turns buffs_states = @battler.states.collect { |state| state.id } + @battler.buffs.select { |buff| buff != 0 } buff_state = buffs_states[@index] return unless buff_state bitmap.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE bitmap.font.out_color.set(0, 0, 0, 255) bitmap.draw_text(0, YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, @index < @battler.states.size ? @battler.state_turns(buff_state) : @battler.buff_turns(buff_state), 2) # end # refresh_type1 #----------------------------------------------------------------------------| # Alias method: states_change? | #----------------------------------------------------------------------------| alias spriteset_states_states_change_bsm? states_change? def states_change? # Rewritten to mark state change upon turn end return spriteset_states_states_change_bsm? unless @battler.turn_end @battler.turn_end = false true # end # states_change?end # SpriteHUD_States#------------------------------------------------------------------------------|end # $imported["YEA-Buff&StateManager"] && $imported["DoubleX RMVXA Bug Fixes for YEA-Buff&StateManager"]
Archeia may want to update this as well :D

Thank you; I tried them out (didn't have time to post until I got home) but neither script seems to be working for me. I placed the TP snippet below Battle Luna, saved the project file, then playtested. The TP frame works at 100, but now it shows multiple frames at once when the value is less than that, and shows more the lower it goes. The whole bitmap is shown at once when the TP is zero. 

example:



As for the Buff and State Manager script, I commented out the old one, added the new one in its own script entry and saved, but the turns are still displaying incorrectly for buffs, debuffs and the death state.
 
Last edited by a moderator:

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
The 1st snippet didn't work as I had some serious copy and paste errors(my bad :) ). Now try this one instead:

#------------------------------------------------------------------------------|# * Edit class: SpriteHUD_Bar |#------------------------------------------------------------------------------|class SpriteHUD_Bar < Sprite #----------------------------------------------------------------------------| # Rewrite method: refresh_type2 | #----------------------------------------------------------------------------|  def refresh_type2    self.bitmap = Cache.system(setting_type[:filename]) unless bitmap    frames = setting_type[:frames]    width = bitmap.width / frames # Rewritten to ensure x never points beyond the last frame of the bitmap    x = (@rate * (frames - 1)).floor * width #    src_rect.set(x, 0, width, bitmap.height)  end # refresh_type2end # SpriteHUD_Bar
The 2nd snippet(YEA - Buff and State Manager Compatibility) is changed to this one:

#==============================================================================# ■ YEA - Buff and State Manager Compatibility by DoubleX#==============================================================================#==============================================================================# If you want to use Buff & State Manager with Luna engine, this script is# a must-have. This script requires DoubleX RMVXA Bug Fixes for YEA - Buff & # State Manager. Please credit DoubleX!#==============================================================================#==============================================================================# Editing anything past the engine's configuration script may potentially # result in causing computer damage, incontinence, explosion of user's head, # coma, death, and/or halitosis so edit at your own risk. # We're not liable for the risks you take should you pass this sacred grounds.#==============================================================================($imported ||= {})["YEL-BattleLuna YEA-Buff&StateManager Compatible"] = trueif $imported["YEA-Buff&StateManager"] && $imported["DoubleX RMVXA Bug Fixes for YEA-Buff&StateManager"]#------------------------------------------------------------------------------|#------------------------------------------------------------------------------|# * Edit class: Game_Battler |#------------------------------------------------------------------------------|class Game_Battler < Game_BattlerBase #----------------------------------------------------------------------------| # New public instance variables | #----------------------------------------------------------------------------| attr_accessor :turn_end attr_reader :buffs #----------------------------------------------------------------------------| # Alias method: on_turn_end | #----------------------------------------------------------------------------| alias game_battler_on_turn_end_bsm on_turn_end def on_turn_end game_battler_on_turn_end_bsm # Added to mark the use of this method @turn_end = true # end # on_turn_endend # Game_Battler#------------------------------------------------------------------------------|# * Edit class: SpriteHUD_States |#------------------------------------------------------------------------------|class SpriteHUD_States < Sprite #----------------------------------------------------------------------------| # Alias method: refresh_type0 | #----------------------------------------------------------------------------| alias spriteset_states_refresh_type0_bsm refresh_type0 def refresh_type0 spriteset_states_refresh_type0_bsm # Added to draw buff and state turns having icons and auto removal timings bitmap.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE bitmap.font.out_color.set(0, 0, 0, 255) display_states = @battler.states.select{ |state| state.icon_index > 0 }.collect { |state| state.id } display_buffs = [] @battler.buffs.each_with_index { |level, index| display_buffs.push(index) if level > 0 } (display_states + display_buffs).each_with_index { |id, index| if index < display_states.size bitmap.draw_text(index * (24 + setting_type[:spacing]), YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, @battler.state_turns(id), 2) if $data_states[id].auto_removal_timing > 0 elsif @battler.buff_turns(id) > 0 bitmap.draw_text(index * (24 + setting_type[:spacing]), YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, @battler.buff_turns(id).to_i, 2) end } # end # refresh_type0 #----------------------------------------------------------------------------| # Alias method: refresh_type1 | #----------------------------------------------------------------------------| alias spriteset_states_refresh_type1_bsm refresh_type1 def refresh_type1 spriteset_states_refresh_type1_bsm # Added to draw buff and state turns having icons and auto removal timings display_states = @battler.states.select{ |state| state.icon_index > 0 }.collect { |state| state.id } display_buffs = [] @battler.buffs.each_with_index { |level, index| display_buffs.push(index) if level > 0 } buff_state_id = (display_states + display_buffs)[@index] return unless buff_state_id bitmap.font.size = YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_SIZE bitmap.font.out_color.set(0, 0, 0, 255) if @index < display_states.size bitmap.draw_text(0, YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, @battler.state_turns(buff_state_id), 2) if $data_states[buff_state_id].auto_removal_timing > 0 elsif @battler.buff_turns(buff_state_id) > 0 bitmap.draw_text(0, YEA::BUFF_STATE_MANAGER::TURNS_REMAINING_Y, 24, 24, @battler.buff_turns(buff_state_id).to_i, 2) end # end # refresh_type1 #----------------------------------------------------------------------------| # Alias method: states_change? | #----------------------------------------------------------------------------| alias spriteset_states_states_change_bsm? states_change? def states_change? # Rewritten to mark state change upon turn end return spriteset_states_states_change_bsm? unless @battler.turn_end @battler.turn_end = false true # end # states_change?end # SpriteHUD_States#------------------------------------------------------------------------------|end # $imported["YEA-Buff&StateManager"] && $imported["DoubleX RMVXA Bug Fixes for YEA-Buff&StateManager"]
I've checked the codes and tested the snippet, and it should work now, although it's rather unperformant. It turns out that I got everything all wrong before this change and I facepalmed lol
 
Last edited by a moderator:

Melkino

Villager
Member
Joined
Mar 17, 2012
Messages
9
Reaction score
1
First Language
English
Primarily Uses
I tried those out and yup, they're working fine now. Thanks a lot!  :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top