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.

[RESOLVED] [VX] Showing chapter title in menu?

ikos

Member

Alright, I've got some empty space in my CMS, so I thought I could show, you know, a chapter title?

Here's how I could imagine it working:

When Switch 100 is On => Show "Beginning"
When Switch 200 is On => Show "Devastation"
When Switch 300 is On => Show "Finale"

and so on. Any help is bangin'. Cheers.

~Ikos out
 
Well, I make the script for you.
But instead of using switches to determine which chapter is, I prefer to use a variable you can set the module Ikos, as I do not know the size, width, the position X, Y the position you want your window appears in ikos module, and you can set these things.
See the Scene_Menu just below the Show_Chapter this part of the code:
Code:
[b]     if $ game_variables [VARIABLE_ID] == 0

        text = CHAPTERS[0]

     elsif $ game_variables [VARIABLE_ID] == 1

       text = CHAPTERS[1]

     elsif $ game_variables [VARIABLE_ID] == 2

       text = CHAPTERS [2]

     end[/b]

In the first line, if you set a variable is equal to 0, the name of the chapter will be what is in index 0 of array CHAPTERS (CHAPTERS [0]), and the second line if the variable is equal to 1 the name of chapter will be what is in 1 of the array index CHAPTERS (CHAPTERS [1]) and so on.

Let me teach you use, first check that the total of the script I created 3 chapters:
Code:
[b]   CHAPTERS [0] = "[color=#BF00FF]Beginning[/color]"

   CHAPTERS [1] = "[color=#BF00FF]Devastation[/color]"

   CHAPTERS [2] = "[color=#BF00FF]Final[/color]"[/b]

If you want to create another chapter is just type:
Code:
[b]    CHAPTERS [3] = [color=#BF00FF]"chapter name"[/color][/b]
and then go on script Scene_Menu just below the Show_Chapter and just typing below the
Code:
[b][color=#0000FF]elsif [/color]$ game_variables [VARIABLE_ID] == [color=#FF4080]2[/color]

        text = CHAPTERS[2][/b]
this:
Code:
[b]   [color=#0000FF]elsif[/color] $ game_variables [VARIABLE_ID] == [color=#FF4080]3[/color]

        text = CHAPTERS[3][/b]

This means that when the value of the variable is 3, the name of the chapter will be what is in 3 of the array index CHAPTERS (CHAPTERS [3]).
To add more chapters is so do the same.

SCRIPT:

Code:
module Ikos

  CHAPTERS = []

  CHAPTERS[0] = "Beginning"

  CHAPTERS[1] = "Devastation"

  CHAPTERS[2] = "Final"

  WINDOW_X = 0

  WINDOW_Y = 280

  WINDOW_WIDHT = 160 

  WINDOW_HEIGHT = 80

  VARIABLE_ID = 1

end

 

class Show_Chapter < Window_Base

  def initialize(chapter_name,x,y,width,height)

    super(x,y,width,height)

    @chapter = chapter_name

    @width = width

    refresh

  end

  

  def refresh

    self.contents.clear

    self.contents.font.color = text_color(3)

    self.contents.draw_text(0,-10,@width,32,"Chapter:")

    self.contents.font.color = normal_color

    self.contents.draw_text(0,18,@width-26,32,@chapter)

  end

end

 

 

 

class Scene_Menu < Scene_Base

  include Ikos

  alias rafidelis_show_chapter_start start

  def start

    rafidelis_show_chapter_start

    if $game_variables[VARIABLE_ID] == 0

      text =  CHAPTERS[0]

    elsif $game_variables[VARIABLE_ID] == 1

      text = CHAPTERS[1]

    elsif $game_variables[VARIABLE_ID] == 2

      text = CHAPTERS[2]

    end 

    @chapter_window = Show_Chapter.new(text,WINDOW_X,WINDOW_Y,WINDOW_WIDHT,WINDOW_HEIGHT)

  end

  

  alias rafidelis_show_chapter_terminate terminate

  def terminate

    @chapter_window.dispose

    rafidelis_show_chapter_terminate

  end  

end

 

SCREENSHOT:

chaptersh6.png


I am sorry that this script is confused, what more could do was

If you are very confused and you need more help,post here.
sorry the pessimism English
 

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