Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Really simple equip scene

Hi, I need a quick scene for my game for equipment.

All it is, is a selectable window, which shows a certain type of equipment in it.

It needs to be able to be called by:

$scene = Scene_Armoury.new('type')

When called it will show that type of armour. When the selection is made, it equips that armour in the appropriate slot, and then closes the scene (goes back to Scene_Map).

At the top of each list is "none". When this is chosen, it gets rid of whatever is equipped in that particular slot.

I have the sort of basic scene made, I just need the selectable window made. I've started it off, but I haven't got a clue how the equip works and everything.

Code:
class Scene_Armoury(type)
  
  def initialize
    @type = type
  end
  
  def main
    
    # Command window
    
    s1 = '(None)'
    @data = [s1]
    @command = Window_Command.new(232, @data)
    @command.y = 51-16
    @command.z = 9999
    @command.x = 232
    @command.height = 250
    
    # Sprites and bitmaps
    
    @spriteset = Spriteset_Map.new
    @hud = Window_HUD.new
    @hud_img = Sprite.new
    @hud_img.bitmap = RPG::Cache.picture('hud')
    
    # Loop
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    
    # Dispose of shiz
    
    @command.dispose
    @spriteset.dispose
    @hud.dispose
    @hud_img.dispose
    
  end
  
  def update
    
    # stuff here for selectable window maybe?
    
    #----------------------------------------
    
    #----------------------------------------
      
    @command.update
    @spriteset.update
    
    #
    # My game uses a mouse system (see comments)
    #
    
    if Mouse.click?(Mouse::Right_Click) # Just imagine this is B
      $scene = Scene_Map.new
    end
    
    if Mouse.click?(Mouse::Left_Click) # Just imagine this as button C
      case @command.index
      when 0
        #
      when 1
        #
      end
    end
    
  end
  
end

Important info: This is for a commercial online game.

Thanks!

Please let me know if anything is missing from here.
 

khmp

Sponsor

@ChaosMaxima: The type refers to the type of armour? Like chest, shield, helmet, accessory.
Weapon: 0
Chest: 1
Shield: 2
Helmet: 3
Accessory: 4

@Wyatt:
I understand what the @type represents but what do you mean by @data. Is this just something you copied from another script or what did you want its intent to be? You only have one option in the command window. But in the update you have a test for two. You don't dispose of the HUD image but you are using the cache so it might not be what you want. You don't have to update the Spriteset_map unless you expect movement on it which might be the case. I don't know just thought I would bring that to your attention. When you initialize the command window you adjust its height but the height will automatically conform to the size of the options it is handed. You might be doing this on purpose again its just a little FYI. There isn't a whole lot to go off of. You should add in more comments of what you expect or want the code to do. Because right now I'm confused as to the Scene's purpose. Is Scene_Armoury's purpose to equip armour and weapons, just armour, create weapons or armour?

Good luck with it Wyatt! :thumb:
 
What I want to create is a window something like this:

http://img.photobucket.com/albums/v108/ ... 5apr01.png[/img]

When you choose an option, it equips it, and closes the scene again.

But what is displayed there depends on what the @type is, which would be weapon, armour, shield, helm, or accessory.

I was just guessing really, I figured the way to do this would be to create:

@data = []

And then have somewhere something like:

if @type == 1
@data.push(something)
end

But I'm really not sure how the equip scene works or anything.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top