RPG Maker Times

Smile Game Builder and RPG Maker Tutorials, Plugins, Resources, Windowskins

Victory Count Script

EDIT: This tutorial will be updated and moved to Scripts Tutorials soon.

I was asked some time ago how to add a “Victory Count” – i.e. a counter for the number of battles won – so decided to experiment and this is the result. This is a very simple script modification, directly modifying various parts of the code.

Game_System
Under the Public Instance Variables, add the following:

attr_accessor :victory_count          # number of victories

Under initialize, add:

@victory_count = 0

Scene_Battle
Look for def display_exp_and_gold, place the following underneath $game_party.gain_gold(gold):

$game_system.victory_count += 1

Scene_Menu
In def start, add:

@victory_window = Window_Victory.new(0, 175)

In def terminate, add:

@victory_window.dispose

In def update, add:

@victory_window.update

Create a new entry, entitled Window_Victory, and paste the following code:

class Window_Victory   #--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 160, WLH + 32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 16
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
return if Graphics.frame_count % 10 != 0
self.contents.clear
self.contents.draw_text(0, WLH * 0, 120, WLH, "# Victories:")
self.contents.draw_text(0, WLH * 0, 120, WLH, $game_system.victory_count.to_s, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
refresh
end
end

This will display the “# Victories” on the Status Menu. It can be expanded for other things as well, such as the number of saves, the number of inn stays, etc.

2 thoughts on “Victory Count Script

  1. You’re right, it would be. Although, admittedly, this is just a very basic method. I’m getting ready to update most of the scripts/scriptlets I have on here anyway. It’s about that time! Thanks for commenting (and reminding me about aliasing!).

Categories

Archives

Hi-Tex House Pack Vol. 1

For Smile Game Builder

The Hi-Tex House Pack Vol. 1 contains 297 assets: 284 house wall terrains and 13 models. Get your copy for only $5!

Sponsored Ad

Sponsored Ad


Follow me on Twitter

© 2008-2018, Companion Wulf. All Rights Reserved.