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.

[RMXP] How to add a new window to a scene ?

Jason

Awesome Bro

Hi,

So I've made a basic window named Window_EquipPreview, and I want it to be seen inside Scene_Equip, however, I don't know how to add it into the Scene without recieving an error, I've tried adding;

Code:
    @item_window6 = Window_EquipPreview.new(@actor)
Below
Code:
    @help_window = Window_Help.new

    @left_window = Window_EquipLeft.new(@actor)

    @right_window = Window_EquipRight.new(@actor)

    @item_window1 = Window_EquipItem.new(@actor, 0)

    @item_window2 = Window_EquipItem.new(@actor, 1)

    @item_window3 = Window_EquipItem.new(@actor, 2)

    @item_window4 = Window_EquipItem.new(@actor, 3)

    @item_window5 = Window_EquipItem.new(@actor, 4)
As well as underneath every piece of code of the same sort (Where it lists each window etc.)

Am I doing something wrong ? And if so, can someone help me out here ?

Thanks.
 

EOG

Member

Possible causes of error:
- You do not have initialize method
How to solve: add initialize method(check in other windows how it's done)
- Your window is so simple that initialize method does not get any variables
How to solve: chenge your code to @item_window6 = Window_EquipPreview.new

If this does not help post
1. What error do you have?
2. Your window script.
 
More like you need a seperate instance in that class, aka don't make the object name '@item_window6', but something like '@preview_window'. I think if you right-click -> Replace all instances of one with the other, you should be set... if you didn't mess up your window, that is ^^

For future questions, please post the whole scripts you're working with, in this case Scene_Equip and Window_EquipPreview.
 

Jason

Awesome Bro

BlueScope":retx5co2 said:
More like you need a seperate instance in that class, aka don't make the object name '@item_window6', but something like '@preview_window'. I think if you right-click -> Replace all instances of one with the other, you should be set... if you didn't mess up your window, that is ^^

For future questions, please post the whole scripts you're working with, in this case Scene_Equip and Window_EquipPreview.

Ah, many thanks, have a beer :cheers:

@preview_window worked perfectly,

~JBrist.

Edit--

I have one last little thing that I can't seem to crack, how to show the sprite of the current actor, at the moment I'm using;
Code:
 

    @actor = actor

    actor = $game_party.actors[0]

    bp_actor = RPG::Cache.character(actor.character_name,actor.character_hue)

    r_actor = Rect.new(0, 0, bp_actor.width / 4, bp_actor.height / 4)

    self.contents.blt(368/4 - 32, 4, bp_actor, r_actor)

 
However, as obvious as it may be, that only displays the first actors sprite, I've tried changing
Code:
 

@actor = $game_party.actors[0]

 

to

 

@actor = $game_party.actors[i]

 
But I get an undefined method error for the part.

Any help is appreciated.
 

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