The Witch's House menu script

HanaderaNoah

Villager
Member
Joined
Jan 4, 2017
Messages
10
Reaction score
2
First Language
Vietnamese
Hi. I'm a newbie and I'm not very good at scripting. I just saw a script that makes the menu looks like the famous horror The Witch House. But something wrong, when I try to open the key item window I get this crash :

Script 'Window_Base' line 549: NoMethodError occured. undefined method 'icon_index' for #<Array:0x8c26ef8

It directs me to this line in the script editor Window_Base 549 draw_icon(item.icon_index, x, y, enabled)

When I have no items in inventory it shows up empty window. Works fine. But when I try to open the same window when having a item this happens...
Code:
=begin
#==============================================================================
# ** Menu á la Majo no Ie
# ** By: SoulPour777
#------------------------------------------------------------------------------
# This script configures the menu and the item to be compatible for making
# good horror games.
#
# Features:
- Item Numbers have been ommited in the Key Items.
- The Menu is designed a la Witch's House / Majo no Ie
- Only contains Items and Load
- The item description has been fixed.
#==============================================================================

=end
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
alias start_new_command start
def start
super
create_command_window
create_status_window
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
alias create_command_window_majo_no_ie create_command_window
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:load, method(:command_load))
@command_window.set_handler(:cancel, method(:return_scene))
end

def command_load
SceneManager.call(Scene_Load)
end

end

class Window_MenuCommand < Window_Command

alias majo_no_ie_initialize initialize
def initialize
super(18, 310)
select_last
end
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
add_original_commands
end
#--------------------------------------------------------------------------
# * Add Main Commands to List
#--------------------------------------------------------------------------
def add_main_commands
add_command(Vocab::item, :item, main_commands_enabled)
add_command("Load", :load, main_commands_enabled)
end
end

class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :pending_index # Pending position (for formation)
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(160, 280, window_width, window_height)
@pending_index = -1
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
alias soul_window_width window_width
def window_width
return 340
end
#--------------------------------------------------------------------------
# * Get Window Height
#--------------------------------------------------------------------------
alias soul_window_height window_height
def window_height
return 130
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
return 1
end
end

class Window_Base < Window

alias majo_no_ie_draw_actor_level draw_actor_level
def draw_actor_level(actor, x, y)
change_color(system_color)
draw_text(x, y, 32, line_height, "Age")
change_color(normal_color)
draw_text(x + 32, y, 24, line_height, actor.level, 2)
end

alias majo_no_ie_draw_actor_simple_status draw_actor_simple_status
def draw_actor_simple_status(actor, x, y)
draw_actor_name(actor, x, y)
draw_actor_level(actor, x, y + line_height * 1)
draw_actor_hp(actor, 60 + 120, y + line_height * 1)
end

end
#------------------------------------------------
# Removes the Item Number or Count
#------------------------------------------------
class Window_ItemList < Window_Selectable
def draw_item(index)
item = @data
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
end
end
end

class Window_Command < Window_Selectable
def initialize(x, y)
clear_command_list
make_command_list
super(x, y + 10, 130, window_height)
refresh
select(0)
activate
end
end

class Scene_Item < Scene_ItemBase
def start
super
create_help_window
create_item_window
end
def create_item_window

@help_window.x = 68
@help_window.width = 415
wy = @help_window.height
wh = Graphics.height - wy
item_position = 67
@item_window = Window_ItemList.new(item_position, wy, Graphics.height, 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(:return_scene))
@item_window.category = :item
# ^ change to :key_item if you want to use key items instead
@item_window.select_last
@item_window.activate
end
end
I will be vere appreciated if someone can figure out the problem for me. And sorry for my bad English
 

Reapergurl

Drummer Extraordinaire! xD
Veteran
Joined
Dec 15, 2016
Messages
534
Reaction score
552
First Language
British English
Primarily Uses
Other
As far as I can tell, Key Items are not supported in this script by default.

Perhaps one of our script experts, like @Trihan can bring this into light a bit more.

What is odd to me is that there is a Load feature, but no Save feature... :yswt2:
 

Anomaly

coffee.empty? ? refill_coffee : drink_coffee
Veteran
Joined
Jan 19, 2016
Messages
61
Reaction score
302
First Language
[US] English
Primarily Uses
RMVXA
@Steven Tran It's a pretty simple fix. On this line:

item = @data

add this to it -> [index]

The silly goose who wrote this script forgot to get the index of the item in the array.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
What Kazama said. It's trying to get the icon_index of an entire array, rather than a specific element of it. Good catch.
 

HanaderaNoah

Villager
Member
Joined
Jan 4, 2017
Messages
10
Reaction score
2
First Language
Vietnamese
@Steven Tran It's a pretty simple fix. On this line:

item = @data

add this to it -> [index]

The silly goose who wrote this script forgot to get the index of the item in the array.
Thank you. I added the line but now it has a different problem
Script 'Window_Base' line 127: NoMethodError occured. undefined method 'draw_item_name' for #>Window_ItemList.0xa285fb4>
I never though a script could have so much errors in it. How can I fix this problem
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
That's kind of a weird one, because Window_ItemList certainly does have a draw_item_name method. Are you using any other scripts?
 

HanaderaNoah

Villager
Member
Joined
Jan 4, 2017
Messages
10
Reaction score
2
First Language
Vietnamese
That's kind of a weird one, because Window_ItemList certainly does have a draw_item_name method. Are you using any other scripts?
No. I just use this script and Khas's Awesome Light Effects script with Galv's Use Item on Event. That's all!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
Does it still give you the error without the light effects and use item scripts?

I fixed the script from the OP by changing line 123 to item = @data[index] and it works, so you may have accidentally deleted something or made a mistake when fixing it. Can you please post the script as it is now?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
[move]RGSSx Script Support[/move]
 

HanaderaNoah

Villager
Member
Joined
Jan 4, 2017
Messages
10
Reaction score
2
First Language
Vietnamese
It worked now. I just found out I delete an important line in Window_Base script. And sorry, I will make sure to post my threads in the correct forum next time.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top