PokeMenu Update!

Started by Blizzy April 21st, 2005 6:13 AM
  • 2835 views
  • 23 replies

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
ok, here's a update for people who are using my menu!
instead of switches, it now uses a global variable
(a variable which can be acces everywhere)
it saves 3 switches, what a relief :P

ok, now for the script, just overwrite it with scene menu:
#=================================
#  Scene_Menu
#------------------------------------------------------------------
#=================================
class Scene_Menu
#-----------------------------------------------------------------
#menu_index 
#-----------------------------------------------------------------
def initialize(menu_index = 0)
 @menu_index = menu_index
end

#--------------------------------------------------------------------------
def main
 s1 = "Bag"
 s2 = " "
 s3 = "Save"
 s4 = "Options"
 s5 = "Exit"
 s6 = "Pokemon"
 s7 = "Pokedex"
 commands = [s1,s2,s3,s4,s5]
 y = 100
 if $menu == 1
 commands = [s1,s2,s3,s4,s5]
 y = 100
 end
 if $menu == 2
   commands = [s6, s1, s2, s3, s4, s5]
   y = 80
 end
 if $menu == 3
  commands = [s7, s6,s1, s2, s3, s4, s5]
  y = 60
end
 if $game_system.save_disabled
   commands.delete!("Save")
 end

 @commands = Window_Command.new(160, commands)
 @commands.index = @menu_index
 @commands.x = 560 - @commands.width / 2
 @commands.y = y
 if $game_party.actors.size == 0
   @command_window.disable_item(0)
   @command_window.disable_item(1)
   @command_window.disable_item(2)
   @command_window.disable_item(3)
 end
 @spriteset = Spriteset_Map.new
 @heroname = Window_Heroname.new
 @playtime_window = Window_PlayTime.new
 @playtime_window.x = 0
 @playtime_window.y = 0
 
 Graphics.transition
 loop do
   Graphics.update
   Input.update
   update
   if $scene != self
     break
   end
 end 
 Graphics.freeze
 @heroname.dispose
 @commands.dispose
 @playtime_window.dispose
 @spriteset.dispose
end

#--------------------------------------------------------------------------
def update
 @heroname.update
 @commands.update
 @playtime_window.update
 @spriteset.update
 if @commands.active
   update_command
   return
 end
end
#--------------------------------------------------------------------------
def update_command
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
     return
   end
   if Input.trigger?(Input::C)
    if $game_party.actors.size == 0 and @commands.index < 4
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    case @commands.commands[@commands.index]
    when "Bag"
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Item.new
    when " "
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Map.new
    when "Save"
      if $game_system.save_disabled
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Save.new
    when "Options"
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Map.new
    when  "Exit"
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Map.new            
    when "Pokemon"
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Map.new
    when  "Pokedex"
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Map.new
    end # of case
  end # of conditional
end # of method
#--------------------------------------------------------------------------
end # of Scene_Menu class definition

class Window_Heroname < Window_Base


def initialize
  super(0, 0, 640,480)
  self.opacity = 0
  self.back_opacity = 0
  self.contents = Bitmap.new(width-32, height-32)
  self.contents.font.name = "Comic Sans MS"  
  self.contents.font.size = 28
  self.contents.font.color = text_color(8)
  refresh
end

def refresh
 for i in 0...$game_party.actors.size
   actor = $game_party.actors[i]
   x = i * 200 + 484
   if $menu == 1
     y = 132
   end
   if $menu == 2
     y = 144
   end
   if $menu == 3
     y = 156
   end
   self.contents.draw_text(x, y, 200, 32, actor.name)
 end # of for loop
end # of method

end # of class
Window_Command
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
#  一般的なコマンド選択を行うウィンドウです。
#==============================================================================

class Window_Command < Window_Selectable
  attr_reader  :commands
  #--------------------------------------------------------------------------
  # ● def initialize
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    # コマンドの個数からウィンドウの高さを算出
    super(0, 0, width, commands.size * 32 + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in [email protected]_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # ● draw item
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end
  #--------------------------------------------------------------------------
  # ● index
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end
the global variables are:
$menu = 1 (small)
$menu = 2 (medium)
$menu = 3 (full menu)
(instead of $game_switches[1 or 2 or 3] = true)
enjoy...! :P ;)

comments & questions are welcome
you can also pm me or add me to msn if you have any questions. ;)

I want to know who is using my menu...
everybody who is using it, please pm me.
so i could make a list with the names.
(i know it from the folowing people: rm2k3kid, esai, peekimon)

funnybunny

Advanced RM2k(3) Coder

Age 34
The Netherlands
Seen December 18th, 2005
Posted September 23rd, 2005
178 posts
18.2 Years
Isn't this supose to be in the totorial subforum?

Anyway, cool. To bad I am not using RMXP :P. Else I would be using you menu.
Skills:
- RM2k(3) coding, example: Pokemon Champion - demo.
- HTML Coding, example Tiger dust Games - newsletter 2.
- RM2k(3) Mapping, example: Ultimatum; Inner War(WIP)
- Drawing.
- Small spriter, example: Tiger Dust Games - forum skin.
- Small Story writing, example: Ultimatum; Inner War(WIP) - story.

funnybunny

Advanced RM2k(3) Coder

Age 34
The Netherlands
Seen December 18th, 2005
Posted September 23rd, 2005
178 posts
18.2 Years
ummm, no...
this isn't a toturial, but a script :\
Oh okay, anyway, good job.

PS: that was a fast reply:P.
Skills:
- RM2k(3) coding, example: Pokemon Champion - demo.
- HTML Coding, example Tiger dust Games - newsletter 2.
- RM2k(3) Mapping, example: Ultimatum; Inner War(WIP)
- Drawing.
- Small spriter, example: Tiger Dust Games - forum skin.
- Small Story writing, example: Ultimatum; Inner War(WIP) - story.

Esai

♥♥♥ With Bubbleicious ♥♥♥

Age 30
England
Seen October 20th, 2005
Posted August 27th, 2005
1,434 posts
18.6 Years
Yes, But it doesnt waste the switches, which are used alot in Pokemon Games, oh and to change the global variable use this:

new event
Call Script:
$menu = 1, 2 or 3

thats it ;)


~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
Paired with:: Bubbleicious! ^_^ *hugs*

~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
Twinned with: Peekimon

~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
I have Adopted Maya Miyazono ^^

~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~

|+|=|+|=|+|=|+|=Web-Sites to Visit|=|+|=|+|=|+|=|+|=|

<!! Quad-Pod !!>

< DHI Forums >

|+|=|+|=|+|=|+|=Links on PC!|+|=|+|=|+|=|+|=|+|=|+|=|

Esai's FanClub!

{[Achivements]}
Made it to the Top Ten in the Spring DCC

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
esai is correct.

i choiced for a global variable, so you change it in any script! ;)
(you could try, if you don't believe it)

and, I want to know who is using my menu...
everybody who is using it, plz pm me.
so i could make a list to remember it
i'll put this in the first post too

Esai

♥♥♥ With Bubbleicious ♥♥♥

Age 30
England
Seen October 20th, 2005
Posted August 27th, 2005
1,434 posts
18.6 Years
Well, Whats the code on line 154 of Scene_Menu?


~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
Paired with:: Bubbleicious! ^_^ *hugs*

~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
Twinned with: Peekimon

~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
I have Adopted Maya Miyazono ^^

~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~

|+|=|+|=|+|=|+|=Web-Sites to Visit|=|+|=|+|=|+|=|+|=|

<!! Quad-Pod !!>

< DHI Forums >

|+|=|+|=|+|=|+|=Links on PC!|+|=|+|=|+|=|+|=|+|=|+|=|

Esai's FanClub!

{[Achivements]}
Made it to the Top Ten in the Spring DCC

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
I have no I dea I somehow cannot reach it its like its not big enough to fit on my screen.
you can download a patch at www.dubealex.com for the resolution
"rmxp enhanched"

and for that error,
overwrite the following with Window_Command
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
#  一般的なコマンド選択を行うウィンドウです。
#==============================================================================

class Window_Command < Window_Selectable
  attr_reader  :commands
  #--------------------------------------------------------------------------
  # ● def initialize
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    # コマンドの個数からウィンドウの高さを算出
    super(0, 0, width, commands.size * 32 + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in [email protected]_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # ● draw item
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])
  end
  #--------------------------------------------------------------------------
  # ● index
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
help, still when i right over window_command i still get that error that rm2kdude gets
this is line 154:
self.contents.draw_text(x, y, 200, 32, actor.name)
i don't have any idea what's the prob with this.
it does work okay for me

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
i finally got it to work: i just deleted that line of code and it works fine
but i do have a nother problem no matter which menu i choose i still get Bag,Save,Options and Exit
shouldn't have removed that line :\
the problem is, you haven't set the type!
in scene_title, add above $scene = Scene_Map.new:
$menu = 1
around line 160
it will work!

Blizzy

me = Scripter.new("Noob")

Age 33
~The Netherlands~
Seen September 2nd, 2007
Posted September 2nd, 2007
492 posts
18.4 Years
ADd me to the list, this menu is great... But are you going to make the Options and Save (Pokemon Saving Style) ect, Or do we have to do that? Oh, and the Trainer Card...? Thanks anyway
that's all up to you guys
well, you can't use my options now, because my resolution is different,
but apart from that i wouldn't give them out