brainstorm
Member
Well... When I call a scene using events the events afterward do not show. For Battles they work just fine.
Here's the scriptWarning: very badly coded)(Warning:Using guage_rect by Cogwheel.)
This will probably be my last request.':|
Here's the scriptWarning: very badly coded)(Warning:Using guage_rect by Cogwheel.)
Code:
class Scene_SaveActivate
attr_accessor :ind
def initialize(ind)
$won = false
@ind = ind
end
def main
@window_key = []
for i in 0...@ind
@window_key.push(Key_Window.new(i))
@window_key[i].y = 44 * i + 64
@window_key[i].id = i
end
@phase = 0
@activated = 0
@window_key[0].activated = true
@help_window = Window_SaveActHelp.new
@valu2 = @ind * 175
@powershot = 5
@spriteset = Spriteset_Map.new
# Execute transition
Graphics.transition
# Main loop
loop do
# 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
for i in 0...@ind
@window_key[i].dispose
end
@help_window.dispose
@spriteset.dispose
end
def update
@spriteset.update
if Input.trigger?(Input::B)
$won = false
$scene = Scene_Map.new
end
@valu2 -= 1
@help_window.set_text("Keep Pressing C To raise the Activation Bar. Time: " + @valu2.to_s, 1)
if @valu2 <= 0
$won = false
$scene = Scene_Map.new
end
if @window_key[@activated] == nil
$scene = Scene_Map.new
end
for i in 0...@ind
@window_key[i].update
end
@help_window.update
if @phase == 0
update_phase1(i)#Activation
elsif @phase == 1
update_phase2
end
end
def update_phase1(index)
if @window_key[@activated] == nil
$won = true
$scene = Scene_Map.new
elsif @window_key[@activated] != nil and @window_key[@activated].activated
@phase = 1
elsif @window_key[@activated].activated == false
@window_key[@activated].activated = true
end
end
def update_phase2
#p("yay")
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
if Input.trigger?(Input::B)
$won = false
$scene = Scene_Map.new
end
@valu2 -= 1
@help_window.set_text("Keep Pressing C To raise the Activation Bar. Time: " + @valu2.to_s, 1)
if @valu2 <= 0
$won = false
$scene = Scene_Map.new
end
@window_key[@activated].refresh
if Input.repeat?(Input::C)
@window_key[@activated].value += 1
end
if Input.repeat?(Input::R)
if @powershot > 0
@window_key[@activated].value += 5 + $game_party.actors[0].level
end
@powershot -= 1
end
if @window_key[@activated].value >= 51
@activated += 1
@phase = 0
end
# Abort loop if screen is changed
if @phase != 1
break
end
if $scene != self
break
end
end
end
end
class Key_Window < Window_Base
attr_accessor :activated
attr_accessor :value
attr_accessor :id
def initialize(ind)
@ind = ind
@id = 0
@value = 0
@activated = false
super(0,0,160,44)
self.contents = Bitmap.new(width - 32, height - 32)
self.x = (640 / 2) - (160 / 2)
refresh
end
def refresh
self.contents.clear
draw_actor_index(0,0)
end
def draw_actor_index(x, y, width = 127)
if defined?(gauge_rect)
rate = @value / 100
plus_x = 0
rate_x = 0
plus_y = 10
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 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)
lb = (width + plus_width) * @value * rate_width / 100 / 50
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, lb, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
end
end
class Window_Base
def draw_bar(value1, value2, x, y, width = 127)
if defined?(gauge_rect)
rate = value1 / value2
plus_x = 0
rate_x = 0
plus_y = 100
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 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)
lb = (width + plus_width) * value1 * rate_width / 100 / value2
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, lb, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_SaveActHelp < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# * Set Actor
# actor : status displaying actor
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# * Set Enemy
# enemy : name and status displaying enemy
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
end
This will probably be my last request.':|