SCRIPT HELP

Posts

Pages: 1
Hey there I need some help with a script I was messing around trying to see if i could get rid of some things for a game I am trying to make and I need to get it back because I figured out a way to work with them but I am not sure how to get them back could someone help me please??



Where it says:
def_draw_item(index)
item= @data(index)
if item
rect = item_rect(index)
rect.witdt-= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
draw_item_number(rect, item)

I think there is more to that and i would like what goes after that there's this:



The notes, key items, and memories.

Thank you ^^
Marrend
Guardian of the Description Thread
21781
There's a bit of criss-crossing functionality here, actually! Let's delve into it a bit.

class Window_ItemCategory < Window_HorzCommand
  def make_command_list
    add_command(Vocab::item,     :item)
    add_command(Vocab::weapon,   :weapon)
    add_command(Vocab::armor,    :armor)
    add_command(Vocab::key_item, :key_item)
  end
end

class Window_ItemList < Window_Selectable
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enable?(item))
      draw_item_number(rect, item)
    end
  end
end

class Scene_Item < Scene_ItemBase
  def create_category_window
    @category_window = Window_ItemCategory.new
    @category_window.viewport = @viewport
    @category_window.help_window = @help_window
    @category_window.y = @help_window.height
    @category_window.set_handler(:ok,     method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
  end

  def create_item_window
    wy = @category_window.y + @category_window.height
    wh = Graphics.height - wy
    @item_window = Window_ItemList.new(0, wy, Graphics.width, wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:on_item_cancel))
    @category_window.item_window = @item_window
  end

  def on_category_ok
    @item_window.activate
    @item_window.select_last
  end
end

That's the default functionality, above. Note how the Window_ItemCategory.make_command_list function uses the same symbols/values as the Window_ItemList.include? function. I think that might be how they link the two things together, and why what items that fall under the category chosen through Window_ItemCategory show up in Window_ItemList.

Also, unless you've done something that you're not showing, the values of Vocab::notes, Vocab::key_items (THIS IS DIFFERENT THAN Vocab::key_item!!!!), or Vocab::memories are undefined/nil. Which produces an error about nil not being able to convert to string, or some-such. I hate those errors!

*Edit: What, exactly, are you trying to do with this? Or are you just derping around?
I'm trying the menu so it looks like this:



but instead says this
items key items notes memories
Marrend
Guardian of the Description Thread
21781
Hrm. From that screen shot, my guess is that the text "Notes" and "Inventory" are pulled from the Vocab module. Probably re-flavors of "Key Items" and "Items" in some way, shape, or form. The text "Data" and "Leave" feel hard-coded, as the options there are... probably different. Like, I figure "Data" leads into Scene_Save or Scene_Load in some way. As for "Leave", that probably exists the menu entirely, and returns to regular gameplay.

How that translates to your issue, I don't actually know. Though, the query that comes to mind is if you're using this script, or something like it?
now that i kind of have that fixed its saying there is something wrong with
script game_actor & nameerror occured
uninitialized object::game_battler
Marrend
Guardian of the Description Thread
21781
Game_Battler is the parent class of Game_Actor. That means any functions that Game_Battler has, Game_Actor has as well. So, if you're trying to do something in Game_Actor that Game_Battler is doing, you can go ahead and use that function.

Though, it might also help to know about where this function-call to "object::game_battler" is to understand the context of the error message. Depending on the intent (ie: what you want to happen), I may make a better suggestion.
i got that fixed, something happened when i was fixing things and the scripts got deleted thank you for the help ^^
ehhh okay one more thing I'm exactly sure how to fix this. I have tried copying and pasting like I have with others that has fixed the problem its saying that there's a nameerror on line 7 in scene_battle for scene_baseis there something I'm not seeing or??




Also is there a place I can change these name to something else??

where it says like airship and boat and ship
Marrend
Guardian of the Description Thread
21781
Screenshot1: The best way I can explain that is, since Scene_Battle is a child of Scene_Base, Scene_Base has to be defined (ie: above) Scene_Battle in the script editor.

Screenshot2: To be honest, I'm not even sure if it's possible to change those labels! Even if you did, that would not necessarily change their functionality. A "boat" will still act like a "boat", and so on.
Pages: 1