1 year ago

Here is a tutorial on how to make your own settings in the Game.ini file and calling them in an event with script calls in VXAce.


tutorial.png

The Game.ini file contains configuration stuff that the rpg maker engine uses. You can see in this screenshot I already put two settings of my own here.

The first one, SkipCutscene, returns a number.
The second one, Codename, returns some text.

tutorial2.png

Here is what to do if you want to call a number:

First open the Game.ini file and write in the SkipCutscene=1 line of the screenshot, or whatever else you want your setting to be called.

next open the script editor in your game project.

Paste GAME_INI_ENTRY = /^SkipCutscene=(.+)$/ anywhere as long as it isnt under a class. This will be the name of the setting you want to check. The funny symbols around it are regex, which tell the game how to read this text. This is often used in other scripts to read code in notes or comments.

tutorial2.png

Now go to Game_Interpreter and paste in this:

def skip_cutscene

saved_num = nil

File.open('Game.ini') { |f|

f.each_line { |l|

next unless l.valid_encoding?

GAME_INI_ENTRY.match(l) { |m|

saved_num = m[1].to_i

break

}

}

}

return saved_num rescue 0

end

This opens the Game.ini file and looks through each line, skips any it can't properly read, (like text with ä, ö or ü letters),
and looks for any matches with the GAME_INI_ENTRY text.

If it does find a match, it saves it in the saved_num variable and turns it into an Integer. (basically a number with no decimals.)

Then it saves the number in the saved_num variable. If it gets nothing, it simply returns a 0.

Considering this tutorial is about how to make all of this happen through a script call, this code has to be put in the Game_Interpreter class, so that one can simply call the method name.

Like this:

tutorial2.png

Here in $game_variables[1] = skip_cutscene the returned number of the skip_cutscene method gets saved in a variable.

Then a conditional branch checks if the variable is 0. If not, it will skip that inside the conditional branch entirely.

If you want to make it get text instead, do this:

Paste GAME_INI_NAME = /^Codename=(.+)$/ just like in the previous example.

Open the Game.ini file and write in
Codename=Deleted Donut or whatever else you want it to be called.

Next inside the Game_Interpreter class:

def get_codename

saved_name = nil

File.open('Game.ini') { |f|

f.each_line { |l|

next unless l.valid_encoding?

GAME_INI_NAME.match(l) { |m|

saved_name = m[1].to_s

break

}

}

}

return saved_name rescue ""

end

This pretty much does the same thing as the number code, except turning the end result into a string.

An example for using this method is this:

tutorial2.png
unnamedteext.png

And now an event read text out of the game.ini file.

#rpgmaker #rpgmakervxace #scripting #ruby #rgss3 #rgss



4 comments

Loading...

Next up

Driller getting desperate for destructive machines

Battle against the last boss except you aren't participating since you're just there to drill rocks.

Fullversion is out.

Now you can be in debt and die in a fantasy dungeon for countless times at the cost of more debt!

I've decided that I'll be posting some stuff from the game to showcase the features implemented so far - first is the DIFFICULTY SELECTION, the very first thing that greets you in the game! HYSTERIYA and HARDCORE mode are locked behind beating Episode 1!

Placing down objects like torches or turtles has always scared off monsters. Especially turtles.

A screenshot of the only map in my project "Over the Moon" Plus all its characters.

---------------------------------------

Una captura del único mapa que habrá en mi proyecto "Over the Moon" Y todos sus personajes.

Jungling through the Jungle Dungeon

Hounderick has had enough of tormenting doves. Now he torments turtles.

Growing of the brawling club while you win fights.

Permanent Elemental Drills