Main Menu
  • Welcome to The RPG Maker Resource Kit.

Using an Actors Name in and Item Script ~ Tested

Started by Tsunokiette, September 26, 2006, 09:37:16 PM

0 Members and 1 Guest are viewing this topic.

Tsunokiette

Replace your Window_Item with the following script -

*forget it*
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

thingy

omg I love you, almost all of my characters names are changed when you meet them (cept one cuz he looks cool so I'm giving him a cool name)
Zypher, Veltonvelton, and Dalton are secretly having a homosexual affair in hidden messages just like this one
research shows Fu is also involved, but not in a gross and creepy way

Naphe

~Banned~

Tsunokiette

#3
Minor error realized, don't use this version. Will update with version 2 VERY soon.

EDIT : Forget it, the dang thing doesn't want to work. It keeps doing weird stuff, it won't even let me use the $game_actors class. I tried many different ways, but none worked, it always errored at the Game_Actors class.

The following is written off the top of my head, I did something similar to it but it didn't work. BTW: I tried the gsub method, but I kept getting errors.

text = item.name
temp = text.split(/ /)
for i in 0..(temp.size)
if temp[i].include?('[') and temp[i].include?(']')
temp[i].delete!('[')
temp[i].delete!(']')
values = 0
for j in 'a'...'z'
if !temp[i].include?(j)
values += 1
end
end
if values == 26
temp[i] = $game_actors[temp[i].to_i - 1].name
end
end
end
text = ''
for j in 0..(temp.size)
text = text + ' ' + temp[j]
end
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Tsunokiette

I seriously need help, it keeps telling me there's no method " name". It doesn't matter what class I use, $data_actors or $game_actors. I even defined a name method, and it gives me the same crap.

  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    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
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    text = item.name
    text.gsub!(/\[([0-9]+)\]/) { $data_actors[$1.to_i - 1].name }
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 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, text, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

Winged

it sounded interesting....maybe bliz can help?

~Winged



thingy

Zypher, Veltonvelton, and Dalton are secretly having a homosexual affair in hidden messages just like this one
research shows Fu is also involved, but not in a gross and creepy way

Blizzard

*copies the code* I can´t right now, but I´ll tell you tomorrow if I succeeded with something.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

thingy

Zypher, Veltonvelton, and Dalton are secretly having a homosexual affair in hidden messages just like this one
research shows Fu is also involved, but not in a gross and creepy way

Blizzard

Okay, since I know Tsuno will add me into the credits of this script no matter what even if I only changed one line, I also added the same support for item/weapon/armor descriptions. Just use \n[X] where X is the ID of the character in the database. You can use it in Item names AND descriptions.

#==============================================================================
# Window_Item
#==============================================================================

class Window_Item < Window_Selectable

  def draw_item(index)
    item = @data[index]
    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
    if item.is_a?(RPG::Item) and
       $game_party.item_can_use?(item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    text = item.name
    text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
      $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 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, text, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
 
end

#==============================================================================
# Window_Help
#==============================================================================

class Window_Help < Window_Base
 
  alias set_text_playername_later set_text
  def set_text(text)
    text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
      $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
    end
    set_text_playername_later(text)
  end
 
end

Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

thingy

description works, doesn't work for the name tho
Zypher, Veltonvelton, and Dalton are secretly having a homosexual affair in hidden messages just like this one
research shows Fu is also involved, but not in a gross and creepy way

Blizzard

?_? It worked for me. Can somebody else test it?
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!


Naphe

Just wondering if you can some how make this a little bit better. I was wondering if you could make it so you could also show item and skill names by \i[X] and \s[X] commands.
~Banned~

Blizzard

That's for a message system while this is supposed to be used directly in names and description. I think Dubealex' AMS might support such commands like \i[X] and \s[X], but I can't tell for sure.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.



Get DropBox, the best free file syncing service there is!

Naphe

Well, if you could check for me, it would be most appreciated. I tried to edit the script myself, but to no avail.
~Banned~

Sthrattoff

Well, well, well...
It works on me with one 'condition' :
Need open the Item window first.
Then it's appear on the Equip screen...
Else...
It shows "\n[1]" on the Window_Help.
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%