Test your Might -Mini Game


Version: <1.0>

Introduction
Have you ever wanted to have that Mortal Kombat Mini Game, where you needed to press a button to increase a bar?Now you can Have it!

Features

Screenshots
No Need...

Demo
here it is...
http://up-file.com/download/77e46f174585/Emeraldon.rar.html
Please replace the Script in the demo with this one, the other one has a bug...
Script
#==============================================================================
# Script Test_Might
#
# By: Chaosg1
# Version : 1.0
# Date :13-09-2006
#==============================================================================
class Test_Might
  #--------------------------------------------------------------------------
  # * Main - Handles drawing/disposing windows and the main loop
  #--------------------------------------------------------------------------
  def initialize(time,increase,decrese)
    $test_passed = false
    @window_status = Window_Base.new(0,0 ,160,160)
    @time = time + 4
    @decrease = decrese
    @increase = (increase*5) * $game_party.actors[0].str/100 + $game_party.actors[0].int/100
    @might_value = 0
    @window_status.contents =  Bitmap.new(@window_status.width - 32, @window_status.height - 32)
    @window_status.opacity = 0
  end
  #--------------------------------------------------------------------------
  # * Main
  #--------------------------------------------------------------------------
  def main
    @spriteset_map = Spriteset_Map.new
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      #refresh
      refresh
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @window_status.dispose
    @spriteset_map.dispose
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    @window_status.contents.clear
    @window_status.contents.draw_text(12,0,60,32,"Time Left:",2)
    @window_status.contents.draw_text(72,0,30,32,@time.to_s,2)
    @window_status.contents.draw_text(20,25,60,32,"Might",2)
    @window_status.draw_gradient_bar(0, 60, @might_value, 1000, "014-Reds01.png", width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    if @time <= 0 and @might_value < 800
      $scene = Scene_Map.new
      $game_system.se_play($data_system.buzzer_se)
    elsif @might_value > 800 and @time > 0
      $scene = Scene_Map.new
      $test_passed = true
      return
    end
    @might_value -= @decrease if @might_value > 0 and @might_value < 999
    if Input.trigger?(Input::X)
      @might_value += @increase
    end
    @spriteset_map.update
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
      @time -=1
    end
  end
end
Expand to see the code.


Credits
Me, and Trickster for his gradien bars..

Instruction
To fil the bar just press the A key...
just make in a call script
$scene = Test_Might.new(Time,Increase, decrease)
Expand to see the code.

wait 1
then a conditional branch. In the script line just make:
$test_passed = =true

That's it.
Authors Notes:
Enjoy:p expect and update when Trickster extra methods/classes pack are out...
1) It be much easier if you trash the whole Graphics.frame_count / Graphics.frame_rate thing for just using a variable that increments by one each frame

2) Heh I do have Gradient Bar Sprite class designed for stuff like this (smooth steady increasing and decreasing without any lag)

3) There is a bug in your script Its pretty self explanatory by looking at these conditions you have here
    if @time <= 0 and @might_value < 500
      $scene = Scene_Map.new
      $game_system.se_play($data_system.buzzer_se)
    elsif @might_value > 800 and @time > 0
      $scene = Scene_Map.new
      $test_passed = true
      return
    end
Expand to see the code.
i tried toput these into my game...

But when the bar is shown, and i press ENTER ( changed X to C ).. Nothing happens....

hereÃâ ‚¬Å¡Ãƒâ€šÃ‚ ´s my edit... perhaps, i made something wrong..:
Quote:
#==============================================================================
# Script Test_Might
#
# By: Chaosg1
# Version : 1.0
# Date :13-09-2006
#==============================================================================
class Test_Might
#--------------------------------------------------------------------------
# * Main - Handles drawing/disposing windows and the main loop
#--------------------------------------------------------------------------
def initialize(time,increase,decrese)
$test_passed = false
@window_status = Window_Base.new(0,0 ,640,480)
@time = time
@decrease = decrese
@increase = (increase*5) * $game_party.actors[0].str/100 + $game_party.actors[0].int/100
@might_value = 0
@window_status.contents = Bitmap.new(@window_status.width - 32, @window_status.height - 32)
@window_status.opacity = 0
end
#--------------------------------------------------------------------------
# * Main
#--------------------------------------------------------------------------
def main
@spriteset_map = Spriteset_Map.new
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
#refresh
refresh
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@window_status.dispose
@spriteset_map.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@total_sec = Graphics.frame_count / Graphics.frame_rate
@window_status.contents.clear
@window_status.contents.draw_text(($game_player.x*32)-80,($game_player.y*32)-94, 180, 32, "Schnell Leertaste hÃÆ €™Ãƒâ€šÃ‚ ¤mmern", 2)
@window_status.draw_gradient_bar(($game_player.x*32)-80, ($game_player.y*32)-60, @might_value, 1000, "028-SoftReds02", width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
if @time <= 0 and @might_value < 500
$scene = Scene_Map.new
$game_system.se_play($data_system.buzzer_se)
elsif @might_value > 800 and @time > 0
$scene = Scene_Map.new
$test_passed = true
return
end
@might_value -= @decrease if @might_value > 0 and @might_value < 999
if Input.trigger?(Input::C)
@might_value += @increase
end
@spriteset_map.update
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
@time -=1
end
end
end






Do you have the gradient script?
Did it gave you an error??
Edit: It's working fine for me...
#================================================= =============================
# Script Test_Might
#
# By: Chaosg1
# Version : 1.0
# Date :13-09-2006
#================================================= =============================
class Test_Might
#--------------------------------------------------------------------------
# * Main - Handles drawing/disposing windows and the main loop
#--------------------------------------------------------------------------
def initialize(time,increase,decrese)
$test_passed = false
@window_status = Window_Base.new(0,0 ,640,480)
@time = time
@decrease = decrese
@increase = (increase*5) * $game_party.actors[0].str/100 + $game_party.actors[0].int/100
@might_value = 0
@window_status.contents = Bitmap.new(@window_status.width - 32, @window_status.height - 32)
@window_status.opacity = 0
end
#--------------------------------------------------------------------------
# * Main
#--------------------------------------------------------------------------
def main
@spriteset_map = Spriteset_Map.new
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
#refresh
refresh
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@window_status.dispose
@spriteset_map.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@total_sec = Graphics.frame_count / Graphics.frame_rate
@window_status.contents.clear
@window_status.contents.draw_text(0,0, 180, 32, "Schnell Leertaste hÃÆ €™Ãƒâ€šÃ‚ ¤mmern", 2)
@window_status.draw_gradient_bar(0, 100, @might_value, 1000, "028-SoftReds02", width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
if @time <= 0 and @might_value < 999
$scene = Scene_Map.new
$game_system.se_play($data_system.buzzer_se)
elsif @might_value > 999 and @time > 0
$scene = Scene_Map.new
$test_passed = true
return
end
@might_value -= @decrease if @might_value > 0 and @might_value < 999
if Input.trigger?(Input::C)
@might_value += @increase
end
@spriteset_map.update
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
@time -=1
end
end
end
Expand to see the code.
Yes iÃâ ‚¬Å¡Ãƒâ€šÃ‚ ´ve the Gradient Script
no, it donÃâ ‚¬Å¡Ãƒâ€šÃ‚ ´t gives an error...

But...I can press the Enter/Space button as much as i can... nothing happens...

Could it be, that if i run 10 Paralell Common Events in the background, it wonÃâ ‚¬Å¡Ãƒâ€šÃ‚ ´t work?
What's your frame rate? because at highframe rates you need to put the increase number a little highter else the Decrease will be bigger that the increase...
In Game itÃâ ‚¬Å¡Ãƒâ€šÃ‚ ´s between 22 and 32 FPS
downloading now - i've always wanted something like this as a mini game
probably going to try to play a tad with it in different ways
heh, a "drinking contest" like in crono trigger
sword vs. sword clash (where your trying to overpower)
obviously the might test...
this is pretty cool though i haven't tried it yet, thanks
i want it for open Doors, catching Ladders, open Boxes or moving something Big like in "God of War"...^^

But it wont work... no plan why....
u have to press X (that's shift), but it worked not for me neither...
so I replaced Input::X with Input::C (That's Enter) and it worked...
Nice Script!
In my PC it works perfectly! This script is awesome! this is good to make a game cooler!
I have updated the script, please change your script with the one in the script section. I haven't updated the Demo.

@everyone: thanx for the replys, if you have any sugestions , I open for ideas!
I have updated the script, please change your script with the one in the script section. I haven't updated the Demo.

@everyone: thanx for the replys, if you have any sugestions , I open for ideas!
Multiple button presses would be nice. Like pulling two levers. Exchanging X and A to fill the bar or something like that. Not sure how easy this would be. I'm still a nOOb at scripting... But if you could implement this somehow, that would be awesome.

PS.

This script is rawks XD
In my Opinion, the Script stucks, if 20 or more Paralell Common Events are running in Background ^^

Why?

Because i tested it without the Events, and it worked.. I tested with... The bar appears..But on Tabbing Enter ( X changed to C ), nothing happens...
[QUOTE=Sir Lord Biowulve]In my Opinion, the Script stucks, if 20 or more Paralell Common Events are running in Background ^^

Why?

Because i tested it without the Events, and it worked.. I tested with... The bar appears..But on Tabbing Enter ( X changed to C ), nothing happens...[/QUOTE]

Well, unless I'm mistaken, Common Events/Events on Map are ran in Game_Map#update which is called By Scene_Map#update, and this script is just a separate Scene which uses Spriteset_Map, so they are not running during the scene, it must be something else.
I never though that A simple script like this would bring so many peole... :P

@sir_lord: I don't know what the problem is..
My greatest Problem is:

When i create a Demo of my Problem... It works... But in my Game..it wont run correct.

Chrinic of the problem:

-Start Game
-Script is called via a Box.
-Time = 30 increase = 15 decrease = 1
-Hero stopps and canÃâ ‚¬Å¡Ãƒâ€šÃ‚ ´t move.
-bar and text is shown.
-I press the Button as much as i can..
-Nothing happens.....
like thereÃâ ‚¬Å¡Ãƒâ€šÃ‚ ´s no reaction of the Button...
Try creating a demo of your game, if it works fine. If not send it to me.
Hey, awesome scirpt! But how can I make so it gets harder as the hero grows rather than gets easier?
Please you it could place the demon for download again? because this not this obliged on.

Tanks
yeah..download seems to have been deleted..might you upload again?
I think I don't have it anymore :S, I will see if I can find it again, or maybe redo it.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=9204