Scripting help(Item Storage)

Started by LeviAlvi, September 12, 2013, 05:13:09 pm

Previous topic - Next topic

LeviAlvi

Hi. I used a storage script of GameGuy. I edited it and made it a borrow and return of books in a library(library system for short).

1. I just want to ask if it is possible that if you read a book in a library, the name of that book in the library system will change its color?



If yes, please help me out, this is the code:

#===============================================================================
# Item Storage
# Author game_guy
# Version 1.42
#-------------------------------------------------------------------------------
# Intro:
# Okay. Well if you've played the Elder Scrolls Series or Fallout then you'd
# know that it has an item storage system. What it does is lets you open up
# closets, chests, ect and store and take items out of it.
#
# Features:
# Store and Take Items Out of Chests, Closets, ect
# Have Seperate Chests, Closets, ect
# Easy to Use
# Stores Chests into Game System Instead of Variables
# Have Max Amount of Items In Chest
# Set Default Items in Chest
# Mark Items as "Key Items" to prevent removal from inventory (e.g. "Quest Items")
# Take All/Store All Items in Chest (Not built into scene)
#
# Instructions:
# First lets go over the syntaxes.
#
# Calling the Item Storage:
# $scene = Scene_Chest.new(chest_id, max_items)
# chest_id is the number chest you want open
# max_items is the max amount of any item the chest can hold
# you can just use this to
# $scene = Scene_Chest.new(chest_id)
# because in the config this ChestMaxItems is the default so if you dont use
# the long one, it'll use the default.
#
# New Syntaxes:
# You can now take all items from a chest and empty your entire inventory
# into a chest. While this isn't built into the scene, you'll have to do this
# through a script call.
# -Take All
#   chest = $game_system.chests(chest_id)
#   chest.take_all
# -Empty Inventory
#   chest = $game_system.chests(chest_id)
#   chest.empty_all
#
# You can now add/remove items to and from chests.
#   chest = $game_system.chests(chest_id)
#   chest.aaa_bbb(ccc, ddd)
#   aaa = add/take
#   bbb = item/weapon/armor
#   ccc = item/weapon/armor id
#   ddd = amount
#
# Okay so thats done with the syntaxes. Now onto the configuration.
# Go down to Begin Config and do all your configuration there.
#
# Credits:
# game_guy ~ for making it
# MightyLink ~ requesting the system
#===============================================================================
module GameGuy
  #============================================================================
  # KeyItemId       = Element ID for non removable items.
  #                   Items/weapons/armors with marked with this element
  #                   cannot be removed.
  #============================================================================
  KeyItemId         = 1
  #============================================================================
  # ChestMaxItems   = The max amount of any item a chest can hold. So example
  #                   Its 9999 so it can have 9999 of any item.
  #============================================================================
  ChestMaxItems     = 1
  def self.chest_items(id)
    case id
    #==========================================================================
    # Config Chest Items
    # Use this
    # when chest_id then return [[id, amount, type], [id, amount, type]]
    # id = item, weapon, or armor id
    # amount = the amount
    # type = 0, 1, or 2 0 = item, 1 = weapon, 2 = armor
    # Example:
    # when 1 then return [[1, 3, 0], [1, 1, 1]]
    # This has 3 potions, and 1 bronze sword. So when this is called
    # $scene = Scene_Chest.new(1)
    # it will have those items in the chest already.
    #==========================================================================
    when 1 then return [[1, 1, 0],[2, 1, 0], [3, 1, 0], [4, 1, 0], [5, 1, 0],
      [6, 1, 0], [7, 1, 0], [8, 1, 0],[9, 1, 0],[10, 1, 0],[11, 1, 0],[12, 1, 0],
      [13, 1, 0],[14, 1, 0],[15, 1, 0],[16, 1, 0],[17, 1, 0],[18, 1, 0],[19, 1, 0],
      [20, 1, 0],[21, 1, 0],[22, 1, 0],[23, 1, 0],[24, 1, 0],[25, 1, 0],[26, 1, 0],
      [27, 1, 0],[28, 1, 0],[29, 1, 0],[30, 1, 0],[31, 1, 0],[32, 1, 0],[33, 1, 0],
      [34, 1, 0],[35, 1, 0],[36, 1, 0],[37, 1, 0],[38, 1, 0],[39, 1, 0],[40, 1, 0],
      [41, 1, 0],[42, 1, 0],[43, 1, 0],[44, 1, 0],[45, 1, 0],[46, 1, 0],[47, 1, 0],
      [48, 1, 0],[49, 1, 0],[61, 1, 0],[62, 1, 0],[63, 1, 0],[64, 1, 0],[65, 1, 0],
      [66, 1, 0],[67, 1, 0],[68, 1, 0],[69, 1, 0],[70, 1, 0],[71, 1, 0],[72, 1, 0],
      [73, 1, 0],[74, 1, 0],[75, 1, 0],[76, 1, 0],[77, 1, 0],[78, 1, 0],[79, 1, 0],
      [80, 1, 0],[81, 1, 0],[82, 1, 0],[83, 1, 0],[84, 1, 0],[85, 1, 0],[86, 1, 0],
      [87, 1, 0],[88, 1, 0]]
     
     
    end
    return []
  end
end

#==============================================================================
# Game_System
#------------------------------------------------------------------------------
# Modded it so it makes it store every chest.
#==============================================================================
class Game_System
  alias gg_add_item_storage initialize
  def initialize
    @chests = []
    return gg_add_item_storage
  end
  def chests(n)
    if @chests[n] == nil
      @chests[n] = Game_Chest.new(GameGuy::ChestMaxItems)
      items = GameGuy.chest_items(n)
      for i in 0...items.size
        item = items[i][2]
        case item
        when 0
          @chests[n].add_item(items[i][0], items[i][1])
        when 1
          @chests[n].add_weapon(items[i][0], items[i][1])
        when 2
          @chests[n].add_armor(items[i][0], items[i][1])
        else
          @chests[n].add_item(items[i][0], items[i][1])
        end
      end
    end
    return @chests[n]
  end
end

#==============================================================================
# Game_Chest
#------------------------------------------------------------------------------
# Holds all the data for a single chest.
#==============================================================================
class Game_Chest
  attr_accessor :max
  def initialize(max = GameGuy::ChestMaxItems)
    @max = max
    @items = {}
    @weapons = {}
    @armors = {}
  end
  def item_amount(item_id)
    return @items.include?(item_id) ? @items[item_id] : 0
  end
  def weapon_amount(weapon_id)
    return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
  end
  def armor_amount(armor_id)
    return @armors.include?(armor_id) ? @armors[armor_id] : 0
  end
  def add_item(item_id, n)
    if item_id > 0
      @items[item_id] = [[item_amount(item_id) + n, 0].max, @max].min
    end
  end
  def add_weapon(weapon_id, n)
    if weapon_id > 0
      @weapons[weapon_id] = [[weapon_amount(weapon_id) + n, 0].max, @max].min
    end
  end
  def add_armor(armor_id, n)
    if armor_id > 0
      @armors[armor_id] = [[armor_amount(armor_id) + n, 0].max, @max].min
    end
  end
  def take_item(item_id, n)
    add_item(item_id, -n)
  end
  def take_weapon(weapon_id, n)
    add_weapon(weapon_id, -n)
  end
  def take_armor(armor_id, n)
    add_armor(armor_id, -n)
  end
  def empty_all
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        add_item(i, $game_party.item_number(i))
        $game_party.lose_item(i, $game_party.item_number(i))
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0
        add_weapon(i, $game_party.weapon_number(i))
        $game_party.lose_weapon(i, $game_party.weapon_number(i))
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0
       add_armor(i, $game_party.armor_number(i))
       $game_party.lose_armor(i, $game_party.armor_number(i))
      end
    end
  end
  def take_all
    for i in 1...$data_items.size
      if item_amount(i) > 0
        n = [99, ($game_party.item_number(i) - item_amount(i)).abs].min
        $game_party.gain_item(i, n)
        take_item(i, n)
      end
    end
    for i in 1...$data_weapons.size
      if weapon_amount(i) > 0
        n = [99, ($game_party.weapon_number(i) - weapon_amount(i)).abs].min
        $game_party.gain_weapon(i, n)
        take_weapon(i, n)
      end
    end
    for i in 1...$data_armors.size
      if armor_amount(i) > 0
         n = [99, ($game_party.armor_number(i) - armor_amount(i)).abs].min
        $game_party.gain_armor(i, n)
        take_armor(i, n)
      end
    end
  end
end

#==============================================================================
# Window_Chest_Choices
#------------------------------------------------------------------------------
# The choices for the chest when the scene is opened.
#==============================================================================
class Window_Chest_Choices < Window_Selectable
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item_max = 3
    @column_max = 3
    @commands = ["Return Book","Borrow Book","Exit"]
    self.z = 200
    refresh
    self.index = 0
  end
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  def draw_item(index)
    x = 4 + index * 215
    self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
  end
end

#==============================================================================
# Window_Chest_Item
#------------------------------------------------------------------------------
# Displays all items in the chest.
#==============================================================================
class Window_Chest_Item < Window_Selectable
  def initialize(chest)
    super(320, 64, 320, 416)
    @chest = chest
    @column_max = 1
    refresh
    self.index = 0
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if @chest.item_amount(i) > 0
        @data.push($data_items[i])
      end
    end
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if @chest.weapon_amount(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if @chest.armor_amount(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    self.contents.font.color = normal_color
    if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Item)
      if item.element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    else
      if item.guard_element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    end
    case item
    when RPG::Item
      number = @chest.item_amount(item.id)
    when RPG::Weapon
      number = @chest.weapon_amount(item.id)
    when RPG::Armor
      number = @chest.armor_amount(item.id)
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 216, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#==============================================================================
# Window_Party_Item
#------------------------------------------------------------------------------
# Displays all items the party has.
#==============================================================================
class Window_Party_Item < Window_Selectable
  def initialize
    super(0, 64, 320, 416)
    @column_max = 1
    refresh
    self.index = 0
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  def item
    return @data[self.index]
  end
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  def draw_item(index)
    item = @data[index]
    self.contents.font.color = normal_color
    if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Item)
      if item.element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    else
      if item.guard_element_set.include?(GameGuy::KeyItemId)
        self.contents.font.color = disabled_color
      end
    end
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 216, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 224, y, 48, 32, number.to_s, 2)
  end
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

#==============================================================================
# Scene_Chest
#------------------------------------------------------------------------------
# The scene that controls storing and taking items.
#==============================================================================
class Scene_Chest2
  def initialize(chest=1, max=GameGuy::ChestMaxItems)
    @chestid = chest
    @chest = $game_system.chests(@chestid)
  end
  def main
    @help_window = Window_Help.new
    @help_window.visible = false
    @command_window = Window_Chest_Choices.new
    @party_window = Window_Party_Item.new
    @party_window.active = false
    @chest_window = Window_Chest_Item.new(@chest)
    @chest_window.active = false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    @help_window.dispose
    @command_window.dispose
    @party_window.dispose
    @chest_window.dispose
  end
  def update
    @help_window.update
    @command_window.update
    @party_window.update
    @chest_window.update
    if @command_window.active
      update_command
      return
    end
    if @party_window.active
      update_party
      return
    end
    if @chest_window.active
      update_chest
      return
    end
  end
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        @party_window.active = true
        @party_window.help_window = @help_window
        @command_window.active = false
        @help_window.z = 500
        @help_window.visible = true
      when 1
        if $game_variables[50] == 5
          return
        else
        $game_system.se_play($data_system.decision_se)
        @chest_window.active = true
        @chest_window.help_window = @help_window
        @command_window.active = false
        @help_window.z = 500
        @help_window.visible = true
        end
      when 2
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      end
      return
    end
  end
  def update_party
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @help_window.visible = false
      @party_window.help_window = nil
      @party_window.active = false
      return
    end
    if Input.repeat?(Input::C)
      @item = @party_window.item
      unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or
             @item.is_a?(RPG::Armor)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if @item.element_set.include?(GameGuy::KeyItemId)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @item
      when RPG::Item
        amount = @chest.item_amount(@item.id)
        if amount < @chest.max
          $game_system.se_play($data_system.decision_se)
          @chest.add_item(@item.id, 1)
          $game_party.lose_item(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Weapon
        amount = @chest.weapon_amount(@item.id)
        if amount < @chest.max
          $game_system.se_play($data_system.decision_se)
          @chest.add_weapon(@item.id, 1)
          $game_party.lose_weapon(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Armor
        amount = @chest.armor_amount(@item.id)
        if amount < @chest.max
          $game_system.se_play($data_system.decision_se)
          @chest.add_armor(@item.id, 1)
          $game_party.lose_armor(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end
      @party_window.refresh
      @chest_window.refresh
      $game_variables[50] -= 1
      $game_variables[49] += 1
      $scene = Scene_Map.new
     
      return
    end
  end
  def update_chest
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @help_window.visible = false
      @chest_window.help_window = nil
      @chest_window.active = false
      return
    end
    if Input.repeat?(Input::C)
      @item = @chest_window.item
      unless @item.is_a?(RPG::Item) or @item.is_a?(RPG::Weapon) or
             @item.is_a?(RPG::Armor)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @item
      when RPG::Item
        amount = $game_party.item_number(@item.id)
        if amount < 99
          $game_system.se_play($data_system.decision_se)
          @chest.take_item(@item.id, 1)
          $game_party.gain_item(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Weapon
        amount = $game_party.weapon_number(@item.id)
        if amount < 99
          $game_system.se_play($data_system.decision_se)
          @chest.take_weapon(@item.id, 1)
          $game_party.gain_weapon(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Armor
        amount = $game_party.armor_number(@item.id)
        if amount < 99
          $game_system.se_play($data_system.decision_se)
          @chest.take_armor(@item.id, 1)
          $game_party.gain_armor(@item.id, 1)
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end
      @party_window.refresh
      @chest_window.refresh
      $game_variables[48] += 1
      $game_variables[50] += 1
      $scene = Scene_Map.new
      return
    end
  end
end



2. Can you help me disable and change the color of the name of the borrow books if my variable is = 5?
the code is just the same as above.

I have the code for the limitation of borrowing. it's in line 498, 569, 570, 626, 627



Help is much appreciated
Spoiler: ShowHide
hahahahaha

KK20

I'm not sure about changing the color of a read book. That would mean each book needs a switch stored somewhere that the storage script can access. Also, because I think you're using F0's script, you will need to edit that so every time you open a new book, you turn that book's switch on.

I can easily do the other request. Will do tomorrow.

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!

LeviAlvi

ohh thanks. I thought of that too. that I will use so many switches for that. I will wai for the script :)
Spoiler: ShowHide
hahahahaha

PhoenixFire

Levi, the only thing I could think of that might make it a 'little' easier, would be use variables instead, in a Boolean fashion..

0=unread
anything else = read

If
variable x = 0
book color = red
Else
book color = green
End


(Obviously that's a really simple version in psuedocode, but then again, I'm not a Ruby scripter... I just know that's how I would first tackle the problem)


So, translate that into Script, and that would give you a dynamic way to use events in game to change the variable that each book reads from, using in game events, and then have the script read the values of the variables..


@KK20 - Do you think that would be a simple way to do it, if there's a specified number of books? Say he has 20, and that will never change...?
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

LeviAlvi

September 13, 2013, 11:34:17 pm #4 Last Edit: September 14, 2013, 12:05:13 am by LeviAlvi
@DigitalSoul I'll try that in variables. but I'm not sure if I can do this   :^_^':

I think using variables is easier than switch.

Edit: I don't have much time so I cant do this.  :(
Spoiler: ShowHide
hahahahaha

KK20

@DigitalSoul: ShowHide
I don't see how variables would make things any easier. You would still need one variable to represent each book, which is no different than needing one switch each. (Then of course, there is binary representation, but that's absolutely unnecessary and not worth it to explain...)

The way how I would do it is make a new attr_accessor hash/array variable in Game_Party that stores booleans at each book's id.
# Which would look something like this:
[false, false, true, true, false, true]
# States that books 3, 4, and 6 have been read

Then it's a matter of making a simple check:

if $game_party.books_read[id]   # if the player read this book...
 self.contents.font.color = # i dunno... green?
else
 self.contents.font.color = # i guess this will be white?
end

You will just have to add this bit to whatever script handles the actual reading of the books:

unless $game_party.books_read[ID] #<== replacing ID with whatever variable that book-reading script uses
 $game_party.books_read[ID] = true
end


@LeviAlvi: ShowHide

Under Window_Chest_Choices, replace draw_item with this

  def draw_item(index)
    x = 4 + index * 215
    if index == 1 and $game_variables[50] >= 5
      self.contents.font.color = Color.new(255, 0, 0)
    else
      self.contents.font.color = normal_color
    end
    self.contents.draw_text(x, 0, 128, 32, @commands[index], 1)
  end

Also, I have some questions:
1.) Why did you rename the class Scene_Chest to Scene_Chest2?
2.) Do you really want the scene to close as soon as you borrow/return one book?
3.) When switching back to the map, do you want a transition in between (like the default fade-in/out)?

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!

PhoenixFire

KK20, I think I follow what you're saying. I understand binary values, and an array would make more sense.. To be honest, I'm not a scripter here, so I'm using my knowledge of other languages to try to make sense of how the scripting works. So as silly as I may ound when I reply to some of the topics, I apologize, as I am still learning.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

LeviAlvi

Quote
Also, I have some questions:
1.) Why did you rename the class Scene_Chest to Scene_Chest2?
2.) Do you really want the scene to close as soon as you borrow/return one book?
3.) When switching back to the map, do you want a transition in between (like the default fade-in/out)?


1. I'm playing with the script so I forgot to return it to normal
2. I don't really like to close it after borrowing or returning a book but when I don't close it, the player can borrow so many books. I'll pm you the link for my game. It's not updated much though.
3. Yes. I would really love to.

I'm not good at making scripts because I don't have much resources so I'm just editing scripts as best as I can :)
Spoiler: ShowHide
hahahahaha

KK20

@Digital:
No need to feel apologetic--I am quite well aware that you are still learning scripting. It's actually good that you are suggesting ideas (because now I can lecture to you and hopefully inspire you). Especially in the world of programming, asking questions is really the only way to get better. Keep at it :)

@Levi:
I can probably do that for you. It's not terribly difficult actually.

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!

LeviAlvi

@KK20 - my brother suggested that when I read a book in a library, the icon of the book will change.

is that possible in script or event command?
Spoiler: ShowHide
hahahahaha

PhoenixFire

Quote from: LeviAlvi on September 16, 2013, 12:22:08 am
is that possible in script or event command?


Oh, I can answer the event part.. As far as I know, no, there's no way to do that through events, however, I think you might be able to do something with a script. If I remember correctly, the rxdata file stores the path to the icon image, so in theory, if you can access that, you should be able to change it. Now, I could be wrong on that, but that would be the most logical solution.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

KK20

Actually, you can change the icon via a script call, albeit only temporarily (as soon as you load a new game or start a new one, the change is lost). If you were to save these icon changes and make the appropriate script calls every time the game loads up, problem solved.

Of course, the most practical way would be to not rely on the item's icon graphic in the database when drawing it in the window. Again, you would need an array that keeps track of the books the player has read.

if $game_party.books_read[id]
  bitmap = RPG::Cache.icon('book_read_icon')
else
  bitmap = RPG::Cache.icon('book_not_read_icon')
end
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)

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!