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.

Need someone to turn an XP skill consuming items script into VX

Hey Guys,

There used to be a script for XP that would gray out skills if you didn't have the required items for it, such as for 'Alchemy' like skills. (One fire essence+gunpowder=bomb, etc)

The following is the old script, so maybe someone can convert it into VX format?

Code:
# Skills That Consume Items (Non-RTAB) v 1.00                      (08-19-2006)
# (Designed for the Default / Non-RTAB Battle System)
# Edited into working properly by DerVVulfman
#
# based on...
# Skills That Consume Items Ver 1.00a
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Set Skill Medium (Item(s) used by Skill)
  #--------------------------------------------------------------------------
  def medium(skill_id)
    case $data_skills[skill_id].name
    when "Molotov Cocktail"
      return [["Petrol"], ["Glass"]]
    when "Mega Bomb"
      return [["Nitro"], ["Brimstone"], ["Petrol"], ["Clay"]]
    when "Firestorm"
      return [["Brimstone"], ["Petrol"]]
    when "Snow Flurry"
      return [["Frost"], ["Bottled Wind"]]
    when "Electro-Shock"
      return [["Copper Wire"]]
    when "Greased Lightning"
      return [["Copper Wire"], ["Metal Rod"]]
    when "Poison Vial"
      return [["Venom"]]
    when "Shadow Flare"
      return [["Brimstone"], ["Obsidian"], ["Petrol"], ["Bottled Wind"]]
    when "Healing Spray"
      return [["Potion"]]
    when "Recovery Mist"
      return [["Hi-Potion"]]
    when "Hi-Phoenix"
      return [["Phoenix Down"]]
    when "Ultra Potion"
      return [["X-Potion"]]
    when "Antibody Burst"
      return [["Antidote"]]
    when "Esuna Wave"
      return [["Panacea"]]
    when "Mega Phoenix"
      return [["Phoenix Down", 2], ["Hi-Potion", 2]]
    when "Final Phoenix"
      return [["Phoenix Down", 3], ["X-Potion", 2]]
    when "Mighty Wall"
      return [["Fire Ball"], ["Ice Ball"], ["Bolt Ball"]]
    when "Energy Drink"
      return [["Caffeine"]]
    when "Auto Crossbow"
      return [["Bolt Case"]]
    when "Heal Ray"
      return [["Hi-Potion", 2]]
    when "Dum-Dum Ray"
      return [["Bolt Ball"]]
    when "Gasinator"
      return [["Poison Vial"]]
    when "Big Blinder"
      return [["Bolt Ball"]]
    when "TaserRod"
      return [["Bolt Ball"]]
    when "Flame Flinger"
      return [["Fire Ball"]]
    when "Ice Blaster"
      return [["Ice Ball"]]
    when "Net Tosser"
      return [["Net"]]
    when "F-Generator"
      return [["Tetra Ball"]]
    when "Grenade Thrower"
      return [["Mega Bomb"]]
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Get Item Name
  #--------------------------------------------------------------------------
  def item_name(name)
    for item in $data_items
      if item != nil and name == item.name
        return item.id
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Determine if Skill can be Used
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    items = medium(skill_id)
    if items
      for item in items
        id = item_name(item[0])
        if $game_party.item_number(id) < (item[1] == nil ? 1 : item[1])
          return false
        end
      end
    end
    return super
  end
end

#==============================================================================
# ** Scene_Battle (part 4)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Make Skill Action Results
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    @active_battler.sp -= @skill.sp_cost
    # Refresh status window
    @status_window.refresh
    # Show skill name on help window
    @help_window.set_text(@skill.name, 1)
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @skill.common_event_id
    # Set target battlers
    set_target_battlers(@skill.scope)
    # Apply skill effect
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
    # If item(s) are used
    if @active_battler.is_a?(Game_Actor)
      items = @active_battler.medium(@skill.id)
      if items
        for item in items
          id = @active_battler.item_name(item[0])
          num = item[1] == nil ? 1 : item[1]
          # Check if consumable              
          if $data_items[id].consumable
            $game_party.gain_item(id, -num)
          end
        end
      end
    end    
  end  
end  

#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
#  This class performs skill screen processing.
#==============================================================================

class Scene_Skill
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  def update_target
    # If B button was pressed
    
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Erase target window
      @skill_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If unable to use because SP ran out
      unless @actor.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If target is all
      if @target_window.index == -1
        # Apply skill use effects to entire party
        used = false
        for i in $game_party.actors
          used |= i.skill_effect(@actor, @skill)
        end
      end
      # If target is user
      if @target_window.index <= -2
        # Apply skill use effects to target actor
        target = $game_party.actors[@target_window.index + 10]
        used = target.skill_effect(@actor, @skill)
      end
      # If single target
      if @target_window.index >= 0
        # Apply skill use effects to target actor
        target = $game_party.actors[@target_window.index]
        used = target.skill_effect(@actor, @skill)
      end
      # If skill was used
      if used
        # If item(s) are used
        if @actor.is_a?(Game_Actor)
          items = @actor.medium(@skill.id)
          if items
            for item in items
              id = @actor.item_name(item[0])
              num = item[1] == nil ? 1 : item[1]
              # Check if consumable              
              if $data_items[id].consumable
                $game_party.gain_item(id, -num)
              end
            end
          end
        end
        # Play skill use SE
        $game_system.se_play(@skill.menu_se)
        # Use up SP
        @actor.sp -= @skill.sp_cost
        # Remake each window content
        @status_window.refresh
        @skill_window.refresh
        @target_window.refresh
        # If entire party is dead
        if $game_party.all_dead?
          # Switch to game over screen
          $scene = Scene_Gameover.new
          return
        end
        # If command event ID is valid
        if @skill.common_event_id > 0
          # Command event call reservation
          $game_temp.common_event_id = @skill.common_event_id
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      # If skill wasn't used
      unless used
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end

I've been looking for one for VX but I can't seem to locate one, so if someone could come up with one based on this script or convert this script, that would be great. This script is from one of my projects, so some of the changeable data has already been put in.
 

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