Problem about applying a script

Timcampy

Villager
Member
Joined
Apr 1, 2013
Messages
14
Reaction score
0
First Language
French
Primarily Uses
Hi everyone!

This thread is created in order to solve this thread:

http://forums.rpgmakerweb.com/index.php?/topic/15915-help-removing-specific-slots-from-the-menu/

I would like to remove the selected parts in the following pictures, when using an object, because there's only one main character in my game.

Here it is:

When opening the menu, this appears (I added an item potion so that I can show you the parts I want to remove):



Then, when I press the C button (which stands for Enter for beginners reading this topic) while the cursor is on "Items", it highlights the first object in the list, like this (nothing new to remove):



And now, the interesting part. When I press again the C button, it selects the first object "Potion" and displays this, in order to allow me to choose on which character I'd like to use the potion (I don't want this to popup! It will be better if a choice would show for example "Use [item]? Yes/No ) :



and here is the script I'd like to use in order to do this:  

Class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y) # 160, 0
super(x, y, 384, 416)
@actor = $game_party.members[0]
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# Draw
# Actor name
# X Y Coordinates
draw_actor_name(@actor, 0, 0)
# Actor Class
# X Y Coordinates
draw_actor_class(@actor, 0, 120)
# Actor Face
# X Y Coordinates
draw_actor_face(@actor, 0, 24)
# Basic Info
# Include Level, state, HP and MP bar
# X Y Coordinates
draw_basic_info(160, 10)
# Parameters
# Include STR, AGI etc.
# X Y
draw_parameters(0, 140)
# Exp Info
# Include Current Exp and Exp needen for level
# X Y
draw_exp_info(170, 128)
# Equipments
# Sword, shield etc.
# X Y
draw_equipments(60, 240)
end
#--------------------------------------------------------------------------
# * Draw Basic Information
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_level(@actor, x, y + WLH * 0)
draw_actor_state(@actor, x, y + WLH * 1)
draw_actor_hp(@actor, x, y + WLH * 2)
draw_actor_mp(@actor, x, y + WLH * 3)
end
#--------------------------------------------------------------------------
# * Draw Parameters
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_parameters(x, y)
draw_actor_parameter(@actor, x, y + WLH * 0, 0)
draw_actor_parameter(@actor, x, y + WLH * 1, 1)
draw_actor_parameter(@actor, x, y + WLH * 2, 2)
draw_actor_parameter(@actor, x, y + WLH * 3, 3)
end
#--------------------------------------------------------------------------
# * Draw Experience Information
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = @actor.exp_s
s2 = @actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)
self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)
end
#--------------------------------------------------------------------------
# * Draw Equipment
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
for i in 0..4
draw_item_name(@actor.equips, x + 16, y + WLH * (i + 1))
end
end
end
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
#s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s5, s6]) #s4, s5, s6])
@command_window.index = @menu_index
if $game_party.members.size == 0 # If number of party members is 0
@command_window.draw_item(0, false) # Disable item
@command_window.draw_item(1, false) # Disable skill
@command_window.draw_item(2, false) # Disable equipment
# @command_window.draw_item(3, false) # Disable status
end
if $game_system.save_disabled # If save is forbidden
@command_window.draw_item(3, false) # Disable save
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input:: B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2 # Skill, equipment, status
start_actor_selection
when 3 # Save
$scene = Scene_File.new(true, false, false)
when 4 # End Game
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# * Start Actor Selection
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# * End Actor Selection
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input:: B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # skill
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
$scene = Scene_Equip.new(@status_window.index)
end
end
end
end
 

The problem is that when I try to apply it, a popup appears and tell me there are some errors, line 96 for example. I don't know how to fix it, and this is why I'm asking for your help. If you have a better idea than this one, feel free to explain me what to do and where, I'll try it.

 

I'll be away during one week, so I won't be able to read your answers. As soon as I'm back, I'll read it ;)

 

Thanks a lot and see you in one week!
 

Dark Paladin

Game Designer
Veteran
Joined
Jul 10, 2012
Messages
165
Reaction score
10
First Language
English
Primarily Uses
RMMV
Your script needs to go inside a code box to be properly formatted.



Once you put it in the code box then you can Highlight the entire code again and put it in a spoiler so it looks like this:

Class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y coordinate #-------------------------------------------------------------------------- def initialize(x, y) # 160, 0 super(x, y, 384, 416) @actor = $game_party.members[0] refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear # Draw # Actor name # X Y Coordinates draw_actor_name(@actor, 0, 0) # Actor Class # X Y Coordinates draw_actor_class(@actor, 0, 120) # Actor Face # X Y Coordinates draw_actor_face(@actor, 0, 24) # Basic Info # Include Level, state, HP and MP bar # X Y Coordinates draw_basic_info(160, 10) # Parameters # Include STR, AGI etc. # X Y draw_parameters(0, 140) # Exp Info # Include Current Exp and Exp needen for level # X Y draw_exp_info(170, 128) # Equipments # Sword, shield etc. # X Y draw_equipments(60, 240) end #-------------------------------------------------------------------------- # * Draw Basic Information # x : Draw spot X coordinate # y : Draw spot Y coordinate #-------------------------------------------------------------------------- def draw_basic_info(x, y) draw_actor_level(@actor, x, y + WLH * 0) draw_actor_state(@actor, x, y + WLH * 1) draw_actor_hp(@actor, x, y + WLH * 2) draw_actor_mp(@actor, x, y + WLH * 3) end #-------------------------------------------------------------------------- # * Draw Parameters # x : Draw spot X coordinate # y : Draw spot Y coordinate #-------------------------------------------------------------------------- def draw_parameters(x, y) draw_actor_parameter(@actor, x, y + WLH * 0, 0) draw_actor_parameter(@actor, x, y + WLH * 1, 1) draw_actor_parameter(@actor, x, y + WLH * 2, 2) draw_actor_parameter(@actor, x, y + WLH * 3, 3) end #-------------------------------------------------------------------------- # * Draw Experience Information # x : Draw spot X coordinate # y : Draw spot Y coordinate #-------------------------------------------------------------------------- def draw_exp_info(x, y) s1 = @actor.exp_s s2 = @actor.next_rest_exp_s s_next = sprintf(Vocab::ExpNext, Vocab::level) self.contents.font.color = system_color self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal) self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next) self.contents.font.color = normal_color self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2) self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2) end #-------------------------------------------------------------------------- # * Draw Equipment # x : Draw spot X coordinate # y : Draw spot Y coordinate #-------------------------------------------------------------------------- def draw_equipments(x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, Vocab::equip) for i in 0..4 draw_item_name(@actor.equips, x + 16, y + WLH * (i + 1)) end endendclass Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip #s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end @command_window = Window_Command.new(160, [s1, s2, s3, s5, s6]) #s4, s5, s6]) @command_window.index = @menu_index if $game_party.members.size == 0 # If number of party members is 0 @command_window.draw_item(0, false) # Disable item @command_window.draw_item(1, false) # Disable skill @command_window.draw_item(2, false) # Disable equipment # @command_window.draw_item(3, false) # Disable status end if $game_system.save_disabled # If save is forbidden @command_window.draw_item(3, false) # Disable save end end #-------------------------------------------------------------------------- # * Update Command Selection #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input:: Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 # Item $scene = Scene_Item.new when 1,2 # Skill, equipment, status start_actor_selection when 3 # Save $scene = Scene_File.new(true, false, false) when 4 # End Game $scene = Scene_End.new end endend #-------------------------------------------------------------------------- # * Start Actor Selection #-------------------------------------------------------------------------- def start_actor_selection @command_window.active = false @status_window.active = true if $game_party.last_actor_index < @status_window.item_max @status_window.index = $game_party.last_actor_index else @status_window.index = 0 end end #-------------------------------------------------------------------------- # * End Actor Selection #-------------------------------------------------------------------------- def end_actor_selection @command_window.active = true @status_window.active = false @status_window.index = -1 end #-------------------------------------------------------------------------- # * Update Actor Selection #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input:: Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when 1 # skill $scene = Scene_Skill.new(@status_window.index) when 2 # equipment $scene = Scene_Equip.new(@status_window.index) end end endend

This makes it much easier to read. 

Also that script you posted is broken and missing some ends and inputs. Not sure where you got the script but Try to copy and repaste it like I showed you above.

As for your question.. The things your wanting to change are not found in this script but in the base scripts that it draws from in rpg maker, Specifically:

Window_ItemList and Scene_ItemBase.

Lets look at Window_ItemList :

(This Snippet draws the Item name and Number)

#-------------------------------------------------------------------------- # * Draw Item #-------------------------------------------------------------------------- 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
If you comment out "draw_item_number" That should remove the quantity.

The actor status is a little more complicated.

Lets look at Scene_ItemBase :

When you press "OK" on an item it does This:

#-------------------------------------------------------------------------- # * Confirm Item #-------------------------------------------------------------------------- def determine_item if item.for_friend? show_sub_window(@actor_window) @actor_window.select_for_item(item) else use_item activate_item_window end end 
When you press "OK" on an Item this little snippet will check to see if the item is for a single character, all characters, or none. If it is for a single character or group it will open the submenu with the actor list and create the selection box. A quick fix to this is to comment out certain lines like this:

#-------------------------------------------------------------------------- # * Confirm Item #-------------------------------------------------------------------------- def determine_item#~ if item.for_friend?#~ show_sub_window(@actor_window)#~ @actor_window.select_for_item(item)#~ else use_item activate_item_window#~ end end
This will remove the submenu for actors and use the item immediately. With this though you have to make sure any items you use have the scope set to all actors or none(if it is an item set to a common event) even if you only have one actor in the party. If the scope is set to a single actor it will use the item but have no effect. There is no popup message or anything just the "Confirm" sound plays and the item is used. The other downside is that it will use the item whether you need it or not.

Alternatively you can bypass editing at all by setting your items scope to "None" and use  a common event to administer the effects you want when using the item. Doing this will not show the actor selection but again there is no confirm message. You can add a message with choice in the common event but this will close the item menu and you will have to make sure that if no is selected you add +1 of the item back to the inventory.

If you want a message shown and a confirm in the item scene the snippet will have to be changed to use a message box and a choice. I'll have some free time on the following weekend to look at it if no one has gotten to it by then. Hopefully this "quick fix" will work for you.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
If you go to your Items tab in the database, and change the scope of all these items to "The User", does that window still pop up?
 

Dark Paladin

Game Designer
Veteran
Joined
Jul 10, 2012
Messages
165
Reaction score
10
First Language
English
Primarily Uses
RMMV
If you go to your Items tab in the database, and change the scope of all these items to "The User", does that window still pop up?
"The User" scope is for the battle scene. You will still have to select if using from the menu.
 

Timcampy

Villager
Member
Joined
Apr 1, 2013
Messages
14
Reaction score
0
First Language
French
Primarily Uses
I'm back! :)

Your script needs to go inside a code box to be properly formatted.

Sorry I didn't know that. Indeed that's much more readable.

That was very well explained and easy to fix thank to you. Solved the problem in about 5 minutes. 


 If you want a message shown and a confirm in the item scene the snippet will have to be changed to use a message box and a choice. I'll have some free time on the following weekend to look at it if no one has gotten to it by then. Hopefully this "quick fix" will work for you.
That would help me a lot, (I don't know anything about scripting except a few things) but please don't waste your time on it if you can't find a solution, it's not very important.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top