8 months 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

Savefiles from the demo are now compatible with the Fullversion + the demo can be played in 2 other languages now: German and Simplified Chinese.

Making editable diary entries in Y/N's diary.

To celebrate 650 members in this community, I made 50 fanworks for games (And an animation for the deception jam winner), each for a person that I vaguely remember seeing a post of here. (in case your name doesn't get mentioned mb)

I Drew Saga from Into Draconia!

An RPG Maker game by @ninesoulssea , they make good games!

Enemies are animated now.

Normies

Early Access for Gefährliche Liebe - (Boy x Reader) is out.

Here's title intro cutscene + title screen + system options screen.

Two people staring at each other with wrathful hate always makes for the best scenes to conform them to for all eternity. 🤩

A DEMO for Silent Knight is out NOW! Try it out!

Check article for more info.

Smuggling out items from the dungeon by storing them in an ✨illegal storage✨