Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help with Chaosg1's Test your Might Minigame

I am using Chaosg1's Test your Might Minigame and I need a little bit of help getting it to fail. The problem is every time I fail it for some reason causes me to pass. Here is my script:
Code:
#==============================================================================
# Script Test_Might
# 
# By: Chaosg1
# Version : 1.0
# Date :13-09-2006
#==============================================================================
class Mining
  #--------------------------------------------------------------------------
  # * 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,"Mining",2)
    @window_status.draw_gradient_bar(0, 60, @might_value, 1000, "021-Metallic02", width = nil, height = nil, hue = 0, back = "021-Metallic02", back2 = "022-Metallic03")
  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::C)
      @might_value += @increase 
    end
    @spriteset_map.update
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
      @time -=1
    end
  end
end

No it is not the fact that I renamed the Class I made sure I put in "$scene = Mining.new(time,increase,decrease)". Here is my conditional branch's script line "$test_passed = true". But every time I fail it makes me pass. I have tried adding a conditional branch for "$test_passed = false" but it still no matter what I do forces my pass. Could someone please help me setup this script?

EDIT: Oh, yes this is for XP.
 

khmp

Sponsor

An assignment is always true and that's the problem here. The script works fine. But you are actually assigning $testing_passed to true or false with those statements. You need to test for equality using double equals instead. Its not a big problem. Just a minor oversight.

Good luck with it diablosbud! :thumb:
 
What do you mean by test for equality?

EDIT: Never mind I get you, you mean "$test_passed = = true" that makes sense because Chaosg1 said "$test_passed = =true" that's where I was stuck I'll test it quick and add a second edit to this post.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top