08 November 2009

Victory Count Script

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 < Window_Base
#--------------------------------------------------------------------------
# * 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.

Gladiator Project Title

This is the opening title scene for The Gladiator Project. It was inspired by Mog Hunter's Animated Title Script.


The graphics are from the movie Gladiator, starring Russel Crowe, which are of course copyrighted to Dreamworks SKG/Universal Pictures. They're there for demonstration purposes only, at least until I can find (or create) some myself, when they will be removed.
Related Posts with Thumbnails
Template Design "Perfect World" by SkinCorner