MZ Date and Time System VisuStella MZ

So I see in the videos for this plug-in that NPC's can be controlled to only come out at certain times however if it's in the literature and I can't find how to do it I was wondering if anybody could help me through it http://www.yanfly.moe/wiki/Date_and_Time_System_VisuStella_MZ
They probably use the time-based variable assignments and then have the NPC page conditions be the variables being at certain values.
I got it working it just took me a little time to figure it out.


// Get the event ID of the NPC (replace with the actual event ID)

const eventId = this._eventId; // 'this' refers to the Game_Interpreter (event running)



// Get the Game_Event object for the NPC

const event = $gameMap.event(eventId);



if (event) {

// Check if it's between 8 AM and 8 PM

if (TimeManager.getHour() >= 8 && TimeManager.getHour() < 20) {

// If within the hours, set the graphic to the visible NPC sprite

event.setImage('People1', 0); // Replace 'People1' and 0 with the actual filename and index

event.setOpacity(255);

$gameSwitches.setValue(10,false);

event.setThrough(false);

event.setGraphics();

} else {

// If outside the hours, set the graphic to a blank/invisible sprite

event.setImage('!$', 0); // Replace with filename and index to transparent sprite (character sprite)

event.setOpacity(0); //Completely Invisible

event.setThrough(true);

}

} else {

console.warn("Event with ID", eventId, "not found.");

}

Original thread: https://forums.rpgmakerweb.com/threads/date-and-time-system-visustella-mz.175310/