Jump to content
Sign in to follow this  
Meep007

Change Item Desciption

Recommended Posts

This script seems to fix my others issues, but it causes an old issue that Shiggy's script fixed to come back.

 

It counts every line written in the script as a line in the description. For example, since I can't fit much on one line:

 

$data_items[23].description = "This strange
gem was given to me by my father when I was
young."

 

This cuts off the "young" since the description box in-game fits only 2 lines. "This strange" is also the only thing that shows on the first line. It looks really weird. Writing it like this however:

 

 

Would there be a way to get them to work together?

Edited by Meep007

Share this post


Link to post
Share on other sites

Is there any reason why  old text item can't be removed and replaced with new text item using change / remove item events?

Share this post


Link to post
Share on other sites

Is there any reason why  old text item can't be removed and replaced with new text item using change / remove item events?

 

Now you suggest it,I suppose I simply don't like simple solutions

 

@Meep Also you can still use NewDescriptions::String1 to call the string

Edited by Shiggy
  • Like 1

Share this post


Link to post
Share on other sites

@Allied G

 

That would also take up more space. What if I had like 50 items that changed descriptions throughout my game...i'd have like a ton of items in my database. :mellow:

I do plan on using this for more than one quest in the future...

 

@Shiggy

 

I used this to change the description with the script.

 

i = $data_items[23]
i.description = " This strange gem was given
to me by my father when I was young. It is
my curse"
CustomData.update_item(i)

 

So if I used yours in between, it would still update it?

 

EDIT: Nope, I guess that was too good to be true. It just keeps the newer description if I do that.

I might have to suck it up and do what AlliedG suggested. I have an idea for something else though...I'll try that first.

 

Yep, thought so. I just wrote the script call wrong. :P

It seems to work right now! :D *jumps for joy*

 

Ugh, nevermind...when I loaded a new game the old one was there. :(

Edited by Meep007

Share this post


Link to post
Share on other sites

$data_items[23].description takes a string as an argument.
String is just stuff between "  " like this : "stuff" 
So you can either have this
$data_items[23].description =  " This strange gem was given to me by my father when I was young. It ismy curse"
or if you don't have enough space you store your string in a variable
 
string = This strange gem was given to me by my father when I was young. It ismy curse"
$data_items[23].description = string
 
The problem is what is called variable range ,you can't access any variable from anywhere in the program
 
thus this
 

Use this script

 module NewDescriptions
String1 = " This strange gem was given to me by my father when I was young. "
end
and use this command 
$data_items[23].description = NewDescriptions::String1

to store the string in a place where it's accesible

 

If it doesn't work send me screenshots of your events or send me your project

Edited by Shiggy

Share this post


Link to post
Share on other sites

If I were to suggest, create a new variable from RPG::Item that can set for the description number, then create a hash for each item. If you want to change the description of the item, then you just need to change the value of the item's description number and take the key value from the hash.

Share this post


Link to post
Share on other sites

If knew what any of that meant or how to do it, I'd probably do that. :P

 

I think I'll just do what AlliedG suggested. That would any of us further headaches.

 

Thanks for the help everyone. It was a long painful ride, mostly for Shiggy I'll bet. :mellow:

 

This topic can close now. For good this time. ^_^

  • Like 1

Share this post


Link to post
Share on other sites

But this is interesting. I will try to do a quick concept later. You know, making cloned items is not really a good thing, its a lot of pain.

  • Like 1

Share this post


Link to post
Share on other sites

Oh, okay then... :P

 

I know it's a pain and my database will be overflown, but everything else doesn't seem to work right.

 

If you think you have a better idea then, I'll at least attempt it.

Share this post


Link to post
Share on other sites

This should do it.

 

 

 

#==============================================================================
# 
# â–¼ SOUL_VXA Description Changer
# -- Author: Soulpour777
# -- Date Created: 1 / 24 / 2016
# -- Level: Super Easy
# -- Requires: n/a
# 
#==============================================================================
#==============================================================================
# â–¼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script allows you to change the description of items, weapons and armors
# in game. Be reminded that this script will not use your item description from
# the description box anymore. All description should be done in this script.
#==============================================================================
# â–¼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below â–¼ Materials/ç´ æ but above â–¼ Main. Remember to save. If
# you are using a saved game, you might want to start a new game if you are 
# going to use this script. If you insist using your saved file, it is advisable
# that you change all the descriptions of all your existing items in game.
#==============================================================================
# â–¼ Script Calls
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# If you want to change the description of an item, do this on a script call:
# change_item_desc(item_id, desc_key)
# where item_id is the item's id and desc_key the description number from the
# array you want to use. Please read the Notes area for this.
#
# If you want to change the description of an weapon, do this on a script call:
# change_weapon_desc(item_id, desc_key)
# where item_id is the weapons's id and desc_key the description number from the
# array you want to use. Please read the Notes area for this.
#
# If you want to change the description of an armor, do this on a script call:
# change_armor_desc(item_id, desc_key)
# where item_id is the weapons's id and desc_key the description number from the
# array you want to use. Please read the Notes area for this.
# 
#==============================================================================
# â–¼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is compatible to any existing scripts, except something that has
# to do with the item, weapon and armor scene. If so, please place this script
# below all of those to avoid errors.
#==============================================================================
# â–¼ Terms of Use
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Feel free to use for Commercial and Non Commercial Uses. All I ask is my name
# on your credits.
#==============================================================================

module Soul
  module ItemDescription
    # Proper Description for all items
      # Note: the descriptions is an array. So if you placed your desc_number
      # for the item as 0, then that's the first on all the description.
      # [description, description, description] 
      # In this part, numbering starts with 0. So by putting your item
      # as desc_number to 0, then the first on the description list would
      # be used.    
    Items = {
      # Reminder: Put commas for each!
      
      0 => [], # do not erase this
      # item id => descriptions
      
      # Item #1
      1 => ["A healing potion.", "A potion that can heal all wounds.",
      "This potion was stolen by Ralph."],
      
      # Item #2
      2 => ["A very powerful healing potion.", 
      "This is a purchased potion.",
      "This potion was stolen by Benett."]      
    }
    # Proper Description for all weapons
    Weapons = {
      # Reminder: Put commas for each!
      0 => [], # do not erase this
      # weapon id => descriptions
      1 => ["A great wielding ax.", "An axe that is used for war.",
      "This ax was stolen by Ulrika."]      
    }
    # Proper Description for all armors
    Armors = {
      # Reminder: Put commas for each!
      # armor id => descriptions
      0 => [], # do not erase this
      1 => ["A magnificent armor.", "An armor that breaks the wind.",
      "This is a stuffy armor."]      
    }    
  end
end

class Window_Help < Window_Base
  include Soul::ItemDescription
  def set_item(item)
    if (item != nil)
      if item.is_a?(RPG::Weapon)
        set_text(item ? Weapons.values[item.id][item.desc_number] : "")
      end
      if item.is_a?(RPG::Item)
        set_text(item ? Items.values[item.id][item.desc_number] : "")
      end
      if item.is_a?(RPG::Armor)
        set_text(item ? Armors.values[item.id][item.desc_number] : "")
      end      
    else 
      set_text(item ? item.description : "")
    end
  end
end


class RPG::UsableItem < RPG::BaseItem
  def initialize
    super
    @scope = 0
    @occasion = 0
    @speed = 0
    @success_rate = 100
    @repeats = 1
    @tp_gain = 0
    @hit_type = 0
    @animation_id = 0
    @damage = RPG::UsableItem::Damage.new
    @effects = []
    @desc_number = 0
  end

end

class RPG::EquipItem < RPG::BaseItem
  def initialize
    super
    @price = 0
    @etype_id = 0
    @params = [0] * 8
    @desc_number = 0
  end
  attr_accessor :price
  attr_accessor :etype_id
  attr_accessor :params
  attr_accessor :desc_number
end

class RPG::Item < RPG::UsableItem
  # creates a description number, but in retrospect, this is still nil.
  # so we need to change it after getting the item.
  def desc_number
    return @desc_number
  end
  # this is the actual change of description number.
  def change_desc(value)
    @desc_number = value
  end
end

class RPG::Weapon < RPG::EquipItem
  # creates a description number, but in retrospect, this is still nil.
  # so we need to change it after getting the weapon.
  def desc_number
    return @desc_number
  end
  # this is the actual change of description number.
  def change_desc(value)
    @desc_number = value
  end
end

class RPG::Armor < RPG::EquipItem
  # creates a description number, but in retrospect, this is still nil.
  # so we need to change it after getting the armor.
  def desc_number
    return @desc_number
  end
  # this is the actual change of description number.
  def change_desc(value)
    @desc_number = value
  end
end

# if you have the item, retain description, if not, change to 0.
module BattleManager
  def self.gain_drop_items
    $game_troop.make_drop_items.each do |item|
      if $game_party.has_item?(item, true)
        $game_party.gain_item(item, 1)
      else
        item.change_desc(0)
        $game_party.gain_item(item, 1)
      end
      $game_message.add(sprintf(Vocab::ObtainItem, item.name))
    end
    wait_for_message
  end
end


class Game_Interpreter

  # shortcut if you want to change description manually
  def change_item_desc(item_id, desc_key)
    $data_items[item_id].change_desc(desc_key)
  end
  
  # shortcut if you want to change description manually
  def change_weapon_desc(item_id, desc_key)
    $data_weapons[item_id].change_desc(desc_key)
  end
  
  # shortcut if you want to change description manually
  def change_armor_desc(item_id, desc_key)
    $data_armors[item_id].change_desc(desc_key)
  end
  
  # if player has item, weapon or armor, don't bother, but if not, change
  # the description quickly to 0.
  def command_126
    value = operate_value(@params[1], @params[2], @params[3])
    $data_items[@params[0]].change_desc(0) if !$game_party.has_item?(@params[0], true)
    $game_party.gain_item($data_items[@params[0]], value)
  end
  
  def command_127
    value = operate_value(@params[1], @params[2], @params[3])
    $data_weapons[@params[0]].change_desc(0) if !$game_party.has_item?(@params[0], true)
    $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
  end
  #--------------------------------------------------------------------------
  # ◠防具ã®å¢—減
  #--------------------------------------------------------------------------
  def command_128
    value = operate_value(@params[1], @params[2], @params[3])
    $data_armors[@params[0]].change_desc(0) if !$game_party.has_item?(@params[0], true)
    $game_party.gain_item($data_armors[@params[0]], value, @params[4])
  end  
end
 

 

 

 

The script will be able to change the description of your items, armors and weapons. Be reminded that since I overwritten the entire description, your description box is useless now, all description should be on the description list on the script.

 

Your description by default is not defined, so when you receive an item, you should be able to change the description you want. From this:

 

XsEkFQc.jpg

 

to this:

 

XsEkFQc.jpg

 

You can do a script call if you want to change the description of the item.

 

hyo9Wm4.jpg

 

When you gain an item from battle, if you have the item, retain description, if not, description returns to 0.

Edited by Soulpour777
  • Like 1

Share this post


Link to post
Share on other sites

Works perfect now! YAH HOO~

 

This can most definitely close this time, I swear. :D

Share this post


Link to post
Share on other sites

*runs back to topic* Are you sure? VERY VERY SURE???? ;)

 

....closing :D

  • Like 1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted