CollosalPokemon
What's next?
- 249
- Posts
- 17
- Years
- Age 30
- The Ruins Of Alph
- Seen Mar 5, 2015
So I've been browsing around, and I saw a bunch of threads here about contributing graphics. Is that all we can contribute? (Rhetorical question, don't answer lol)
Basically I've created this thread to contribute some of my *ahem, smaller* scripts to help PC members start their own fangames. (or help the ones already in development) Please don't ask for specific scripts from my fangame though. All the scripts here have been tested and work* in Pokemon Essentials. (Regardless of your version)
*= They run, although some of them may have minor issues, but those will be noted.
So...I might as well give a list while I'm at it of the scripts (tools for devving your game) I've contributed on this thread so far:
1) Fullscreen toggler
2) Serial Code tool (For misc. reasons)
...more to come
1) A very simple way to call your game into fullscreen. Not much but hey, I'm sure someone wants it.
2) A serial code system to help your demo/get into secret places you want to make your players wait for.
Comments? Crits? Suggestions?
---> Please say so! Unless it's one of the following:
1) Dude ur awesome!!! Can u relase dual screen?
--> Not helpful and no.
2) You suck (you-know) why make this thread?
--> Not helpful and to help you guys with your games.
3) Keep up the good work!
--> Becomes spam.
4) STOP this work, you suck.
--> Becomes spam.
Thank you all for reading! (and hopefully commenting:P) More to come soon ~
CP
Basically I've created this thread to contribute some of my *ahem, smaller* scripts to help PC members start their own fangames. (or help the ones already in development) Please don't ask for specific scripts from my fangame though. All the scripts here have been tested and work* in Pokemon Essentials. (Regardless of your version)
*= They run, although some of them may have minor issues, but those will be noted.
So...I might as well give a list while I'm at it of the scripts (tools for devving your game) I've contributed on this thread so far:
1) Fullscreen toggler
2) Serial Code tool (For misc. reasons)
...more to come
1) A very simple way to call your game into fullscreen. Not much but hey, I'm sure someone wants it.
Spoiler:
unless $fscreen # Call only ONCE per startup. (Otherwise the game may crash)
$fscreen = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v'
$fscreen.call 0xA4, 0, 0, 0
$fscreen.call 13, 0, 0, 0
$fscreen.call 13, 0, 2, 0
$fscreen.call 0xA4, 0, 2, 0
end
$fscreen = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v'
$fscreen.call 0xA4, 0, 0, 0
$fscreen.call 13, 0, 0, 0
$fscreen.call 13, 0, 2, 0
$fscreen.call 0xA4, 0, 2, 0
end
2) A serial code system to help your demo/get into secret places you want to make your players wait for.
Spoiler:
#==============================================================================#
# ** Serial Code System ** #
#------------------------------------------------------------------------------#
# Author: Twilight Shadows #
# Date: ??.??.???? #
# Editor: CollosalPokemon #
# Edit Date: 03.23.2010 #
#==============================================================================#
# Serial Code system for demos, betas, etc... #
#==============================================================================#
class Scene_Serial
def initialize
@productname= "Pokemon_Essentials"
@productnum = "000-000-000-000"
end
def main
$game_system = Game_System.new
@bar = Window_Bar.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Use a background
@background=Sprite.new
@background.bitmap=RPG::Cache.picture("serialbackground")
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
@bar.dispose
end
def update
@bar.update
@bar.refresh
# Locate the Serial Code database
if not FileTest.exist?(@productname + ".txt")
# Show error if script not found
print ("Error: Your serial key is not valid. The game window will now close.")
# Quit game
exit!
else
lineno=1
havesection=false
sections=[]
File.open("{productname}.txt","rb"){|f|
f.each_line {|line|
FileLineData.setLine(line,lineno)
if line[/{productnum}/]
@bar.load += 1
end
}
}
end
if @bar.load == @bar.max
toscene
end
end
def toscene
$game_system = nil
if $DEBUG
$scene = Scene_DebugIntro.new
else
$scene = Scene_Intro.new(['Pic_1'], 'Pic_2')
end
end
def exit
$scene = nil
end
end
class Window_Bar < Window_Base
attr_accessor :load
attr_accessor :max
def initialize
super(0,0,640,480)
@load = 0
@max = 300
self.contents = Bitmap.new(width - 32, height - 32)
end
def refresh
self.contents.clear
draw_load(0,235)
end
def draw_load(x, y, width = 600)
rate = @load / @max.to_f
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
gauge = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
od = (width + plus_width) * @load * rate_width / 100 / @max
self.contents.font.color = system_color
self.contents.font.size = 30
self.contents.draw_text(120, 40 + 4, 600, 32, "Twilight Shadows")
self.contents.font.color = system_color
self.contents.font.size = 12
self.contents.draw_text(x, y + 4, 600, 32, " Loading Serial Key. . .")
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# Drawing of empty gauge
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# Drawing of actual gauge
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
class Window_Base
color = Color.new(0, 0, 0, 192)
color3 = Color.new(64, 0, 0, 192)
color4 = Color.new(0, 0, 0, 0)
end
#==============================================================================#
# New routine for the Bitmap class. #
#==============================================================================#
class Bitmap
#==============================================================================#
# * Rectangle Gradiant Indicator #
# color1: Start color #
# color2: Ending color #
# align: 0: Side gradiant #
# 1: Vertical gradation #
# 2: The gradation (Note: HEAVY slanting) #
#==============================================================================#
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
# ** Serial Code System ** #
#------------------------------------------------------------------------------#
# Author: Twilight Shadows #
# Date: ??.??.???? #
# Editor: CollosalPokemon #
# Edit Date: 03.23.2010 #
#==============================================================================#
# Serial Code system for demos, betas, etc... #
#==============================================================================#
class Scene_Serial
def initialize
@productname= "Pokemon_Essentials"
@productnum = "000-000-000-000"
end
def main
$game_system = Game_System.new
@bar = Window_Bar.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Use a background
@background=Sprite.new
@background.bitmap=RPG::Cache.picture("serialbackground")
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
@bar.dispose
end
def update
@bar.update
@bar.refresh
# Locate the Serial Code database
if not FileTest.exist?(@productname + ".txt")
# Show error if script not found
print ("Error: Your serial key is not valid. The game window will now close.")
# Quit game
exit!
else
lineno=1
havesection=false
sections=[]
File.open("{productname}.txt","rb"){|f|
f.each_line {|line|
FileLineData.setLine(line,lineno)
if line[/{productnum}/]
@bar.load += 1
end
}
}
end
if @bar.load == @bar.max
toscene
end
end
def toscene
$game_system = nil
if $DEBUG
$scene = Scene_DebugIntro.new
else
$scene = Scene_Intro.new(['Pic_1'], 'Pic_2')
end
end
def exit
$scene = nil
end
end
class Window_Bar < Window_Base
attr_accessor :load
attr_accessor :max
def initialize
super(0,0,640,480)
@load = 0
@max = 300
self.contents = Bitmap.new(width - 32, height - 32)
end
def refresh
self.contents.clear
draw_load(0,235)
end
def draw_load(x, y, width = 600)
rate = @load / @max.to_f
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
gauge = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
od = (width + plus_width) * @load * rate_width / 100 / @max
self.contents.font.color = system_color
self.contents.font.size = 30
self.contents.draw_text(120, 40 + 4, 600, 32, "Twilight Shadows")
self.contents.font.color = system_color
self.contents.font.size = 12
self.contents.draw_text(x, y + 4, 600, 32, " Loading Serial Key. . .")
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# Drawing of empty gauge
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# Drawing of actual gauge
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
class Window_Base
color = Color.new(0, 0, 0, 192)
color3 = Color.new(64, 0, 0, 192)
color4 = Color.new(0, 0, 0, 0)
end
#==============================================================================#
# New routine for the Bitmap class. #
#==============================================================================#
class Bitmap
#==============================================================================#
# * Rectangle Gradiant Indicator #
# color1: Start color #
# color2: Ending color #
# align: 0: Side gradiant #
# 1: Vertical gradation #
# 2: The gradation (Note: HEAVY slanting) #
#==============================================================================#
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
Comments? Crits? Suggestions?
---> Please say so! Unless it's one of the following:
1) Dude ur awesome!!! Can u relase dual screen?
--> Not helpful and no.
2) You suck (you-know) why make this thread?
--> Not helpful and to help you guys with your games.
3) Keep up the good work!
--> Becomes spam.
4) STOP this work, you suck.
--> Becomes spam.
Thank you all for reading! (and hopefully commenting:P) More to come soon ~
CP
Last edited: