Global switches script

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
Recently Hime made an amazing script for me in order to create a boss rush, the problem is, I want this boss rush to be unlocked when the game is beaten, so I was hoping someone would be kind enough to make a script for me that has a switch I can turn on, and it would change the title menu. 

If needed here's the hime script:

Code:
module TH  module Special_Map_Command      # The map that the player will be sent to upon choosing the special command.    Map_ID = 85        # Name of the command that will be shown in the title screen    Name = "Boss Rush"        # A formula that determines whether the command will be displayed    Condition = "true"  endendmodule DataManager  def self.setup_boss_rush    create_game_objects    $game_party.setup_starting_members    $game_map.setup(TH::Special_Map_Command::Map_ID)    $game_player.moveto(1, 1)    $game_player.refresh    Graphics.frame_count = 0  endendclass Window_TitleCommand < Window_Command  alias :th_special_map_command_make_command_list :make_command_list  def make_command_list    th_special_map_command_make_command_list        add_command(TH::Special_Map_Command::Name, :boss_rush) if boss_rush_enabled?  end    #-------------  # Whether boss rush should be enabled or not  #-------------  def boss_rush_enabled?    eval(TH::Special_Map_Command::Condition)  endendclass Scene_Title    alias :th_special_map_command_create_command_window :create_command_window  def create_command_window    th_special_map_command_create_command_window    @command_window.set_handler(:boss_rush, method(:command_boss_rush))  end    def command_boss_rush    DataManager.setup_boss_rush    close_command_window    fadeout_all    $game_map.autoplay    SceneManager.goto(Scene_Map)  endend
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
What you need is not a global switch but a global save file to tell the game you have cleared the game. A global switch gets reset every time you close the game but a global save file stay there as long as it's created.

Have you tried one of those new game+ scripts out there?
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
New game + isn't exactly what I'm looking for, and I have no clue how to change it to be what I need.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
As far as i can tell from that script, Tsukihime has done everything for you except the condition part.

There's should be a file check method in New Game+ that checks if new game+ save files exist or not, simply place that in the condition part will work.

If you do not plan to use New Game+ and plan to add your own global save file at game end, look for scripts that allow you to create file then do a file check on that in the condition part.

Try this script, in the settings area set the save folder to '.' if your save files are using the game default folder.

Then, in the @Doc1 part, simply edit that to "Game Cleared", or just leave them be, it doesn't really matter what data we write into the file :p

When done setting those up:

Now you can create a file call "game_cleared.rvdata2" at the end of the game using the script call in your ending event:

txt_save("DOC1", "game_cleared.rvdata2")This should create a file name game_cleared.rvdata2 in your game folder if you set it up right.

----------

When all those are ready, add this line to Tsukihime's script condition (replace "true")

Condition = File.exist?('.\game_cleared.rvdata2')-----------

So next time, when the file exist the boss rush will be available. When the file isn't there, the boss rush will be disabled.
 
Last edited by a moderator:

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
Script boss rush line 37: TypeError has occurred

Can't convert false into a string
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You don't need that . if you want to check in the game's root folder.


Try this:

Code:
Condition = File.exist?("game_cleared.rvdata2")
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
Same error

Script boss rush line 37: TypeError has occurred

Can't convert false into a string
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
That's not the same error than, is it? :D


Since it's an eval call try this:

Code:
Condition = "#{File.exist?("game_cleared.rvdata2")}"
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Script boss rush line 37: TypeError has occurred

Can't convert false into a string
Convert line 37 from:

eval(TH::Special_Map_Command::Condition)

to

TH::Special_Map_Command::Condition
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
Meowface's solution worked! Thanks a ton!
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
You're welcome! And congratulations on your progress! ;)
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
If you do it like that, the condition will get stored at game startup. It will NOT change during the game, only after the game is restarted.


So, if the player finishes the game, gets this file created and returns to the title screen, the new option will NOT be there, until the game is restarted.
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
How would I make it do otherwise?
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
How would I make it do otherwise?
Convert line 37 from:

eval(TH::Special_Map_Command::Condition)

to

File.exist?('.\game_cleared.rvdata2')
 

Benja

Lead Developer
Veteran
Joined
Mar 5, 2014
Messages
131
Reaction score
25
First Language
English
Primarily Uses
RMVXA
Thanks a ton (again) MeowFace!
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
You're welcome! And congratulations(again) on your progress! ;)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top