RMMV Change Ingame Font temporary via Event - Scriptcall

c0dy

Villager
Member
Joined
Apr 15, 2022
Messages
7
Reaction score
5
First Language
German
Primarily Uses
RMMV
For the general changing of the ingame font there are also plugins for the MV and theoretically you don't even need one, since you could change this directly in the file ''\fonts\gamefont.css" in your project folder.



But what if I only need a different font for a specific scene and then want to change it, e.g. via an event?

I tried to implement a solution for this myself and with some googling I managed to come up with a not-so-perfect Java workaround. (Or I found it somewhere and it works for the maker)



1. Pack the additional font into the "fonts" folder of your project as well

2. Copy the "gamefont.css" and name it e.g. "gamefont2.css".

3. Open this in a text editor of your choice as indicated above, Notepad also works.

4. In the third line, simply change the name of the original .ttf to the newly added font.



Finally, you can actually call this css with the following script call so that the font change is carried out at any point of an event:
JavaScript:
var cssId = 'myCss';  // you could encode the css path itself to generate id..
if (!document.getElementById(cssId))
{
    var head  = document.getElementsByTagName('head')[0];
    var link  = document.createElement('link');
    link.id   = cssId;
    link.rel  = 'stylesheet';
    link.type = 'text/css';
    link.href = 'fonts/gamefont2.css';
    link.media = 'all';
    head.appendChild(link);
}

Why am I writing this here? Because the change is not instant and there is no refresh command at the end of the script to change it directly.

I've tried a few things but couldn't find a solution. For a manual refresh while game is running, it is enough, for example, if I hover ingame with the mouse over an event which has 'hover_activate!' as 'Note'/'Comment'. (TDDP_MouseSystemEx)

So any call will also update the game interface. Probably also through other ingame actions...


Hope that it was somehow understandable what i need to complete that script.

Of course I would also be open to any better implementations, but since there doesn't seem to be a plugin for changing a font to everything at game (not only message-text) temporary and from event-call , I see black :wink:
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,910
Reaction score
2,228
First Language
Portuguese - Br
Primarily Uses
RMMZ

c0dy

Villager
Member
Joined
Apr 15, 2022
Messages
7
Reaction score
5
First Language
German
Primarily Uses
RMMV
Hi @Eliaquim ,
looks like a great Plugin! Sadly also one, wich didn't can do temporary font-changes for a specific time.
With that Plugin you must predefine what font to use in wich scene. And then its fix for whole gaming.

Anyway, i gave it a try cause it maybe fit for my actually Issue. By using this i had some strange Problems. It changes the font for the declared scene but also shrink the font size so its difficult to read. The font-size value you can predefine at plugin settings will even be ignored.
Maybe you have some time to figure that out via PM with me. Then i can give you some more informations about that. That would be nice :wink:

@All:
Even if that Plugin could help me with this single Issue, i would still appreciate a 'temporary-change at event' solution that gives me more flexibility in usage. So i really thankfull for every idea to my script solution above, or even another script that really does what i try to do. :smile:
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,910
Reaction score
2,228
First Language
Portuguese - Br
Primarily Uses
RMMZ
looks like a great Plugin! Sadly also one, wich didn't can do temporary font-changes for a specific time.
With that Plugin you must predefine what font to use in wich scene. And then its fix for whole gaming.
It's not fixed throughout all games. You can change, and remove it using plugin commands. Just keep in mind that instead of the CSS font file, the plugin will use the first font as the default for everything.
So you can set up the fonts you want and either not attach them to any scene/window or if you attach, just remove them with the plugin command later.

Anyway, i gave it a try cause it maybe fit for my actually Issue. By using this i had some strange Problems. It changes the font for the declared scene but also shrink the font size so its difficult to read. The font-size value you can predefine at plugin settings will even be ignored.
Maybe you have some time to figure that out via PM with me. Then i can give you some more informations about that. That would be nice :wink:
That must be a compatibility issue. Did you find the same results on a clean project?
Unfortunately I'm not with time to answer PMS or more detailed stuff, because I'm working on IGMC.
 

c0dy

Villager
Member
Joined
Apr 15, 2022
Messages
7
Reaction score
5
First Language
German
Primarily Uses
RMMV
That must be a compatibility issue. Did you find the same results on a clean project?
Unfortunately I'm not with time to answer PMS or more detailed stuff, because I'm working on IGMC.
I understand that you haven't much time and wan't to take it for your own projects. I even spent so many time on single issues that the short time, that can take place for Gamemaking, will end up in 10% progress and 90% frustrating :LZSangel:

Well, i really have to hope that someone can give me an advise how to do a refresh of the scene that i can use my own solution at start-post. Maybe i will try some day to look further to your plugin, but for now i have to make some progress - time is running :wink:
 

Latest Threads

Latest Profile Posts

no I did not just have to write a song three different times because my music software doesn't support tempo changes!!
I WILL defeat this demonic USB connection notification bug
ScreenShot_8_15_2022_6_22_24.png
Mike trying to dodge the Memory Pawns invading Bantam Street. I like how the filters I used on the map almost make it look like the street is wet in a sense.
Come watch as Studio Blue plays OMORI live on the final RPG Maker Critiques stream!

The only way I can get my cat to exercise is by throwing cat treats across the room so he will run after them.

Forum statistics

Threads
124,567
Messages
1,164,448
Members
163,385
Latest member
goonfuture
Top