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.

Key Items script for VX? Also, footprints.

Alright, if any of you have played Final Fantasy 3 DS, you'll notice that in the items menu there is a seperate section for important items like the Fangs, the Wheel of Time and the like.

I was wondering if there is a script to recreate this in RPG Maker VX. Ideally, items would be defined as key items in the script itself.

I'd be really really REALLY grateful if someone could provide this.

EDIT: I've noticed there's a footprints charset, and I'd also like a script for showing foorprints when walking on sand, snow, etc.
 
I havn't played Final Fantasy 3 DS, but i think i know what you're looking for.
I think i made a Key Items script a while ago, although i'm not 100% sure where i have the demo with the script in it.
I'll look through my computer and give it to you when i find it, and then you can tell me if it's what you looked for. :thumb:

Over and out - Gando
 
Oh sorry, i forgot about this post :P
I made this script a loooong time ago, although i tested it really fast and it seams like it works.
You have to create a new element in the database and name it whatever you like, for example "Key_element".
and then you put the id of that element in "Key_Item_Element" at the top of the script.
So for every key item you which to have, you have to set them to this element.

Here is the script:
Code:
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================
Normal_Items = 'Items'
Key_Items    = 'Key Items'
Key_Item_Element = 1
class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @viewport = Viewport.new(0, 0, 544, 416)
    @help_window = Window_Help.new
    @empty_window_help = Empty_Window_Help.new
    @empty_window_help.z = 0
    @help_window.visible = false
    @help_window.viewport = @viewport
    # Item Window
    @item_window = Window_Item.new(0, 116, 544, 299)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.active = false
    #@item_window.index -= 1
    @target_window = Window_MenuStatus.new(0, 0)
    @command_two = Window_CustomCommand.new
    @command_two.z = 0
    @window_item_key = Window_Item_Key.new(0, 116, 544, 299)
    @window_item_key.help_window = @help_window
    @window_item_key.active = false
    @window_item_key.visible = false
    @window_item_key.z = 0
    hide_target_window
    default_active_false
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @viewport.dispose
    @help_window.dispose
    @empty_window_help.dispose
    @item_window.dispose
    @target_window.dispose
    @window_item_key.dispose
  end
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(0)
  end
  #--------------------------------------------------------------------------
  # * Update Frame
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @empty_window_help.update
    @item_window.update
    @target_window.update
    @command_two.update
    @window_item_key.update
    if @item_window.active
      update_item_selection
    elsif @window_item_key.active
      update_key_item_selection
    elsif @target_window.active
      update_target_selection
    elsif @command_two.active
      if Input.trigger?(Input::B)
        Sound.play_cancel
        return_scene 
      end
    end
    
    case @command_two.index
    when 0
      if Input.trigger?(Input::C) and @command_two.active
        Sound.play_decision
        @item_window.active = true
        @item_window.index = 0
        @command_two.active = false
        @empty_window_help.visible = false
        @help_window.visible = true
      end
      @item_window.visible = true
      @window_item_key.visible = false
    when 1
      if Input.trigger?(Input::C) and @command_two.active
        Sound.play_decision
        @window_item_key.active = true
        @window_item_key.index = 0
        @command_two.active = false
        @empty_window_help.visible = false
        @help_window.visible = true
      end
      @item_window.visible = false
      @window_item_key.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Update Item Selection
  #--------------------------------------------------------------------------
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
        @item_window.active = false
        @item_window.index = -1
        @command_two.active = true
        @empty_window_help.visible = true
        @help_window.visible = false
    elsif Input.trigger?(Input::C)
      @item = @item_window.item
      if @item != nil
        $game_party.last_item_id = @item.id
      end
      if $game_party.item_can_use?(@item)
        Sound.play_decision
        determine_item
      else
        Sound.play_buzzer
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Confirm Item
  #--------------------------------------------------------------------------
  def determine_item
    if @item.for_friend?
      show_target_window(@item_window.index % 2 == 0)
      if @item.for_all?
        @target_window.index = 99
      else
        if $game_party.last_target_index < @target_window.item_max
          @target_window.index = $game_party.last_target_index
        else
          @target_window.index = 0
        end
      end
    else
      use_item_nontarget
    end
  end
  #--------------------------------------------------------------------------
  # * Update Target Selection
  #--------------------------------------------------------------------------
  def update_target_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if $game_party.item_number(@item) == 0    # If item is used up
        @item_window.refresh                    # Recreate the window contents
        @window_item_key.refresh
      end
      hide_target_window
    elsif Input.trigger?(Input::C)
      if not $game_party.item_can_use?(@item)
        Sound.play_buzzer
      else
        determine_target
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Confirm Target
  #    If there is no effect (such as using a potion on an incapacitated
  #    character), play a buzzer SE.
  #--------------------------------------------------------------------------
  def determine_target
    used = false
    if @item.for_all?
      for target in $game_party.members
        target.item_effect(target, @item)
        used = true unless target.skipped
      end
    else
      $game_party.last_target_index = @target_window.index
      target = $game_party.members[@target_window.index]
      target.item_effect(target, @item)
      used = true unless target.skipped
    end
    if used
      use_item_nontarget
    else
      Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # * Show Target Window
  #     right : Right justification flag (if false, left justification)
  #--------------------------------------------------------------------------
  def show_target_window(right)
    width_remain = 544 - @target_window.width
    @target_window.x = right ? width_remain : 0
    @item_window.active = false
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, 416)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, 416)
      @viewport.ox = @target_window.width
    end
  end
  #--------------------------------------------------------------------------
  # * Hide Target Window
  #--------------------------------------------------------------------------
  def hide_target_window
    case @command_two.index
    when 1
      @window_item_key.active = true
    when 0
      @item_window.active = true
    end
    @target_window.visible = false
    @target_window.active = false
    @viewport.rect.set(0, 0, 544, 416)
    @viewport.ox = 0
  end
  #--------------------------------------------------------------------------
  # * Use Item (apply effects to non-ally targets)
  #--------------------------------------------------------------------------
  def use_item_nontarget
    Sound.play_use_item
    $game_party.consume_item(@item)
    @item_window.draw_item(@item_window.index)
    @window_item_key.draw_item(@window_item_key.index)
    @target_window.refresh
    if $game_party.all_dead?
      $scene = Scene_Gameover.new
    elsif @item.common_event_id > 0
      $game_temp.common_event_id = @item.common_event_id
      $scene = Scene_Map.new
    end
  end
 #=============================================================================
 #=============================================================================
 #=============================================================================
  #--------------------------------------------------------------------------
  # * Update Item Selection
  #--------------------------------------------------------------------------
  def update_key_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
        @window_item_key.active = false
        @window_item_key.index = -1
        @command_two.active = true
        @empty_window_help.visible = true
        @help_window.visible = false
    elsif Input.trigger?(Input::C)
      @item = @window_item_key.key_item
      if @item != nil
        $game_party.last_item_id = @item.id
      end
      if $game_party.item_can_use?(@item)
        Sound.play_decision
        determine_key_item
      else
        Sound.play_buzzer
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Confirm Item
  #--------------------------------------------------------------------------
  def determine_key_item
    if @item.for_friend?
      show_target_key_window(@window_item_key.index % 2 == 0)
      if @item.for_all?
        @target_window.index = 99
      else
        if $game_party.last_target_index < @target_window.item_max
          @target_window.index = $game_party.last_target_index
        else
          @target_window.index = 0
        end
      end
    else
      use_key_item_nontarget
    end
  end
  #--------------------------------------------------------------------------
  # * Update Target Selection
  #--------------------------------------------------------------------------
  def update_key_target_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if $game_party.item_number(@item) == 0    # If item is used up
        @window_item_key.refresh                # Recreate the window contents
      end
    elsif Input.trigger?(Input::C)
      if not $game_party.item_can_use?(@item)
        Sound.play_buzzer
      else
        determine_key_target
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Confirm Target
  #    If there is no effect (such as using a potion on an incapacitated
  #    character), play a buzzer SE.
  #--------------------------------------------------------------------------
  def determine_key_target
    used = false
    if @item.for_all?
      for target in $game_party.members
        target.item_effect(target, @item)
        used = true unless target.skipped
      end
    else
      $game_party.last_target_index = @target_window.index
      target = $game_party.members[@target_window.index]
      target.item_effect(target, @item)
      used = true unless target.skipped
    end
    if used
      use_key_item_nontarget
    else
      Sound.play_buzzer
    end
  end
  #--------------------------------------------------------------------------
  # * Show Target Window
  #     right : Right justification flag (if false, left justification)
  #--------------------------------------------------------------------------
  def show_target_key_window(right)
    @window_item_key.active = false
    width_remain = 544 - @target_window.width
    @target_window.x = right ? width_remain : 0
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, 416)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, 416)
      @viewport.ox = @target_window.width
    end
  end
  #--------------------------------------------------------------------------
  # * Use Item (apply effects to non-ally targets)
  #--------------------------------------------------------------------------
  def use_key_item_nontarget
    Sound.play_use_item
    $game_party.consume_item(@item)
    @window_item_key.draw_item(@window_item_key.index)
    @target_window.refresh
    if $game_party.all_dead?
      $scene = Scene_Gameover.new
    elsif @item.common_event_id > 0
      $game_temp.common_event_id = @item.common_event_id
      $scene = Scene_Map.new
    end
  end
   #--------------------------------------------------------------------------
  # * Hide Target Window
  #--------------------------------------------------------------------------
  def default_active_false
    @item_window.active = false
    @item_window.index = -1
    @window_item_key.active = false
    @window_item_key.index = -1
  end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item_Key < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x      : window x-coordinate
  #     y      : window y-coordinate
  #     width  : window width
  #     height : window height
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 2
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def key_item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Whether or not to include in item list
  #     item : item
  #--------------------------------------------------------------------------
  def include?(item)
    return false if item == nil
    if $game_temp.in_battle
      return false unless item.is_a?(RPG::Item)
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Whether or not to display in enabled state
  #     item : item
  #--------------------------------------------------------------------------
  def enable?(item)
    return $game_party.item_can_use?(item)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for key_item in $game_party.items
      next unless include?(key_item)
      @data.push(key_item) if key_item.element_set.include?(Key_Item_Element)
      if key_item.is_a?(RPG::Item) and key_item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    key_item = @data[index]
    if key_item != nil
      number = $game_party.item_number(key_item)
      enabled = enable?(key_item)
      rect.width -= 4
      draw_item_name(key_item, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(key_item == nil ? "" : key_item.description)
  end
end

#==============================================================================
# ** Empty_Window_Help
#------------------------------------------------------------------------------
#  This is an empty help window.
#==============================================================================
class Empty_Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 544, WLH + 32)
  end
end

#==============================================================================
# ** Window_PartyCommand
#------------------------------------------------------------------------------
#  This window is used to select whether to fight or escape on the battle
#  screen.
#==============================================================================

class Window_CustomCommand < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 54, 543, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 255
    @commands = [Normal_Items, Key_Items]
    @item_max = 2
    @column_max = 2
    draw_item(0, normal_color)
    draw_item(1, normal_color)
    self.active = true
    self.visible = true
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text character color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(160 + index * 160 + 4, 0, 128 - 10, 32)
    rectT = Rect.new(55 + index * 250 + 25, 0, 128 - 10, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rectT, @commands[index], 1)
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor
    self.cursor_rect.set(30 +index * 250, -5, 210, 40)
  end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for item in $game_party.items
      next unless include?(item)
      @data.push(item) unless item.element_set.include?(Key_Item_Element)
      if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
end

If you have any problems, don't hesitate to tell me! :thumb:

Over and out - Gando
 
The Wizard":2ukjz7od said:
I think someone made a footstep script on another forum.  I'll see if I can dig it up and will PM it to you if I remember where I found it.
Could you also PM it to me? It would make a great effect in my game
EDIT: Sorry if this was necro-posting...forgot to check the last post date... :dead:
 

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