iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> Simple Gold Window, Version 1.1a up!
Rating 5 V
Niclas
post Jun 6 2011, 05:16 PM
Post #1


Whats this?
Group Icon


Type: Designer
Alignment: Lawful Good




Simple Gold Window

Version: 1.1a.


Introduction
A simple script that allows you to display a gold window on the map. I've made it so you can tweak it a bit if nessicary, anyways hope you enjoy it!

Features
  • Easy to use and install.
  • Simple to change location of the window.
  • Choose an icon that will be displayed next the gold value.
  • The ability to have a switch turn it on/off.
  • A few more simple tweaks that you can play around with.
  • A counting effect when updating the gold amount.

Screenshots
Not really nessicary.

How to Use
To install this script, open up your script editor and copy/paste this script to an open slot below �–� Materials but above �–� Main. Remember to save.

Script
CODE
#==============================================================================
# Simple Gold Window
# Author: Nicke
# Created: 06/06/2011
# Edited: 05/12/2011
# Version: 1.1a
#
# Optimized/modified by Jet and IceDragon so credits to them too!
#
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials but above ▼ Main. Remember to save.
#==============================================================================
($imported ||= {})["NICKE-GoldWindow"] = true

module NICKE
module GOLD_WINDOW
#==============================================================================#
# ** Settings
#==============================================================================#
# GOLD_FONT |FONT| |SIZE| |COLOR| |SHADOW|
GOLD_FONT = ["Rockwell", 14, Color.new(255,215,100), true]

# GOLD_WINDOW |X| |Y| |Z| |OPACITY|
GOLD_WINDOW = [498, 422, 99700, 0]

# GOLD |ICON| |VISIBLITY| |SHOW_ICON| |SHOW_VOCAB|
GOLD = [3300, 1, true, false]

# GOLD_COUNT |SOUND| |VOL| |PITCH| |PLAY|
GOLD_COUNT = ["", 60, 100, false]

# Count timer for updating the gold.
GOLD_COUNT_WAIT = 1
# The time lapse between gold count changing.
GOLD_CHANGING = 2

end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Window_Base
#------------------------------------------------------------------------------
# Method for drawing the gold.
#==============================================================================#
include NICKE::GOLD_WINDOW
class Window_Base < Window

def draw_gold(value, x, y, width)
cx = contents.text_size(Vocab::gold).width
self.contents.font.name = GOLD_FONT[0]
self.contents.font.size = GOLD_FONT[1]
self.contents.font.color = GOLD_FONT[2]
self.contents.font.shadow = GOLD_FONT[3]
self.contents.draw_text(x - 16, y, width-cx-2, WLH, value, 2)
#// If true change x and y postion.
self.contents.draw_text(x - 20, y, width-cx-2, WLH, Vocab::gold, 2) if GOLD[3] == true
end

end
#==============================================================================
# ** Simple_Gold_Window
#------------------------------------------------------------------------------
# This window displays the amount of gold and draw an icon.
#==============================================================================
class Simple_Gold_Window < Window_Base

def initialize(x, y)
super(x, y, 250, 300)
@last_gold = $game_party.gold # // Used for updating.
@wait_period = GOLD_COUNT_WAIT # // Used for a wait period for gold count changing.
refresh
end

def refresh
self.contents.clear
draw_gold(@last_gold, 4, 0, 120) # // Draw gold.
draw_icon(GOLD[0], 94, 0) if GOLD[2] == true
end

def update
super
@wait_period -= 1 if @wait_period != 0
if @last_gold != $game_party.gold and @wait_period == 0 # // If gold has changed, refresh.
if @last_gold < $game_party.gold
@last_gold += 1
else
@last_gold -= 1
end
if self.visible
RPG::SE.new(GOLD_COUNT[0], GOLD_COUNT[1], [2]).play if GOLD_COUNT[3]
end
refresh
@wait_period = GOLD_CHANGING
end
end

end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# Show gold window on the map.
#==============================================================================
class Scene_Map < Scene_Base

alias nicke_gold_window_start start unless $@
def start(*args, &block)
nicke_gold_window_start(*args, &block)
create_gold_window
@gold_window.visible = $game_switches[GOLD[1]]
end

alias nicke_gold_window_terminate terminate unless $@
def terminate(*args, &block)
nicke_gold_window_terminate(*args, &block)
dispose_gold_window
end

def create_gold_window
@gold_window = Simple_Gold_Window.new(GOLD_WINDOW[0], GOLD_WINDOW[1])
@gold_window.z = GOLD_WINDOW[2]
@gold_window.opacity = GOLD_WINDOW[3]
end

def dispose_gold_window
@gold_window.dispose unless @gold_window.nil?
@gold_window = nil
end

alias nicke_gold_window_update update unless $@
def update(*args, &block)
nicke_gold_window_update(*args, &block)
@gold_window.update
@gold_window.visible = $game_switches[GOLD[1]]
end

end # END OF FILE

#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#


Updates
Added a count effect when updating the gold amount, big thanks to Jet.
Released 1.1a. Optimized the code slightly. Easier to change settings now.

Credit
Remeber to credit me if you use it. Thanks to IceDragon/Jet for changes in the code to make it more optimized. smile.gif

This post has been edited by Niclas: Dec 5 2011, 07:35 PM


--------------------
Go to the top of the page
 
+Quote Post
   
HuhJuh
post Jun 10 2011, 09:54 AM
Post #2


New Age Messiah
Group Icon


Type: Designer
Alignment: Chaotic Neutral




This sounds pretty neat,
now i'm not a scripter... at all
But i'm looking for a goldwindow like this, but which will also show the value of lets say variable #2 and #3 (which i use for other currencies(e.a Arena Points or Diamonds)
Can you edit the script so it will show both gold and the 2 variables with an icon for all 3?



--------------------
It's not a merry-go-round, it's a haunted house
And i can't get out.
Like a song of sirens, you're sickly satisfied,
Knowing i can't hide.
Go to the top of the page
 
+Quote Post
   
Faalhaasje
post Jun 10 2011, 11:08 AM
Post #3


Dutchman
Group Icon


Type: Coder
Alignment: Chaotic Good




Hey niclas, i see you now share the script to all of us n_n
i solved my gold window problem by omegas7 variablewindow script, but thanks for your help!



--------------------
Y can't we event our own lives ლ(ಠ益ಠლ
Go to the top of the page
 
+Quote Post
   
Niclas
post Jun 10 2011, 02:55 PM
Post #4


Whats this?
Group Icon


Type: Designer
Alignment: Lawful Good




@HuhJuh: Sure I can give that I try, however there are other scripts that can do that easily. Like Omegas variable window for instance.


--------------------
Go to the top of the page
 
+Quote Post
   
GrandMasterTrea
post Jun 13 2011, 03:28 PM
Post #5


Boy Genius
Group Icon


Type: Writer
Alignment: Lawful Evil




Apologizes for the Necropost, but
This isn't appearing for me. Here are my settings within the script. I have tried different opacities, as well as flipping the switch ON/OFF, and starting a new game all to no avail.

GOLD_FONT = ["Rockwell"] # Font name.
GOLD_SIZE = 16 # Font size.
GOLD_COLOR = Color.new(255,215,100) # Font color.
X_GOLD_WINDOW = 505 # X position of Gold window.
Y_GOLD_WINDOW = 372 # Y position of Gold window.
OPACITY = 0 # Opacity for Gold window.
SHOW_ICON = true # Icon visibility.
ICON_INDEX = 147 # Gold icon ID to be displayed.
VISIBLE_SWITCH = 82 # Switch ID to turn on/off the gold window.
SHOW_VOCAB = true # Show system term for gold.

Thanks.


--------------------
My Project
Click to play!


Projects I Support
Spoiler:

Go to the top of the page
 
+Quote Post
   
Niclas
post Jun 13 2011, 06:29 PM
Post #6


Whats this?
Group Icon


Type: Designer
Alignment: Lawful Good




@GrandMasterTrea: Do you have Rockwell font installed on your computer? Try put the opacity at 255 then you can at least see where the gold window box is at. Hope it helps smile.gif


--------------------
Go to the top of the page
 
+Quote Post
   
GrandMasterTrea
post Jun 13 2011, 09:50 PM
Post #7


Boy Genius
Group Icon


Type: Writer
Alignment: Lawful Evil




That did it, I wasn't sure whether 0 was max or min visibility, because it started at 0. However now the font is...strange. Arial doesn't work, but I'll just keep trying different fonts until it works.


--------------------
My Project
Click to play!


Projects I Support
Spoiler:

Go to the top of the page
 
+Quote Post
   
Niclas
post Jun 24 2011, 08:47 PM
Post #8


Whats this?
Group Icon


Type: Designer
Alignment: Lawful Good




@GrandMasterTrea: As long as it works. smile.gif


--------------------
Go to the top of the page
 
+Quote Post
   
Niclas
post Aug 9 2011, 07:58 PM
Post #9


Whats this?
Group Icon


Type: Designer
Alignment: Lawful Good




Version 1.1 released.


--------------------
Go to the top of the page
 
+Quote Post
   
Niclas
post Dec 5 2011, 07:21 PM
Post #10


Whats this?
Group Icon


Type: Designer
Alignment: Lawful Good




Released 1.1a.


--------------------
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 28th August 2014 - 10:20 PM

RPGMakerVX.net is an Privacy Policy, Legal.