Empty Containers for Stromtronics CMS/Blizz ABS

Started by Xim, January 08, 2015, 12:51:21 am

Previous topic - Next topic

Xim

January 08, 2015, 12:51:21 am Last Edit: January 24, 2015, 01:47:54 am by Xim
I have a script that automatically gives you an item after using another item, so I can have it so you obtain an empty potion container afterwards. But it's not compatible with Stormtronics CMS by Blizzard. I guess I could use another item system, but I really feel like my game needs to have the "quest items" organization available. So even if I had a simple item script that allowed me to configure "quest items" that I could use with Stormtronics and allow me to use this pre-existing script that'd be awesome. I'll at least try not to be too picky. :^_^':

Here is my script it was made by a guy with the appropriate screen name "Brewmeister" on RPG Revolution (when it was still a website).
#=====================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs item screen processing.
#
#  Modified to replace "IN_VIAL" items with an empty vial (VIAL_ITEM)
#  Or "IN_MUG" items with an empty vial (MUG_ITEM)
#  Or "IN_BOWL" items with an empty vial (BOWL_ITEM)
#==============================================================================

class Scene_Item
 IN_VIAL = [1,2,3,4,5,6,7,8,11] # ID's for Items that give you an empty vial
 VIAL_ITEM = 35 # The vial item ID
 IN_MUG = [] # ID's for Items that give you an empty mug
 MUG_ITEM = 36 # The mug item ID
 IN_BOWL = [] # ID's for Items that give you an empty bowl
 BOWL_ITEM = 37 # The bowl item ID
 #--------------------------------------------------------------------------
 # * 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)
 # If unable to use because items ran out
 unless $game_party.item_can_use?(@item.id)
# Remake item window contents
@item_window.refresh
 end
 # Erase target window
 @item_window.active = true
 @target_window.visible = false
 @target_window.active = false
 return
end
# If C button was pressed
if Input.trigger?(Input::C)
 # If items are used up
 if $game_party.item_number(@item.id) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
 end
 # If target is all
 if @target_window.index == -1
# Apply item effects to entire party
used = false
for i in $game_party.actors
 used |= i.item_effect(@item)
end
 end
 # If single target
 if @target_window.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
 end
 # If an item was used
 if used
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
 # Decrease used items by 1
 $game_party.lose_item(@item.id, 1)
     if IN_VIAL.include?(@item.id) # ADDED
$game_party.gain_item(VIAL_ITEM, 1) # ADDED
@item_window.refresh # ADDED
   else  # ADDED
         if IN_MUG.include?(@item.id) # ADDED
         $game_party.gain_item(MUG_ITEM, 1) # ADDED
         @item_window.refresh # ADDED
         else  # ADDED
             if IN_BOWL.include?(@item.id) # ADDED
             $game_party.gain_item(BOWL_ITEM, 1) # ADDED
             @item_window.refresh # ADDED
             else  # ADDED
             # Redraw item window item   # Indented
             @item_window.draw_item(@item_window.index)  # Indented
             end
         # Redraw item window item   # Indented
         @item_window.draw_item(@item_window.index)  # Indented
         end
# Redraw item window item   # Indented
@item_window.draw_item(@item_window.index)  # Indented
 end   # ADDED
end
# Remake target window contents
@target_window.refresh
# If all party members are dead
if $game_party.all_dead?
 # Switch to game over screen
 $scene = Scene_Gameover.new
 return
end
# If common event ID is valid
if @item.common_event_id > 0
 # Common event call reservation
 $game_temp.common_event_id = @item.common_event_id
 # Switch to map screen
 $scene = Scene_Map.new
 return
end
 end
 # If item wasn't used
 unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
 end
 return
end
 end
end


Thanks in advance!

KK20

Place below Blizz-ABS and delete the old code.

class Game_Battler
  IN_VIAL = [1,2,3,4,5,6,7,8,11] # ID's for Items that give you an empty vial
  VIAL_ITEM = 35 # The vial item ID
  IN_MUG = [] # ID's for Items that give you an empty mug
  MUG_ITEM = 36 # The mug item ID
  IN_BOWL = [] # ID's for Items that give you an empty bowl
  BOWL_ITEM = 37 # The bowl item ID
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  alias empty_container_addon item_effect
  def item_effect(item)
    if $game_temp.frame_of_item_use != Graphics.frame_count
      $game_temp.frame_of_item_use = Graphics.frame_count
      if IN_VIAL.include?(item.id)
        $game_party.gain_item(VIAL_ITEM, 1)
      elsif IN_MUG.include?(item.id)
        $game_party.gain_item(MUG_ITEM, 1)
      elsif IN_BOWL.include?(item.id)
        $game_party.gain_item(BOWL_ITEM, 1)
      end
    end
    empty_container_addon(item)
  end
end

class Game_Temp
  attr_accessor :frame_of_item_use
 
  alias init_for_empty_container initialize
  def initialize
    init_for_empty_container
    @frame_of_item_use = 0
  end
end

class Scene_Menu
  def update_item_target
    if Input.trigger?(Input::B)
      del_target
      $game_system.se_play($data_system.cancel_se)
      @target_index = -1
      @items_window1.refresh unless $game_party.item_can_use?(@item.id)
      @items_window1.active = true
    elsif Input.trigger?(Input::C)
      if $game_party.item_number(@item.id) == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @target_windows[0].index == -2
        used = false
        $game_party.actors.each {|actor| used |= actor.item_effect(@item)}
      elsif @target_index >= 0
        used = $game_party.actors[@target_index].item_effect(@item)
      end
      if used
        $game_system.se_play(@item.menu_se)
        if @item.consumable
          $game_party.lose_item(@item.id, 1)
          @items_window1.refresh
          @items_window1.draw_item(@items_window1.index)
        end
        (@status_windows + @target_windows).each {|win| win.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
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    else
      update_target
    end
  end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Xim