[ACE] Yanfly's Victory Aftermath - No Gold Error

Okay, again I need the helpt of yours.

first, the victory aftermath script is awesome. but.. I got a little issue with that.

in my game, many of the monsters dont drop gold (why would a monster carry gold 😳) so they are dropping other items instead.

unfortunately shows the script every amount of gold you receive after battle, even if it is 0! 

Here is the Victory Aftermath Script

I managed to get rid of the displaying that 0 gold is received. but... the script still draws the box of it, which looks just stupid.

I changed this part:

#-------------------------------------------------------------------------- # draw_gold #-------------------------------------------------------------------------- def draw_gold(rect) text = Vocab.currency_unit draw_currency_value(@gold, text, rect.x, rect.y, rect.width) endto this:

#-------------------------------------------------------------------------- # draw_gold #-------------------------------------------------------------------------- def draw_gold(rect) if @gold > 0 text = Vocab.currency_unit draw_currency_value(@gold, text, rect.x, rect.y, rect.width) end endbut where do I get rid of the box?? 

here is a gif to show what I mean exactly.

I hope someone can give me a clue. =)
Try overwriting the gain_drop_items method with this:

Spoiler
#————————————————————————–
# overwrite method: self.gain_drop_items
#————————————————————————–
def self.gain_drop_items
drops = []
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
drops.push(item)
end

# only show the spoils if there ARE any spoils!
if($game_troop.gold_total > 0 || drops.length > 0)
SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
set_victory_text(@victory_actor, :drops)
wait_for_message
 end
end
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
@Shaz: whoops, sorry! >.<

@Uzuki:

this.. doesn't really work. even it is zero gold you receive, the script count that still as a reward! so the empty box ist there everytime!! that means, there are spoils, no matter what...
sorry for doublepost, but... bump! 

need really help about this...
Change draw_item(index) to this:

def draw_item(index)

    item = @data[index]

    if @gold > 0

      rect = item_rect(index)

      draw_gold(rect)

    else

      rect = item_rect(index - 1)

    end

    reset_font_settings

    if item.nil?

      return

    end

    rect.width -= 4

    draw_item_name(item, rect.x, rect.y, true, rect.width - 24)

    draw_item_number(rect, item)

  end

 

The problem was that because database items start their indexes at 1, there's never anything in @data[0], so the item rect index is always considering 1 for items regardless of whether there's gold being printed. Doing it the way I've amended it to means that if there's 0 gold it treats each item's placement as if it's being drawn for the index below it, so everything shifts nicely into place.
Thanks a lot! =D
I never considered in this case that the indexes start at 1 ... thanks for your help!

Original thread: https://forums.rpgmakerweb.com/threads/ace-yanflys-victory-aftermath-no-gold-error.38790/