Name input for items instead of actor?

Hi!

Does anyone know if it's possible to bring up name input for items instead of actor?
It'd be really useful to have a method for it, for example in order to let the players name their own weapons and potions as a part of a crafting system.
I used a workaround in MV.
Script command: var nameBackup = $gameActors.actor(1)._name;
Actor name input command
Then handle what you need in crafting system
$gameActors.actor(1)._name = nameBackup;

If you want to have it even easier, create a dummy Actor in the database that you will never use in game, just for the purposes of naming. That way you won't have to worry about backing up his name.

Btw. In VXAce it's not $gameActors.actor(), but surely someone that knows VXAce more than me should be able to tell you the VXAce equation.
You can use temporary actor for the name, let's say it's Actor ID 6, and let's say that the Item ID that you want to rename is 2, after Name Input Processing use script call:
$data_items[2].name = $game_actors[6].name
But remember by doing this you've changed all Item ID 2 name.
Change $data_items to $data_weapons or $data_armors depending on what you need.
Hi, hi!

Thank you so much, both. I'm really amazed by the community on this forum, there's always someone to rescue me. 😢
I like this idea. I'll try to remember it.
You can use temporary actor for the name, let's say it's Actor ID 6, and let's say that the Item ID that you want to rename is 2, after Name Input Processing use script call:

But remember by doing this you've changed all Item ID 2 name.
Change $data_items to $data_weapons or $data_armors depending on what you need.
But if you reset the game, the name will be reverted as well 😛
But if you reset the game, the name will be reverted as well 😛
Oh my! You're right, TheoAllen. That is a nice observation, but also a problem. 😐

Is there any way to prevent the name from being reverted after a reset?
But if you reset the game, the name will be reverted as well 😛
Whoops, you were right. Forgot that the items won't be saved :blush:
In order to save the name, it need to be stored to the game class that is included in save file.
Install this script:
module DataManager
class << self
alias :dhoom_itemname_dataman_load_game_without_rescue :load_game_without_rescue
end

def self.load_game_without_rescue(index)
result = dhoom_itemname_dataman_load_game_without_rescue(index)
$game_party.load_item_names if result
return result
end
end

class Game_Party
attr_accessor :item_names, :weapon_names, :armor_names
alias :dhoom_itemname_gmparty_initialize :initialize
def initialize
dhoom_itemname_gmparty_initialize
load_item_names
end

def load_item_names
@item_names ||= {}
@weapon_names ||= {}
@armor_names ||= {}
@item_names.each do |i, name|
$data_items.name = name
end
@weapon_names.each do |i, name|
$data_weapons.name = name
end
@armor_names.each do |i, name|
$data_armors.name = name
end
end
end
And change the script call to this:
$game_party.weapon_names[WEAPONID] = $game_actors[ACTORID].name
$game_party.load_item_names
Change $game_party.weapon_names to $game_party.item_names or $game_party.armor_names depending on what you need.
Whoops, you were right. Forgot that the items won't be saved :blush:
In order to save the name, it need to be stored to the game class that is included in save file.
Install this script:

And change the script call to this:

Change $game_party.weapon_names to $game_party.item_names or $game_party.armor_names depending on what you need.
Please excuse me for asking the possibly obvious, but where should I install the script? I tried putting it below "Materials" in the "Script Editor", but I recieve the following error message during the script call:

"Script 'Game_Interpreter' line 1411: NoMethodError occured.

undefined method 'name=' for #<Array:0xe4c32a0>"

Do you know what I might've done wrong?
Yes, just install it in the Script Editor above Main.

And for the script call, make sure to change the WEAPONID and ACTORID. Let's say I want to change the Weapon 5 name, and I use Actor 6 for Name Input Processing, the script call will be:
$game_party.weapon_names[5] = $game_actors[6].name
$game_party.load_item_names
Yes, just install it in the Script Editor above Main.

And for the script call, make sure to change the WEAPONID and ACTORID. Let's say I want to change the Weapon 5 name, and I use Actor 6 for Name Input Processing, the script call will be:
I tried testing it with a new game project. Here's what I did:

I've uploaded four images:

Example 1.png Example 2.png Example 3.png Example 4.png
s!AqY_2PLBNMWi3jj3GnM4OXXHwBAE


By looking at the example images, can you see anything wrong?
Just remove the leading zero, so the script call will be like this:
$game_party.weapon_names[1] = $game_actors[12].name
$game_party.load_item_names
Just remove the leading zero, so the script call will be like this:
I tried doing so, but I'm still getting the error. ;_;

Have you tried testing it?
Whoops, for some reason the code got change when I posted it. Should've use code tag instead of quote lol.
Code:
module DataManager
  class << self
    alias :dhoom_itemname_dataman_load_game_without_rescue :load_game_without_rescue
  end

  def self.load_game_without_rescue(index)
    result = dhoom_itemname_dataman_load_game_without_rescue(index)
    $game_party.load_item_names if result
    return result
  end
end

class Game_Party
  attr_accessor :item_names, :weapon_names, :armor_names
  alias :dhoom_itemname_gmparty_initialize :initialize
  def initialize
    dhoom_itemname_gmparty_initialize
    load_item_names
  end

  def load_item_names
    @item_names ||= {}
    @weapon_names ||= {}
    @armor_names ||= {}
    @item_names.each do |i, name|
      $data_items[i].name = name
    end
    @weapon_names.each do |i, name|
      $data_weapons[i].name = name
    end
    @armor_names.each do |i, name|
      $data_armors[i].name = name
    end
  end
end
Whoops, for some reason the code got change when I posted it. Should've use code tag instead of quote lol.
Code:
module DataManager
  class << self
    alias :dhoom_itemname_dataman_load_game_without_rescue :load_game_without_rescue
  end

  def self.load_game_without_rescue(index)
    result = dhoom_itemname_dataman_load_game_without_rescue(index)
    $game_party.load_item_names if result
    return result
  end
end

class Game_Party
  attr_accessor :item_names, :weapon_names, :armor_names
  alias :dhoom_itemname_gmparty_initialize :initialize
  def initialize
    dhoom_itemname_gmparty_initialize
    load_item_names
  end

  def load_item_names
    @item_names ||= {}
    @weapon_names ||= {}
    @armor_names ||= {}
    @item_names.each do |i, name|
      $data_items[i].name = name
    end
    @weapon_names.each do |i, name|
      $data_weapons[i].name = name
    end
    @armor_names.each do |i, name|
      $data_armors[i].name = name
    end
  end
end
Thank you so much, it works perfectly now. #TearsofJoy 😢
Just one small part was missing.
It works like this
Spoiler: Change item names
Code:
#===============================================================================
# Item Name Change
# By: DrDhoom
#-------------------------------------------------------------------------------
# Want to change item names? This is your solution
#===============================================================================
# Usage would be in script call, write
# $game_party.weapon_names[WEAPONID] = $game_actors[ACTORID].name
# $game_party.load_item_names
#
# Do this after calling a rename character command for an actor that you have
# in the database which will only be used for name changes.
# A good method would be to set the name to nothing before name input
# Change $game_party.weapon_names to $game_party.item_names or
# $game_party.armor_names depending on what you need
# e.g.
# $game_party.weapon_names[5] = $game_actors[11].name
#===============================================================================

module DataManager
  class << self
  alias :dhoom_itemname_dataman_load_game_without_rescue :load_game_without_rescue
  end

  def self.load_game_without_rescue(index)
    result = dhoom_itemname_dataman_load_game_without_rescue(index)
    $game_party.load_item_names if result
    return result
  end
end

class Game_Party
  attr_accessor :item_names, :weapon_names, :armor_names
  alias :dhoom_itemname_gmparty_initialize :initialize
  def initialize
    dhoom_itemname_gmparty_initialize
    load_item_names
  end

 
  def load_item_names
    @item_names ||= {}
    @weapon_names ||= {}
    @armor_names ||= {}
    @item_names.each do |i, name|
    $data_items[i].name = name
    end
    @weapon_names.each do |i, name|
    $data_weapons[i].name = name
    end
    @armor_names.each do |i, name|
    $data_armors[i].name = name
    end
  end
end

*EDIT ninja'd
Just one small part was missing.
It works like this
Spoiler: Change item names
Code:
#===============================================================================
# Item Name Change
# By: DrDhoom
#-------------------------------------------------------------------------------
# Want to change item names? This is your solution
#===============================================================================
# Usage would be in script call, write
# $game_party.weapon_names[WEAPONID] = $game_actors[ACTORID].name
# $game_party.load_item_names
#
# Do this after calling a rename character command for an actor that you have
# in the database which will only be used for name changes.
# A good method would be to set the name to nothing before name input
# Change $game_party.weapon_names to $game_party.item_names or
# $game_party.armor_names depending on what you need
# e.g.
# $game_party.weapon_names[5] = $game_actors[11].name
#===============================================================================

module DataManager
  class << self
  alias :dhoom_itemname_dataman_load_game_without_rescue :load_game_without_rescue
  end

  def self.load_game_without_rescue(index)
    result = dhoom_itemname_dataman_load_game_without_rescue(index)
    $game_party.load_item_names if result
    return result
  end
end

class Game_Party
  attr_accessor :item_names, :weapon_names, :armor_names
  alias :dhoom_itemname_gmparty_initialize :initialize
  def initialize
    dhoom_itemname_gmparty_initialize
    load_item_names
  end

  def load_item_names
    @item_names ||= {}
    @weapon_names ||= {}
    @armor_names ||= {}
    @item_names.each do |i, name|
    $data_items.name = name
    end
    @weapon_names.each do |i, name|
    $data_weapons.name = name
    end
    @armor_names.each do |i, name|
    $data_armors.name = name
    end
  end
end

*EDIT ninja'd
Just need to update the code to the one that I've posted recently 😛
Although this appears to be almost finished, I'm still going to move it in case anyone else has a similar request in the future. If it's in the right section they are more likely to find it.

Moderator note: Moving this to RGSS3 Script Requests.

@Johnnyboyish When you're sure that everything is working okay, just Report your opening post and ask for it to be closed.
Thanks.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/name-input-for-items-instead-of-actor.93599/