The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: fadark on May 06, 2007, 10:17:02 PM

Title: very simple Cms [Request]
Post by: fadark on May 06, 2007, 10:17:02 PM
heres what i want it to look like:

where it says: "equip weapons", if you click on it, i want it to bring the cursor to the window where all of the weapons that you have are listed.

and you can only have a maximum of 8 weapons, and 7 items at a time,
if you have 7 items and you get another, then the item in your 7th slot is replaced with the one that you just got.

and in the same window where it says "kills" right below the word "kills" (but still in the same window) i need it to say "Coins:" and then the amount of money that I have.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi163.photobucket.com%2Falbums%2Ft284%2Ffadarkrmxp%2Fswtitle.jpg&hash=90289cecfe00cab0465f10d9e15eb3fb064d90eb)


and heres what i already have:
[spoiler]#===================================================
# - CLASS Your_Scene Begins
#===================================================
class Your_Scene
 
#---------------------------------------------------------------------------------
  def initialize
  end
#---------------------------------------------------------------------------------

def main
    @window1 = Window1.new
    @window1.x =0
    @window1.y =0
    @window1.height = 421
    @window1.width = 240
   #@window1.z = 200
   
    @window2 = Window2.new
    @window2.x =517
    @window2.y =0
    @window2.height = 421
    @window2.width = 123
   #@window2.z = 200
   
    @window3 = Window3.new
    @window3.x =239
    @window3.y =0
    @window3.height = 56
    @window3.width = 120
   #@window3.z = 200
   
    @window4 = Window4.new
    @window4.x =239
    @window4.y =364
    @window4.height = 57
    @window4.width = 279
   #@window4.z = 200
   
    @window5 = Window5.new
    @window5.x =358
    @window5.y =0
    @window5.height = 56
    @window5.width = 159
   #@window5.z = 200
   
    @window6 = Window6.new
    @window6.x =239
    @window6.y =55
    @window6.height = 310
    @window6.width = 279
   #@window6.z = 200
   
    @window7 = Window7.new
    @window7.x =0
    @window7.y =420
    @window7.height = 60
    @window7.width = 640
   #@window7.z = 200
   
Graphics.transition
    loop do
      Graphics.update
      Input.update
     #update
      if $scene != self
        break
      end
    end

    Graphics.freeze
    @window1.dispose
    @window2.dispose
    @window3.dispose
    @window4.dispose
    @window5.dispose   
    @window6.dispose   
    @window7.dispose 
   
  end
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
  def update
  end
#---------------------------------------------------------------------------------

end
#===================================================
# - CLASS Your_Scene Ends
#=================================================== 



#===================================================
# - CLASS Window1 Begins
#===================================================

class Window1 < Window_Base

#---------------------------------------------------------------------------------     
  def initialize
    super(0, 0, 240,421)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "1")
  end
#---------------------------------------------------------------------------------   

end
#===================================================
# - CLASS Window1 Ends
#===================================================


#===================================================
# - CLASS Window2 Begins
#===================================================

class Window2 < Window_Base

#---------------------------------------------------------------------------------     
  def initialize
    super(0, 0, 123,421)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "2")
  end
#---------------------------------------------------------------------------------   

end
#===================================================
# - CLASS Window2 Ends
#===================================================


#===================================================
# - CLASS Window3 Begins
#===================================================

class Window3 < Window_Base

#---------------------------------------------------------------------------------     
  def initialize
    super(0, 0, 120,56)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "3")
  end
#---------------------------------------------------------------------------------   

end
#===================================================
# - CLASS Window3 Ends
#===================================================


#===================================================
# - CLASS Window4 Begins
#===================================================

class Window4 < Window_Base

#---------------------------------------------------------------------------------     
  def initialize
    super(0, 0, 279,57)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "4")
  end
#---------------------------------------------------------------------------------   

end
#===================================================
# - CLASS Window4 Ends
#===================================================


#===================================================
# - CLASS Window5 Begins
#===================================================

class Window5 < Window_Base

#---------------------------------------------------------------------------------     
  def initialize
    super(0, 0, 159,56)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "5")
  end
#---------------------------------------------------------------------------------   

end
#===================================================
# - CLASS Window5 Ends
#===================================================


#===================================================
# - CLASS Window6 Begins
#===================================================

class Window6 < Window_Base

#---------------------------------------------------------------------------------     
  def initialize
    super(0, 0, 279,310)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "6")
  end
#---------------------------------------------------------------------------------   

end
#===================================================
# - CLASS Window6 Ends
#===================================================


#===================================================
# - CLASS Window7 Begins
#===================================================

class Window7 < Window_Base

#---------------------------------------------------------------------------------     
  def initialize
    super(0, 0, 640,60)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "7")
  end
#---------------------------------------------------------------------------------   

end
#===================================================
# - CLASS Window7 Ends
#===================================================
[/spoiler]


Thanks in advance!
Title: Re: very simple Cms [Request]
Post by: guy that need help on May 07, 2007, 05:35:58 AM
how'd you the window in the background of the image? did you you use some kind of generater?
Title: Re: very simple Cms [Request]
Post by: Rune on May 07, 2007, 07:51:18 AM
I think he's already made the windows, he just needs help putting stuff in them...

I'm not sure how to do it the way you've done it... but my way, you'd need a lot of windows...
Would it be okay if I made one from scratch?

[EDIT]
I've done most of it... but I haven't learned how to do commands like: Use a specific item or activate a common event... And I wasn't sure how to do the equipped weapon, weapon 2, weapon 3... etc... so you'll have to get someone else to do those for you...
Also, I couldn't get the "Coins" in the same window as "Kills" So I put Window_Gold in there... you'll just have to change your currency to 'Coins' in the database :)

Anyway... enough blabber... here's what i've done:

[spoiler]# "Main Menu" Window

class Window_Menu < Window_Base
  def initialize
    super(0, 0, 128, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, "Main Menu", 2)
  end
end

# "Stick Warriors" Window

class Window_Swarriors < Window_Base
  def initialize
    super(0, 0, 256, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(40, 0, 128, 32, "Stick Warriors", 2)
  end
end

# Ammo Window

class Window_Var < Window_Base
  def initialize
    super(0, 0, 256, 288)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
    @pammo = $game_variables[26]
    @mchgnammo = $game_variables[27]
    @sbmgnam = $game_variables[28]
    @rfam = $game_variables[29]
    @snrflammo = $game_variables[30]
    @rckt = $game_variables[31]
    @lsrgn = $game_variables[32]
    @lghtsbr = $game_variables[33]
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 128, 32, "Pistol Ammo:", 2)
    self.contents.draw_text(0, 32, 128, 32, "Machine Gun Ammo:", 2)
    self.contents.draw_text(0, 64, 128, 32, "Sub-Machine Gun Ammo:", 2)
    self.contents.draw_text(0, 96, 128, 32, "Rifle Ammo:", 2)
    self.contents.draw_text(0, 128, 128, 32, "Sniper Rifle Ammo:", 2)
    self.contents.draw_text(0, 160, 128, 32, "Rocket Launcher:", 2)
    self.contents.draw_text(0, 192, 128, 32, "Laser Focuser Battery:", 2)
    self.contents.draw_text(0, 224, 128, 32, "Lightsaber Battery:", 2)
    self.contents.font.color = normal_color
    self.contents.draw_text(96, 0, 128, 32, @pammo.to_s, 1)
    self.contents.draw_text(96, 32, 128, 32, @mchgnammo.to_s, 1)
    self.contents.draw_text(96, 64, 128, 32, @sbmgnam.to_s, 1)
    self.contents.draw_text(96, 96, 128, 32, @rfam.to_s, 1)
    self.contents.draw_text(96, 128, 128, 32, @snrflammo.to_s, 1)
    self.contents.draw_text(96, 160, 128, 32, @rckt.to_s, 1)
    self.contents.draw_text(96, 192, 128, 32, @lsrgn.to_s, 1)
    self.contents.draw_text(96, 224, 128, 32, @lghtsbr.to_s, 1)
  end
end

# Location Window

$data_mapinfos = load_data('Data/MapInfos.rxdata')

class Window_Steps
  def refresh
  contents.clear
  contents.font.color = system_color
  contents.draw_text(4, 0, 120, 32, 'Location: ')
  contents.font.color = normal_color
  name = $data_mapinfos[$game_map.map_id].name 
  contents.draw_text(96, 0, 516, 32, name)
  end
end

# Kills Window

class Window_Kills < Window_Base
  def initialize
    super(0, 0, 128, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
    @kills = $game_variables[25]
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 64, 32, "Kills: ", 2)
    self.contents.font.color = normal_color
    self.contents.draw_text(64, 0, 32, 32, @kills.to_s, 1)
  end
end

# Gold Window Edit

class Window_Gold
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
end

# Menu Status Window Edit

class Window_MenuStatus
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 480
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x + 32, y + 128)
      draw_actor_name(actor, x - 64, y + 32)
      draw_actor_class(actor, x + 64, y + 96)
      draw_actor_level(actor, x - 64, y + 96)
      draw_actor_state(actor, x, y + 32)
      draw_actor_exp(actor, x - 64, y + 160)
      draw_actor_hp(actor, x - 64, y + 128)
    end
  end
end

# Actual Menu

class Scene_Menu
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  def main
    s1 = "Return To Game"
    s2 = $data_system.words.equip
    s3 = "Use Item #1"
    s4 = "Use Item #2"
    s5 = "Use Item #3"
    s6 = "Use Item #4"
    s7 = "Use Item #5"
    s8 = "Use Item #6"
    s9 = "Use Item #7"
    s10 = "Common Event"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10])
    @command_window.x = 480
    @command_window.index = @menu_index
    if $game_party.actors.size == 0
      @command_window.disable_item(1)
    end
    @menu_window = Window_Menu.new
    @menu_window.x = 228
    @menu_window.y = 0
    @loc_window = Window_Steps.new
    @loc_window.x = 0
    @loc_window.y = 416
    @war_window = Window_Swarriors.new
    @war_window.x = 228
    @war_window.y = 352
    @status_window = Window_MenuStatus.new
    @status_window.x = 0
    @status_window.y = 0
    @var_window = Window_Var.new
    @var_window.x = 228
    @var_window.y = 64
    @kills_window = Window_Kills.new
    @kills_window.x = 356
    @kills_window.y = 0
    @gold_window = Window_Gold.new
    @gold_window.x = 480
    @gold_window.y = 352
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @menu_window.dispose
    @war_window.dispose
    @status_window.dispose
    @var_window.dispose
    @loc_window.dispose
    @kills_window.dispose
    @gold_window.dispose
  end
  def update
    @command_window.update
    @menu_window.update
    @war_window.update
    @status_window.update
    @var_window.update
    @loc_window.update
    @kills_window.update
    @gold_window.update
    if @command_window.active
      update_command
      return
    end
    if @status_window.active
      update_status
      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 @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      when 1
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Equip.new
      when 2
        $game_system.se_play($data_system.decision_se)
      when 3
        $game_system.se_play($data_system.decision_se)
      when 4
        $game_system.se_play($data_system.decision_se)
      when 5
        $game_system.se_play($data_system.decision_se)
      when 6
        $game_system.se_play($data_system.decision_se)
      when 7
        $game_system.se_play($data_system.decision_se)
      when 8
        $game_system.se_play($data_system.decision_se)
      when 9
        $game_system.se_play($data_system.decision_se)
      end
      return
    end
  end
end


You'll also have to go into Scene_Equip and find these lines

    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(2)
      return
    end


Change the '2' to '1'
[/spoiler]

Hope this helps :D
Title: Re: very simple Cms [Request]
Post by: fadark on May 08, 2007, 01:32:09 AM
it's nice but i think you didnt get what i was saying. i dont want it to say "use item #1" or whatever. i want it to say the name of the item. it's like a mini item inventory. same with equiping the weapons. iwant it to say the name of the weapon there. nice job though! ;D
Title: Re: very simple Cms [Request]
Post by: Rune on May 08, 2007, 03:53:25 PM
I know that :D I just didn't know which items you wanted to use
And I wasn't sure how to get it so your equipped weapon appeared at the top... i'll try and learn that next but if anyone wants to take over with it then feel free :D
Title: Re: very simple Cms [Request]
Post by: fadark on May 08, 2007, 09:04:39 PM
ok! ;D