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.

Merging 2 Scripts To Work Together

Yin

Member

My Request
This is a request for a merge of two scripts script.

Wazabrew merge with lockpick minigame
viewtopic.php?f=156&t=36000
http://www.megaupload.com/?d=OS5YQT50 (lockpicking)
RMXP
This is for RMXP

Description
What I want is instead of just having the items and poof there goes the item, I want it to be like a pass or fail. If you don't finish the lockpicking (which i am going to edit to it what it is making, it wont be lockpicking when I am done editing the graphics and the words in the script) game in time, then you lose your items and you don't get the new item that was supposed to be made.

Screen shots
None
Other Scripts I am using (in order):
I am using many other scripts. I've been trying to get them to work all together, but... some things just wont work. Here's my list.
ScriptsIamusing1.jpg

ScriptsIamusing2.jpg


Compatibility
Please make compatile with charlie lee's ctb
Also, if anyone can make it so that attack restores 3% MP and defend restore 5% HP, it would be appreciated too. Thanks in advance to whoever if anyone takes up this offer!
 

Yin

Member

Bump, if anyone can help me out, please do. I've been trying to do it myself, but end up starting all over because I really have absolutely no idea what I am doing.
 

EOG

Member

Script combination works as you wanted. Just paste code somewhere under 2 scripts.
Code:
 

# Addon - Combination of WazaBrew 4.0 and Lockpick Minigame

# Author: EOG

#

# This is only and addon so base scripts are still needed!

# 

module Brew

RECIPES = [

    {'NAME' => 'Silver Potion',

     'DIFFICULTY' => 0, # 0-very easy, 4-insane

     'TYPE' => 'Brew',

     'RESULT' => [ITEM, 3, 1],

     'COMPONENTS' => [

       [ITEM, 2, 1, CONSUMED],

       [ITEM, 1, 1, CONSUMED]

     ]

    },

    {'NAME' => 'Golden Potion',

     'DIFFICULTY' => 1, # 0-very easy, 4-insane

     'TYPE' => 'Brew',

     'RESULT' => [ITEM, 6, 1],

     'COMPONENTS' => [

       [ITEM, 4, 1, CONSUMED],

       [ITEM, 5, 1, CONSUMED]

     ]

    }

  ]

end

 

class Scene_Brew

  def brew(recipe)

    return false unless Brew.can_make?(recipe)

    recipe = Brew.get_recipe(@recipe_list.data)

      if Brew::SHOW_RESULT

        if @result_window

          @result_window.dispose

          @result_window = nil

        end

        pass = minigame(recipe['DIFFICULTY'])

        @result_window = Window_Base.new(0, 0, 256, 64)

        @result_window.contents = Bitmap.new(224, 32)

        @result_window.x = 320 - @result_window.width / 2

        @result_window.y = 240 - @result_window.height / 2

        @result_window.z = 9998

        if pass

          @result_window.contents.draw_text(4, 0, 224, 32,

          "#{$data_items[recipe['RESULT'][1]].name} made!", 1)

        else

          @result_window.contents.draw_text(4, 0, 224, 32,

          "#{$data_items[recipe['RESULT'][1]].name} fail to made!", 1)

        end

      end

    for component in recipe['COMPONENTS']

      case component[0]

      when 0

        $game_party.lose_item(component[1], component[2]) if component[3]

      end

    end

    case recipe['RESULT'][0]

    when 0

      if pass

        $game_party.gain_item(recipe['RESULT'][1], recipe['RESULT'][2])

      end

    end

    return true

  end

  def minigame(difficulty)

    @recipe_list.visible = false

    @result_info.visible = false

    @result_comp.visible = false

    @result_window_sprite.visible = false

    @recipe_list_sprite.visible = false

    @result_info_sprite.visible = false

    @result_comp_sprite.visible = false

    $game_temp.lock_difficulty = difficulty

    minigame_init = Scene_LockpickMinigame.new

    minigame_init.main_variable

    minigame_init.main_sprite

    minigame_init.main_window

    minigame_init.main_audio

    minigame_init.main_transition

    loop do

      Graphics.update

      Input.update

      minigame_init.main_update

      @@temp = minigame_init.update

      if @@temp == "DONE" or @@temp == "NOTDONE"

        break

      end

      @@temp = nil

    end

    minigame_init.main_end

    minigame_init.main_dispose

    @recipe_list.visible = true

    @result_info.visible = true

    @result_comp.visible = true

    @result_window_sprite.visible = true

    @recipe_list_sprite.visible = true

    @result_info_sprite.visible = true

    @result_comp_sprite.visible = true

    minigame_init = nil

    return true if @@temp == "DONE" else false

  end

end

 

 

 

class Scene_LockpickMinigame < SDK::Scene_Base

  def update

    # game cancelled

    if Input.trigger?( Input::B )

      return "NOTDONE"

    end

    

    # Don't allow other input if animating

    if @lockpick_sprite.move?

      return

    end

    for i in 0...@pins.size

      if @pins[ i ].move?

        return

      end

    end

    

    # move the lockpick left or right

    if Input.trigger?( Input::RIGHT )

      @lockpick_sprite.move_right

      if not @lockpick_sprite.move?

        $game_system.se_play( $data_system.buzzer_se )

      end

    end

    if Input.trigger?( Input::LEFT )

      @lockpick_sprite.move_left

      if not @lockpick_sprite.move?

        $game_system.se_play( $data_system.buzzer_se )

      end

    end

    

    # knock a tumbler up - cascades

    if Input.trigger?( Input::UP )

      @pins[ @lockpick_sprite.position ].raise

      if @pins[ @lockpick_sprite.position ].move?

        $game_system.se_play( Tumbler::TUMBLER_AUDIO_UP )

        @lockpick_sprite.tap_up

        if @lockpick_sprite.position > 0 # first pin guaranteed no cascades

          @pins[ ( @lock_number * @lockpick_sprite.position ) %

            @pins.size ].raise

        end

        if $game_temp.lock_difficulty == LOCK_INSANE

          @pins[ ( @lock_number + @lockpick_sprite.position ) %

            @pins.size ].lower

        end

      else

        $game_system.se_play($data_system.buzzer_se)

      end

    end

    

    # knock a tumbler down - cascades

    if Input.trigger?( Input::DOWN )

      @pins[ @lockpick_sprite.position ].lower

      if @pins[ @lockpick_sprite.position ].move?

        $game_system.se_play( Tumbler::TUMBLER_AUDIO_DOWN )

        @lockpick_sprite.tap_down

        if @lockpick_sprite.position > 0 # first pin guaranteed no cascades

          @pins[ ( @lock_number * @lockpick_sprite.position ) %

            @pins.size ].lower

        end

        if $game_temp.lock_difficulty == LOCK_INSANE

          @pins[ ( @lock_number + @lockpick_sprite.position ) %

            @pins.size ].raise

        end

      else

        $game_system.se_play( $data_system.buzzer_se )

      end

    end

 

    # game finished, maybe

    if Input.trigger?( Input::C )

      unlockable = true

      for i in 0...@pins.size

        if not @pins[ i ].open?

          unlockable = false

          break

        end

      end

      if unlockable

        

        $game_system.se_play( LOCK_AUDIO_UNLOCK )

        return "DONE"        

      else

        $game_system.se_play( $data_system.buzzer_se )

      end

    end

  end

end

 


About battle system: Post it and I'll see it resorotation of MP/HP is possible.
 

Yin

Member

Thank you very much, you don't know how much I appreciate this. For the battle system, I am using.... Wait, let me get the link.

Here it goes.
http://punk.ohsk.net/forums/index.php?s ... c=588&st=0

Thanks again, I'm going to test it out now!

EDIT: It works perfectly! I haven't really played around with it much yet, but how would I make different items more difficult to make? If this is obvious, then just tell me to figure it out. I will eventually. :smile:

EDIT AGAIN: Ha ha ha! I didn't realize there was a difficulty option in the script you provided and when I copied my recipes, I overwrote the recipe options provided. Now I see the difficulty option. Thank you again!
 

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