#===============================================================================
# First Use Item Replacement [v1.0] for RPG Maker VX Ace
# By ARIOSODEV
#===============================================================================
# USAGE RIGHTS & CREDITS
# You are not required by any means to provide credit for using my script(s)
# in your project. You are also free to edit and modify my scripts for any
# purpose.
#
# I would love to hear about your game though!!
#===============================================================================
# HOW TO USE?
# Firstly, you're going to want to create 2 versions of an item.
# - Before First Use
# - After First Use
#
# In the notes of the Before item, make sure to add this:
# <hidden item: A+B>
#
# Replace "A" with: ID of the Switch used to check for this item
# Replace "B" with: ID of the After item
#
# Once you've done that, you can now use this Script call:
# give_hidden_item(C, D)
#
# Replace "C" with: ID of the Before item
# Replace "D" with: Amount you want to give to the player.
#
# NOTE 1: If an Undiscovered item ID is not used, it will act like a normal
# "Change Items" event.
# NOTE 2: If you want to take away items from the player, simply make "D" a
# negative number.
#===============================================================================
# ADDITIONAL SUGGESTIONS
# I would personally recommend creating a Common Event tied to the Before
# items so that you can display a message for the player! I recommend these
# events:
#
# > Show Text [ ... ]
# > Script [ SceneManager.call(Scene_Item) ]
#
# You can add onto this if you wish!
#===============================================================================
#===============================================================================
# They told me to tell you not to edit the code past this point. So, uh...
#===============================================================================
class Game_Party < Game_Unit
def consume_item(item)
lose_item(item, 1) if item.is_a?(RPG::Item) && item.consumable
if item.hidden_item != 0
item_count = item_number(item)
lose_item(item, item_count)
gain_item($data_items[item.hidden_newitem], item_count)
$game_switches[item.hidden_item] = true
#Audio.se_stop
#SceneManager.call(Scene_Item)
end
end
def gain_hidden_item(item, amount, include_equip = false)
$game_variables[2] = item
$game_variables[3] = item.hidden_newitem
if item.hidden_item != 0 && $game_switches[item.hidden_item]
gain_item($data_items[item.hidden_newitem], amount)
else
container = item_container(item.class)
return unless container
last_number = item_number(item)
new_number = last_number + amount
container[item.id] = [[new_number, 0].max, max_item_number(item)].min
container.delete(item.id) if container[item.id] == 0
if include_equip && new_number < 0
discard_members_equip(item, -new_number)
end
$game_map.need_refresh = true
end
end
end
class Game_Interpreter
def give_hidden_item(item, amount)
$game_party.gain_hidden_item($data_items[item], amount)
end
end
module ARIOSODEV
module HIDE
HIDDEN_ITEM = /<hidden item:[ ]*(\d+)[+](\d+)>/i
end
end
module DataManager
class <<self; alias load_database_ari load_database; end
def self.load_database
load_database_ari
load_notetags_ari
end
def self.load_notetags_ari
groups = [$data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_ari
end
end
end
end
class RPG::UsableItem < RPG::BaseItem
attr_accessor :hidden_item
attr_accessor :hidden_newitem
def load_notetags_ari
@hidden_item = 0
@hidden_newitem = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when ARIOSODEV::HIDE::HIDDEN_ITEM
@hidden_item = $1.to_i
@hidden_newitem = $2.to_i
end
} # self.note.split
#---
end
end