Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Hello. I recently tried to make a time stop ability, basically a common event (called with Yanfly's Button Common Events plugin) that, using a switch, stop all moving NPCs for 10 seconds. To make the time stop work only 10 seconds I am using SumRndmDde's Timer Upgrade plugin (it should also work without the plugin, I'm using it because it's more pratical).
I'm having some trouble with this though.
The most important problem, the button to use this ability is spammable, so if you keep pressing the button, the timer keeps resetting, making the whole time limit useless.
Moreover, when the timer expires and time start moving again, NPCs will start their route from the beginning, not from where they stopped (obviously their position is not reset, but they wont remember how many steps they have done).
Can someone help me solve this two issues?

Here's how I made the common event:
2019-02-13.png
Basically when the switch "timestop" is ON, it will trigger a empty page on a NPC, who will stop moving (or talking).
When timer expires common event 3 will set the "timestop" switch OFF, making the NCP moving again.

Thanks.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
Anti-ability-spam: you could put the event commands you currently have inside a Conditional Branch, so that it only starts the timer if the switch is off. Nice and easy! :)

Restarting moves: whenever an event changes page, the event properties are reset, including auto-move routes. In theory assigning an active/forced move route via eventing should temporarily put the passive/autonomous one on hold until the active one ends, but I did some testing with a script call and it seems the move routes do reset, at least in v1.5.2...here's the script call in case you're interested:
Code:
var cWait = { code: Game_Character.ROUTE_WAIT, parameters: [600]};
var cStp0 = { code: Game_Character.ROUTE_STEP_ANIME_OFF, parameters: []};
var cStp1 = { code: Game_Character.ROUTE_STEP_ANIME_ON, parameters: []};
var cEnd  = { code: Game_Character.ROUTE_END, parameters: []};
var listA = [cWait, cEnd];
var listB = [cStp0, cWait, cStp1, cEnd];
var routeA = { list: listA, repeat: false, skippable: false, wait: false };
var routeB = { list: listB, repeat: false, skippable: false, wait: false };
$gameMap.events().forEach(function(ev) {
  if (ev.hasStepAnime()) ev.forceMoveRoute(routeB);
  else ev.forceMoveRoute(routeA);
});
I think the best solution is a plugin, so I went and added a "freeze sprites" feature to one of my existing plugins. Seems to work pretty well, here it is if you want to try~
File link (Google Drive)
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.1 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start and update methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 * 
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Exception String
 * @text Exception String
 * @type text
 * @desc If an event contains this text in its name, it will always be able to be activated.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type boolean
 * @desc If true, affected events will appear visually frozen while disabled.
 * @default false
 */

var Imported = Imported || {};				// Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.1;			// Import declaration

var CAE = CAE || {};					// Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};	// Plugin namespace

(function(_) {

'use strict';

	_.params = PluginManager.parameters('Cae_DisableEventStart');		// Process user parameters

	_.swID = Number(_.params['Disable Switch']);
	_.excl = String(_.params['Exception String']);
	_.freeze = _.params['Freeze Effect'] === 'true';

	_.isDisabled = function(event) {
		return _.swID > 0 && $gameSwitches.value(_.swID) && !event.event().name.contains(_.excl);
	};

	_.isFrozen = function(event) { return _.freeze && _.isDisabled(event); };

	_.Game_Event_start = Game_Event.prototype.start;
	Game_Event.prototype.start = function() {
		if (!_.isDisabled(this)) _.Game_Event_start.call(this);
	};

	_.Game_Event_update = Game_Event.prototype.update;
	Game_Event.prototype.update = function() {
		if (!_.isFrozen(this)) _.Game_Event_update.call(this);
	};

})(CAE.DisableEventStart)
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Anti-ability-spam: you could put the event commands you currently have inside a Conditional Branch, so that it only starts the timer if the switch is off. Nice and easy! :)

Restarting moves: whenever an event changes page, the event properties are reset, including auto-move routes. In theory assigning an active/forced move route via eventing should temporarily put the passive/autonomous one on hold until the active one ends, but I did some testing with a script call and it seems the move routes do reset, at least in v1.5.2...here's the script call in case you're interested:
Code:
var cWait = { code: Game_Character.ROUTE_WAIT, parameters: [600]};
var cStp0 = { code: Game_Character.ROUTE_STEP_ANIME_OFF, parameters: []};
var cStp1 = { code: Game_Character.ROUTE_STEP_ANIME_ON, parameters: []};
var cEnd  = { code: Game_Character.ROUTE_END, parameters: []};
var listA = [cWait, cEnd];
var listB = [cStp0, cWait, cStp1, cEnd];
var routeA = { list: listA, repeat: false, skippable: false, wait: false };
var routeB = { list: listB, repeat: false, skippable: false, wait: false };
$gameMap.events().forEach(function(ev) {
  if (ev.hasStepAnime()) ev.forceMoveRoute(routeB);
  else ev.forceMoveRoute(routeA);
});
I think the best solution is a plugin, so I went and added a "freeze sprites" feature to one of my existing plugins. Seems to work pretty well, here it is if you want to try~
File link (Google Drive)
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.1 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start and update methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 *
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Exception String
 * @text Exception String
 * @type text
 * @desc If an event contains this text in its name, it will always be able to be activated.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type boolean
 * @desc If true, affected events will appear visually frozen while disabled.
 * @default false
 */

var Imported = Imported || {};                // Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.1;            // Import declaration

var CAE = CAE || {};                    // Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};    // Plugin namespace

(function(_) {

'use strict';

    _.params = PluginManager.parameters('Cae_DisableEventStart');        // Process user parameters

    _.swID = Number(_.params['Disable Switch']);
    _.excl = String(_.params['Exception String']);
    _.freeze = _.params['Freeze Effect'] === 'true';

    _.isDisabled = function(event) {
        return _.swID > 0 && $gameSwitches.value(_.swID) && !event.event().name.contains(_.excl);
    };

    _.isFrozen = function(event) { return _.freeze && _.isDisabled(event); };

    _.Game_Event_start = Game_Event.prototype.start;
    Game_Event.prototype.start = function() {
        if (!_.isDisabled(this)) _.Game_Event_start.call(this);
    };

    _.Game_Event_update = Game_Event.prototype.update;
    Game_Event.prototype.update = function() {
        if (!_.isFrozen(this)) _.Game_Event_update.call(this);
    };

})(CAE.DisableEventStart)

Thank you so much, everything works perfectly.
however I still have a doubt: when the timer expires, you can activate the skill immediately after, so in this sense it is still spammable. How could I make a kind of cooldown before stopping time again?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
Ooh, good point. At the moment you have two events, right? Timestop and EndTimestop or something. Here's an idea:
  • Change the branch in your Timestop event to check a new "cooldown" switch. Also turn on this switch when the timestop starts!
  • Add a new event, e.g. EndTimestopCooldown, that simply turns off the new switch.
  • Change the EndTimestop event so that it starts the timer again, calling the new EndTimestopCooldown event when it ends.
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Ooh, good point. At the moment you have two events, right? Timestop and EndTimestop or something. Here's an idea:
  • Change the branch in your Timestop event to check a new "cooldown" switch. Also turn on this switch when the timestop starts!
  • Add a new event, e.g. EndTimestopCooldown, that simply turns off the new switch.
  • Change the EndTimestop event so that it starts the timer again, calling the new EndTimestopCooldown event when it ends.

Thank you, it works. However there is still a problem: The timer is displayed in game and this is not very nice to see. Obviously this is desired when the time is stopped, but not also after the 10 seconds have expired. How could I not show the cooldown timer and keep the 10-second timer? Or even better, would there be a way to replace the cooldown timer with a HUD?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
Oh, I had assumed SRD's plugin might offer that, but it looks like it doesn't. One option could be to use the SetTimerLabel plugin command to label it as a cooldown, but I guess that's not ideal. In case it's helpful (e.g. for showing cooldown time with a HUD plugin or pictures etc), this script call should return the seconds remaining on the timer:
Code:
$gameTimer.seconds()


It's actually pretty easy to hide the timer but I couldn't find an existing plugin that lets you switch it on/off mid-game, so...I made one myself. :kaoswt: If you want to use it, make sure it loads after SRD's Timer Upgrade. :)
File link (Google Drive)
Code:
//=========================================================
// Cae_HideTimer.js
//=========================================================

/*:
 * @plugindesc v1.0 - Hides the timer display when a specific switch is on.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases the updateVisibility method of Sprite_Timer.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.0: Initial release.
 *
 * @param Switch ID
 * @text Switch ID
 * @type switch
 * @desc When this switch is on, the timer display will be hidden.
 * @default 0
 */

var Imported = Imported || {};			// Import namespace, var can redefine
Imported.Cae_HideTimer = 1.0;			// Import declaration

var CAE = CAE || {};				// Author namespace, var can redefine
CAE.HideTimer = CAE.HideTimer || {};		// Plugin namespace

(function(_) {

'use strict';

	_.swID = Number(PluginManager.parameters('Cae_HideTimer')['Switch ID'] || 0)

	_.isHidden = function() { return _.swID > 0 && $gameSwitches.value(_.swID); };

	_.Sprite_Timer_updateVisibility = Sprite_Timer.prototype.updateVisibility;
	Sprite_Timer.prototype.updateVisibility = function() {
		if (_.isHidden()) {
			this.visible = false;
		} else {
			_.Sprite_Timer_updateVisibility.call(this);
		}
	};

})(CAE.HideTimer);

An alternative (my personal preference for hidden timers) is to simply use a parallel event and a variable, e.g.
Code:
◆Comment:Update every 6 frames, i.e. 10 times/second.
:       :(Parallel events are interrupted when player changes map.)
◆Wait:6 frames
◆Comment:Count down to zero.
:       :(Set this variable before switching on this parallel event.)
◆Control Variables:#0001 Timer Variable -= 1
◆Comment:Do stuff when timer ends~
◆If:Timer Variable = 0
  ◆Text:None, Window, Bottom
  :    :Time's up!
  ◆Comment:Turn off this event's switch!
  ◆Control Switches:#0001 Enable Timer = OFF
  ◆
:End
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Oh, I had assumed SRD's plugin might offer that, but it looks like it doesn't. One option could be to use the SetTimerLabel plugin command to label it as a cooldown, but I guess that's not ideal. In case it's helpful (e.g. for showing cooldown time with a HUD plugin or pictures etc), this script call should return the seconds remaining on the timer:
Code:
$gameTimer.seconds()


It's actually pretty easy to hide the timer but I couldn't find an existing plugin that lets you switch it on/off mid-game, so...I made one myself. :kaoswt: If you want to use it, make sure it loads after SRD's Timer Upgrade. :)
File link (Google Drive)
Code:
//=========================================================
// Cae_HideTimer.js
//=========================================================

/*:
 * @plugindesc v1.0 - Hides the timer display when a specific switch is on.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases the updateVisibility method of Sprite_Timer.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.0: Initial release.
 *
 * @param Switch ID
 * @text Switch ID
 * @type switch
 * @desc When this switch is on, the timer display will be hidden.
 * @default 0
 */

var Imported = Imported || {};            // Import namespace, var can redefine
Imported.Cae_HideTimer = 1.0;            // Import declaration

var CAE = CAE || {};                // Author namespace, var can redefine
CAE.HideTimer = CAE.HideTimer || {};        // Plugin namespace

(function(_) {

'use strict';

    _.swID = Number(PluginManager.parameters('Cae_HideTimer')['Switch ID'] || 0)

    _.isHidden = function() { return _.swID > 0 && $gameSwitches.value(_.swID); };

    _.Sprite_Timer_updateVisibility = Sprite_Timer.prototype.updateVisibility;
    Sprite_Timer.prototype.updateVisibility = function() {
        if (_.isHidden()) {
            this.visible = false;
        } else {
            _.Sprite_Timer_updateVisibility.call(this);
        }
    };

})(CAE.HideTimer);

An alternative (my personal preference for hidden timers) is to simply use a parallel event and a variable, e.g.
Code:
◆Comment:Update every 6 frames, i.e. 10 times/second.
:       :(Parallel events are interrupted when player changes map.)
◆Wait:6 frames
◆Comment:Count down to zero.
:       :(Set this variable before switching on this parallel event.)
◆Control Variables:#0001 Timer Variable -= 1
◆Comment:Do stuff when timer ends~
◆If:Timer Variable = 0
  ◆Text:None, Window, Bottom
  :    :Time's up!
  ◆Comment:Turn off this event's switch!
  ◆Control Switches:#0001 Enable Timer = OFF
  ◆
:End

First of all, thank you very much for even writing a plugin. Unfortunately, this time I'm having some trouble making everything work. I noticed that sometimes, when events freeze, their graphics can collide with the player, while the "box" in front of them, which should instead be passable, is blocked, as if in reality the event was there.
trouble.png
Moreover, premising that I only tried the plugin (and for this I apologize), the first time the player stops time everything works perfectly: The 10-second timer is shown, while the cooldown timer is hidden. However, when the player tries to stop time a second time, even if the "HideTimer" switch is OFF, the 10-second timer is not shown, as well as the cooldown timer. In practice when the "HideTimer" switch is ON, I am no longer able to show the timer again.
Any solution?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
First of all, thank you very much for even writing a plugin. Unfortunately, this time I'm having some trouble making everything work. I noticed that sometimes, when events freeze, their graphics can collide with the player, while the "box" in front of them, which should instead be passable, is blocked, as if in reality the event was there.
View attachment 109542
Oh, yes. Events always occupy one tile on the map: when they move, their "real" location is immediately changed to the next tile, and their sprite moves gradually to that position. I guess it would be good to have an option for the events to finish moving after the timestop starts? I'll see if I can get something like that to work. :cutesmile:

@Warserker, edit: wow, that was easier than I thought it would be. I uploaded v1.2 of that DisableEventStart plugin, now it has "wait for move" and "instant" options for the freeze effect. Same link as before: file link (Google Drive). :kaopride: [edit2: fixed link. >_<]

Moreover, premising that I only tried the plugin (and for this I apologize), the first time the player stops time everything works perfectly: The 10-second timer is shown, while the cooldown timer is hidden. However, when the player tries to stop time a second time, even if the "HideTimer" switch is OFF, the 10-second timer is not shown, as well as the cooldown timer. In practice when the "HideTimer" switch is ON, I am no longer able to show the timer again.
Any solution?
:kaoswt: I can't reproduce this issue, with or without SRD's Timer Upgrade plugin. It seems to appear/disappear as expected for me, however many times I restart the timer. Are you sure you turned the switch off again at the end of the cooldown? If you press F9 during play-test it will show the debug window, where you can check which switches are on/off. :)
 
Last edited:

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Oh, yes. Events always occupy one tile on the map: when they move, their "real" location is immediately changed to the next tile, and their sprite moves gradually to that position. I guess it would be good to have an option for the events to finish moving after the timestop starts? I'll see if I can get something like that to work. :cutesmile:

@Warserker, edit: wow, that was easier than I thought it would be. I uploaded v1.2 of that DisableEventStart plugin, now it has "wait for move" and "instant" options for the freeze effect. Same link as before: file link (Google Drive). :kaopride:


:kaoswt: I can't reproduce this issue, with or without SRD's Timer Upgrade plugin. It seems to appear/disappear as expected for me, however many times I restart the timer. Are you sure you turned the switch off again at the end of the cooldown? If you press F9 during play-test it will show the debug window, where you can check which switches are on/off. :)


For some reason the downloaded plugin results in version 1.1, so I do not have access to these options.

I also checked by pressing F9 and yes, the switch is turned off, but the timer continues to be hidden. I realized only now that if within 10 seconds of the timer you enter the game menu or even in the debug window and then close it, the timer will reappear. I do not understand why though.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
For some reason the downloaded plugin results in version 1.1, so I do not have access to these options.
Oops, I pasted the wrong link in there... :kaoslp:
This one links to the correct file for me: link
Or full code here:
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.2 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start and update methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.2: Added "wait for move" option for freeze effect!
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 * 
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Exception String
 * @text Exception String
 * @type text
 * @desc If an event contains this text in its name, it will always be able to be activated.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type select
 * @option None
 * @option Wait for Move
 * @option Instant
 * @desc If "instant", affected events will freeze where they are.
 * If "wait for move", events will freeze after finishing their move.
 * @default None
 */

var Imported = Imported || {};				// Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.2;			// Import declaration

var CAE = CAE || {};					// Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};	// Plugin namespace

(function(_) {

'use strict';

	_.params = PluginManager.parameters('Cae_DisableEventStart');		// Process user parameters

	_.swID = Number(_.params['Disable Switch']);
	_.excl = String(_.params['Exception String']);
	_.freeze = _.params['Freeze Effect'];

	_.isDisabled = function(event) {
		return _.swID > 0 && $gameSwitches.value(_.swID) && !event.event().name.contains(_.excl);
	};

	_.isFrozen = function(event) {
		let test = true;
		switch (_.freeze) {
			case 'Wait for Move':
				test = !event.isMoving();
			case 'Instant':
				test = test && _.isDisabled(event);
				return test;
			default:
				return false;
		}
	};

	_.Game_Event_start = Game_Event.prototype.start;
	Game_Event.prototype.start = function() {
		if (!_.isDisabled(this)) _.Game_Event_start.call(this);
	};

	_.Game_Event_update = Game_Event.prototype.update;
	Game_Event.prototype.update = function() {
		if (!_.isFrozen(this)) _.Game_Event_update.call(this);
	};

})(CAE.DisableEventStart);
I also checked by pressing F9 and yes, the switch is turned off, but the timer continues to be hidden. I realized only now that if within 10 seconds of the timer you enter the game menu or even in the debug window and then close it, the timer will reappear. I do not understand why though.
I still haven't managed to replicate that behaviour in a test project with SRD's Timer Upgrade and my HideTimer & DisableEventStart plugins. I've tried starting the timer via Plugin Commands and event command, accessing various menus mid-timer, changing maps, hiding/showing the timer several times before & after it ends, etc.

If you're still interested in using the plugin to hide the timer, maybe post a list/screenshot(s) of all the plugins you're using? I'm not sure how it could conflict with another plugin, assuming mine loads afterwards, but I don't have any other ideas. :kaoswt:
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Oops, I pasted the wrong link in there... :kaoslp:
This one links to the correct file for me: link
Or full code here:
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.2 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start and update methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.2: Added "wait for move" option for freeze effect!
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 *
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Exception String
 * @text Exception String
 * @type text
 * @desc If an event contains this text in its name, it will always be able to be activated.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type select
 * @option None
 * @option Wait for Move
 * @option Instant
 * @desc If "instant", affected events will freeze where they are.
 * If "wait for move", events will freeze after finishing their move.
 * @default None
 */

var Imported = Imported || {};                // Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.2;            // Import declaration

var CAE = CAE || {};                    // Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};    // Plugin namespace

(function(_) {

'use strict';

    _.params = PluginManager.parameters('Cae_DisableEventStart');        // Process user parameters

    _.swID = Number(_.params['Disable Switch']);
    _.excl = String(_.params['Exception String']);
    _.freeze = _.params['Freeze Effect'];

    _.isDisabled = function(event) {
        return _.swID > 0 && $gameSwitches.value(_.swID) && !event.event().name.contains(_.excl);
    };

    _.isFrozen = function(event) {
        let test = true;
        switch (_.freeze) {
            case 'Wait for Move':
                test = !event.isMoving();
            case 'Instant':
                test = test && _.isDisabled(event);
                return test;
            default:
                return false;
        }
    };

    _.Game_Event_start = Game_Event.prototype.start;
    Game_Event.prototype.start = function() {
        if (!_.isDisabled(this)) _.Game_Event_start.call(this);
    };

    _.Game_Event_update = Game_Event.prototype.update;
    Game_Event.prototype.update = function() {
        if (!_.isFrozen(this)) _.Game_Event_update.call(this);
    };

})(CAE.DisableEventStart);

I still haven't managed to replicate that behaviour in a test project with SRD's Timer Upgrade and my HideTimer & DisableEventStart plugins. I've tried starting the timer via Plugin Commands and event command, accessing various menus mid-timer, changing maps, hiding/showing the timer several times before & after it ends, etc.

If you're still interested in using the plugin to hide the timer, maybe post a list/screenshot(s) of all the plugins you're using? I'm not sure how it could conflict with another plugin, assuming mine loads afterwards, but I don't have any other ideas. :kaoswt:


Hello again.
Unfortunately, after trying the new version of the plugin the situation has become even worse: now for some reason, the events are not freezed by the plugin even if the switch is active.
I did not change anything in the events, the only thing I did was update the plugin, so I don't understand how this is possible.

Regarding the plugins I use, here it is:
plugins.jpg
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
Oh no! :kaodes:

I don't think any of the other plugins you're using should conflict with mine... The Freeze Effect parameter is now a list: None, Wait for Move, or Instant. Maybe double-check you've got that parameter set up correctly? :kaoswt:

I've identified two possible reasons for the plugin "not working", both to do with plugin parameter values:
  • If you make the Exception String parameter blank, all events will be marked as exceptions...so none of them will be disabled/frozen. :kaoswt2:
  • If you input a value other than "Wait for Move" or "Instant" for the Freeze Effect parameter (case-sensitive!) it will be treated as None. This could be possible if you're inputting it as text, or using an editor older than version v1.5.0.
I've updated the plugin with some extra checks to prevent these issues in case you're still having trouble with it. Here's the code & link:
File link (Google Drive)
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.3 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start and update methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.3: Freeze Effect parameter is now case-insensitive.
 *        Added check for empty exception string.
 *   1.2: Added "wait for move" option for freeze effect!
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 * 
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Exception String
 * @text Exception String
 * @type text
 * @desc If an event contains this text in its name, it will always be able to be activated.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type select
 * @option None
 * @option Wait for Move
 * @option Instant
 * @desc If "Instant", affected events will freeze where they are.
 * If "Wait for Move", freeze applies when event stops moving.
 * @default None
 */

var Imported = Imported || {};				// Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.3;			// Import declaration

var CAE = CAE || {};					// Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};	// Plugin namespace

(function(_) {

'use strict';

	_.params = PluginManager.parameters('Cae_DisableEventStart');		// Process user parameters

	_.swID = Number(_.params['Disable Switch']);
	_.excl = String(_.params['Exception String']);
	_.freeze = _.params['Freeze Effect'];

	_.isExcluded = function(name) { return _.excl !== '' && name.contains(_.excl); };

	_.isDisabled = function(event) {
		return _.swID > 0 && $gameSwitches.value(_.swID) && !_.isExcluded(event.event().name);
	};

	_.isFrozen = function(event) {
		let test = true;
		switch (String(_.freeze).toUpperCase()) {
			case 'WAIT FOR MOVE':
				test = !event.isMoving();
			case 'INSTANT':
				test = test && _.isDisabled(event);
				return test;
			default:
				return false;
		}
	};

	_.Game_Event_start = Game_Event.prototype.start;
	Game_Event.prototype.start = function() {
		if (!_.isDisabled(this)) _.Game_Event_start.call(this);
	};

	_.Game_Event_update = Game_Event.prototype.update;
	Game_Event.prototype.update = function() {
		if (!_.isFrozen(this)) _.Game_Event_update.call(this);
	};

})(CAE.DisableEventStart);
I hope it works this time; sorry for all the difficulties! :kaocry:
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Oh no! :kaodes:

I don't think any of the other plugins you're using should conflict with mine... The Freeze Effect parameter is now a list: None, Wait for Move, or Instant. Maybe double-check you've got that parameter set up correctly? :kaoswt:

I've identified two possible reasons for the plugin "not working", both to do with plugin parameter values:
  • If you make the Exception String parameter blank, all events will be marked as exceptions...so none of them will be disabled/frozen. :kaoswt2:
  • If you input a value other than "Wait for Move" or "Instant" for the Freeze Effect parameter (case-sensitive!) it will be treated as None. This could be possible if you're inputting it as text, or using an editor older than version v1.5.0.
I've updated the plugin with some extra checks to prevent these issues in case you're still having trouble with it. Here's the code & link:
File link (Google Drive)
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.3 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start and update methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.3: Freeze Effect parameter is now case-insensitive.
 *        Added check for empty exception string.
 *   1.2: Added "wait for move" option for freeze effect!
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 *
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Exception String
 * @text Exception String
 * @type text
 * @desc If an event contains this text in its name, it will always be able to be activated.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type select
 * @option None
 * @option Wait for Move
 * @option Instant
 * @desc If "Instant", affected events will freeze where they are.
 * If "Wait for Move", freeze applies when event stops moving.
 * @default None
 */

var Imported = Imported || {};                // Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.3;            // Import declaration

var CAE = CAE || {};                    // Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};    // Plugin namespace

(function(_) {

'use strict';

    _.params = PluginManager.parameters('Cae_DisableEventStart');        // Process user parameters

    _.swID = Number(_.params['Disable Switch']);
    _.excl = String(_.params['Exception String']);
    _.freeze = _.params['Freeze Effect'];

    _.isExcluded = function(name) { return _.excl !== '' && name.contains(_.excl); };

    _.isDisabled = function(event) {
        return _.swID > 0 && $gameSwitches.value(_.swID) && !_.isExcluded(event.event().name);
    };

    _.isFrozen = function(event) {
        let test = true;
        switch (String(_.freeze).toUpperCase()) {
            case 'WAIT FOR MOVE':
                test = !event.isMoving();
            case 'INSTANT':
                test = test && _.isDisabled(event);
                return test;
            default:
                return false;
        }
    };

    _.Game_Event_start = Game_Event.prototype.start;
    Game_Event.prototype.start = function() {
        if (!_.isDisabled(this)) _.Game_Event_start.call(this);
    };

    _.Game_Event_update = Game_Event.prototype.update;
    Game_Event.prototype.update = function() {
        if (!_.isFrozen(this)) _.Game_Event_update.call(this);
    };

})(CAE.DisableEventStart);
I hope it works this time; sorry for all the difficulties! :kaocry:

Ok, the plugin for freezing events works perfectly now. Re-checking I noticed that the Freeze Effect parameter was blank, so I probably just forgot to save before closing. I apologize for wasting your time on such a stupid mistake.

Unfortunately I still can't correctly run the plugin to hide the timer: the first time it works, while from the second on the timer is no longer shown even when desired, unless you open the game menu or the debug window.
Did I mistake something with the events? I would not want to waste your time again due to small things.

event1.png event2.png event3.png
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
Yay, halfway there! :kaothx:

For the timer visibility...your events look OK. :) I took another look at SRD's plugin's code and I think I've found out what's happening: for some reason he's used opacity 255|0 instead of visibility on|off. Not sure how I missed that when I was testing before, sorry! Luckily it's an easy fix, here's an updated version of the plugin: view file (Google Drive).
Code:
//=========================================================
// Cae_HideTimer.js
//=========================================================

/*:
 * @plugindesc v1.1 - Hides the timer display when a specific switch is on.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases the updateVisibility method of Sprite_Timer.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.1: Added failsafe for compatibility: visible = true before callback.
 *   1.0: Initial release.
 *
 * @param Switch ID
 * @text Switch ID
 * @type switch
 * @desc When this switch is on, the timer display will be hidden.
 * @default 0
 */

var Imported = Imported || {};			// Import namespace, var can redefine
Imported.Cae_HideTimer = 1.1;			// Import declaration

var CAE = CAE || {};				// Author namespace, var can redefine
CAE.HideTimer = CAE.HideTimer || {};		// Plugin namespace

(function(_) {

'use strict';

	_.swID = Number(PluginManager.parameters('Cae_HideTimer')['Switch ID'] || 0);

	_.isHidden = function() { return _.swID > 0 && $gameSwitches.value(_.swID); };

	_.Sprite_Timer_updateVisibility = Sprite_Timer.prototype.updateVisibility;
	Sprite_Timer.prototype.updateVisibility = function() {
		if (_.isHidden()) {
			this.visible = false;
		} else {
			this.visible = true;	// SRD uses an override with opacity instead of visible >_>
			_.Sprite_Timer_updateVisibility.call(this);
		}
	};

})(CAE.HideTimer);
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Yay, halfway there! :kaothx:

For the timer visibility...your events look OK. :) I took another look at SRD's plugin's code and I think I've found out what's happening: for some reason he's used opacity 255|0 instead of visibility on|off. Not sure how I missed that when I was testing before, sorry! Luckily it's an easy fix, here's an updated version of the plugin: view file (Google Drive).
Code:
//=========================================================
// Cae_HideTimer.js
//=========================================================

/*:
 * @plugindesc v1.1 - Hides the timer display when a specific switch is on.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases the updateVisibility method of Sprite_Timer.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.1: Added failsafe for compatibility: visible = true before callback.
 *   1.0: Initial release.
 *
 * @param Switch ID
 * @text Switch ID
 * @type switch
 * @desc When this switch is on, the timer display will be hidden.
 * @default 0
 */

var Imported = Imported || {};            // Import namespace, var can redefine
Imported.Cae_HideTimer = 1.1;            // Import declaration

var CAE = CAE || {};                // Author namespace, var can redefine
CAE.HideTimer = CAE.HideTimer || {};        // Plugin namespace

(function(_) {

'use strict';

    _.swID = Number(PluginManager.parameters('Cae_HideTimer')['Switch ID'] || 0);

    _.isHidden = function() { return _.swID > 0 && $gameSwitches.value(_.swID); };

    _.Sprite_Timer_updateVisibility = Sprite_Timer.prototype.updateVisibility;
    Sprite_Timer.prototype.updateVisibility = function() {
        if (_.isHidden()) {
            this.visible = false;
        } else {
            this.visible = true;    // SRD uses an override with opacity instead of visible >_>
            _.Sprite_Timer_updateVisibility.call(this);
        }
    };

})(CAE.HideTimer);

Thanks a lot, now seems to work perfectly.
Unfortunately I did not have enough time to test it properly, so I will update in case of troubles. Thank you again.
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
Hello again.
In these days I finally had the opportunity to try the timestop, and I confirm that everything works great.

I had thought of making the player able to interact with some events during the time stop (for example stealing a key to a character while it is freezed).
Since the plugin completely eliminates the possibility of interacting with events, I tried to create a new page in an exception event, making it "freezed" using a switch, but obviously I could not make it work, finding the issues that occurred before I used the plugin.

Would there be any solution to implement this function?
Thanks.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
:kaohi: I think I've got a solution! I updated the plugin so it has separate "Exception String" parameters for disable and freeze. Now an event will be frozen if the switch is on and the event does not have the "Freeze Exception" text anywhere in its name. This means you can set an event to be immune to the disable but not the freeze, then put something like this in your event to make it react differently during the time stop:
Code:
◆If:timeStopSwitch is ON
  ◆Text:Actor1(5), Window, Bottom
  :    :Help, I can't move!
  ◆
:Else
  ◆Text:Actor1(5), Window, Bottom
  :    :I can move around!
  ◆
:End
Link: view file (Google Drive)
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.4 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start, update, and lock methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.4: Added separate exception string parameter for freeze effect.
 *        Events immune to disable are not automatically immune to freeze.
 *   1.3: Freeze Effect parameter is now case-insensitive.
 *        Added check for empty exception string.
 *   1.2: Added "wait for move" option for freeze effect!
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 * 
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Disable Exception
 * @text Disable Exception
 * @type text
 * @desc Events with this text in their name will not be disabled.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type select
 * @option None
 * @option Wait for Move
 * @option Instant
 * @desc If "Instant", events will freeze where they are.
 * If "Wait for Move", freeze applies when event stops moving.
 * @default None
 *
 * @param Freeze Exception
 * @text Freeze Exception
 * @type text
 * @desc Events with this text in their name will not be frozen.
 * This text can be the same as Disable Exception.
 * @default ##
 */

var Imported = Imported || {};				// Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.4;			// Import declaration

var CAE = CAE || {};					// Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};	// Plugin namespace

(function(_) {

'use strict';

	_.params = PluginManager.parameters('Cae_DisableEventStart');		// Process user parameters

	_.swID		= Number(_.params['Disable Switch']);
	_.exDisable	= String(_.params['Disable Exception']);
	_.freeze	= String(_.params['Freeze Effect']);
	_.exFreeze	= String(_.params['Freeze Exception']);

	_.exTextCheck = function(name, exText) { return exText !== '' && name.contains(exText); };

	_.isSwitchOn = function() { return _.swID > 0 && $gameSwitches.value(_.swID); };

	_.isDisabled = function(event) {
		return _.isSwitchOn() && !_.exTextCheck(event.event().name, _.exDisable);
	};

	_.isFrozen = function(event) {
		if (_.exTextCheck(event.event().name, _.exFreeze)) return false;
		let test = true;
		switch (_.freeze.toUpperCase()) {
			case 'WAIT FOR MOVE':
				test = !event.isMoving();
			case 'INSTANT':
				test = test && _.isSwitchOn();
				return test;
			default:
				return false;
		}
	};

	_.Game_Event_start = Game_Event.prototype.start;
	Game_Event.prototype.start = function() {
		if (!_.isDisabled(this)) _.Game_Event_start.call(this);
	};

	_.Game_Event_update = Game_Event.prototype.update;
	Game_Event.prototype.update = function() {
		if (!_.isFrozen(this)) _.Game_Event_update.call(this);
	};

	_.Game_Event_lock = Game_Event.prototype.lock;
	Game_Event.prototype.lock = function() {
		if (!_.isFrozen(this)) _.Game_Event_lock.call(this);
	};

})(CAE.DisableEventStart);
I did change the name of one of the existing plugin parameters, so double-check the Plugin Manager to make sure they haven't reset. :kaoswt:
 

Warserker

Villager
Member
Joined
Feb 11, 2019
Messages
13
Reaction score
2
First Language
Italian
Primarily Uses
RMMV
:kaohi: I think I've got a solution! I updated the plugin so it has separate "Exception String" parameters for disable and freeze. Now an event will be frozen if the switch is on and the event does not have the "Freeze Exception" text anywhere in its name. This means you can set an event to be immune to the disable but not the freeze, then put something like this in your event to make it react differently during the time stop:
Code:
◆If:timeStopSwitch is ON
  ◆Text:Actor1(5), Window, Bottom
  :    :Help, I can't move!
  ◆
:Else
  ◆Text:Actor1(5), Window, Bottom
  :    :I can move around!
  ◆
:End
Link: view file (Google Drive)
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.4 - Stop events from starting while a switch is on. Can apply visual freeze to affected events.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases start, update, and lock methods of Game_Event.
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.4: Added separate exception string parameter for freeze effect.
 *        Events immune to disable are not automatically immune to freeze.
 *   1.3: Freeze Effect parameter is now case-insensitive.
 *        Added check for empty exception string.
 *   1.2: Added "wait for move" option for freeze effect!
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 *
 * @param Disable Switch
 * @text Disable Switch
 * @type switch
 * @desc When this switch is on, normal event interactions are disabled.
 * @default 0
 *
 * @param Disable Exception
 * @text Disable Exception
 * @type text
 * @desc Events with this text in their name will not be disabled.
 * @default &&
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @type select
 * @option None
 * @option Wait for Move
 * @option Instant
 * @desc If "Instant", events will freeze where they are.
 * If "Wait for Move", freeze applies when event stops moving.
 * @default None
 *
 * @param Freeze Exception
 * @text Freeze Exception
 * @type text
 * @desc Events with this text in their name will not be frozen.
 * This text can be the same as Disable Exception.
 * @default ##
 */

var Imported = Imported || {};                // Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.4;            // Import declaration

var CAE = CAE || {};                    // Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};    // Plugin namespace

(function(_) {

'use strict';

    _.params = PluginManager.parameters('Cae_DisableEventStart');        // Process user parameters

    _.swID        = Number(_.params['Disable Switch']);
    _.exDisable    = String(_.params['Disable Exception']);
    _.freeze    = String(_.params['Freeze Effect']);
    _.exFreeze    = String(_.params['Freeze Exception']);

    _.exTextCheck = function(name, exText) { return exText !== '' && name.contains(exText); };

    _.isSwitchOn = function() { return _.swID > 0 && $gameSwitches.value(_.swID); };

    _.isDisabled = function(event) {
        return _.isSwitchOn() && !_.exTextCheck(event.event().name, _.exDisable);
    };

    _.isFrozen = function(event) {
        if (_.exTextCheck(event.event().name, _.exFreeze)) return false;
        let test = true;
        switch (_.freeze.toUpperCase()) {
            case 'WAIT FOR MOVE':
                test = !event.isMoving();
            case 'INSTANT':
                test = test && _.isSwitchOn();
                return test;
            default:
                return false;
        }
    };

    _.Game_Event_start = Game_Event.prototype.start;
    Game_Event.prototype.start = function() {
        if (!_.isDisabled(this)) _.Game_Event_start.call(this);
    };

    _.Game_Event_update = Game_Event.prototype.update;
    Game_Event.prototype.update = function() {
        if (!_.isFrozen(this)) _.Game_Event_update.call(this);
    };

    _.Game_Event_lock = Game_Event.prototype.lock;
    Game_Event.prototype.lock = function() {
        if (!_.isFrozen(this)) _.Game_Event_lock.call(this);
    };

})(CAE.DisableEventStart);
I did change the name of one of the existing plugin parameters, so double-check the Plugin Manager to make sure they haven't reset. :kaoswt:

Thanks again.
I tried to make sure that the player could steal a key from a freezed npc to open a chest but unfortunately I'm experiencing two problems:

- I used the Quick Event Creation option to create the chest, then adding as a condition to open it to have a key. Once the key has been stolen from the NPC, if you try to open the chest while the time is not stopped, everything works. But if you try to open it while the time is stopped, for some reason, ironically, the game itself will freeze, making any action impossible.

- To get the key to the player I created these two events:

1.png 2.png

But when if the Self Switch A is activated, and therefore the page of the event changes, once the time starts moving, the event will not move, of course, from where it stopped, but from the beginning. How could I solve?
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,684
Reaction score
2,766
First Language
EN
Primarily Uses
RMMZ
Thanks again.
I tried to make sure that the player could steal a key from a freezed npc to open a chest but unfortunately I'm experiencing two problems:

- I used the Quick Event Creation option to create the chest, then adding as a condition to open it to have a key. Once the key has been stolen from the NPC, if you try to open the chest while the time is not stopped, everything works. But if you try to open it while the time is stopped, for some reason, ironically, the game itself will freeze, making any action impossible.
Oh, whoops. I think this is because it's waiting for the move route to finish but the event cannot move while frozen, so the game gets stuck. :kaoswt:

As a workaround, you can try to avoid assigning "Wait for Completion" move routes to frozen events. I'm guessing that will be quite easy since you're making them act differently when frozen anyway, right? ^_^

For fixing this in the plugin code, I can think of three approaches:
  1. Apply the move routes, but do not actually move the event until it is unfrozen.
  2. Ignore move routes applied to frozen events.
  3. Let move routes work as normal on frozen events.
Options 1 & 2 would be fairly easy to do; I think option 3 would require a major plugin rewrite, :kaoback: so I'm going to avoid that. I'll see about updating the plugin sometime tomorrow~ :kaothx:

Edit @Warserker: OK all done! In case you're interested, I've implemented options 1 & 2 and added a parameter, 'Ignore Frozen Moves', that lets you choose which one to use. I also added a 'Trigger Disable' parameter in case you want to work around the event disabling yourself using branches. Same file link as always, code is in the spoiler~
Code:
//=========================================================
// Cae_DisableEventStart.js
//=========================================================

/*:
 * @plugindesc v1.5 - Can stop events from starting and/or apply visual freeze while a switch is on.
 * @author Caethyril
 *
 * @help Plugin Commands:
 *   None.
 *
 * Compatibility:
 *   Aliases:
 *     Game_Event:
 *       start, update, lock, forceMoveRoute, isMoveRouteForcing
 *
 * Terms of use:
 *   Free to use and modify.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Update log:
 *   1.5: Interpreter failsafe: ignore active move routes on frozen events.
 *        Plugin can now be used exclusively for freeze effect if desired.
 *   1.4: Added separate exception string parameter for freeze effect.
 *        Events immune to disable are not automatically immune to freeze.
 *   1.3: Freeze Effect parameter is now case-insensitive.
 *        Added check for empty exception string.
 *   1.2: Added "wait for move" option for freeze effect!
 *   1.1: Added optional visual freeze effect for all affected map events.
 *   1.0: Initial release.
 *
 * @param Switch ID
 * @text Switch ID
 * @type switch
 * @desc When this switch is on, the plugin is active.
 * @default 0
 *
 * @param --- Disable Options ---
 * @text --- Disable Options ---
 * @type select
 * @desc Options for the disable effect.
 *
 * @param Trigger Disable
 * @text Trigger Disable
 * @parent --- Disable Options ---
 * @type boolean
 * @desc If true, normal event interactions are disabled while the switch is on.
 * @default true
 *
 * @param Disable Exception
 * @text Disable Exception
 * @parent --- Disable Options ---
 * @type text
 * @desc Events with this text in their name will not be disabled.
 * @default &&
 *
 * @param --- Freeze Options ---
 * @text --- Freeze Options ---
 * @type select
 * @desc Options for the freeze effect.
 *
 * @param Freeze Effect
 * @text Freeze Effect
 * @parent --- Freeze Options ---
 * @type select
 * @option None
 * @option Wait for Move
 * @option Instant
 * @desc If "Instant", events will freeze where they are.
 * If "Wait for Move", freeze applies when event stops moving.
 * @default None
 *
 * @param Freeze Exception
 * @text Freeze Exception
 * @parent --- Freeze Options ---
 * @type text
 * @desc Events with this text in their name will not be frozen.
 * This text can be the same as Disable Exception.
 * @default ##
 *
 * @param Ignore Frozen Moves
 * @text Ignore Frozen Moves
 * @parent --- Freeze Options ---
 * @type boolean
 * @desc If true, move routes for frozen events are ignored.
 * If false, moves process when the event unfreezes.
 * @default true
 */

var Imported = Imported || {};				// Import namespace, var can redefine
Imported.Cae_DisableEventStart = 1.5;			// Import declaration

var CAE = CAE || {};					// Author namespace, var can redefine
CAE.DisableEventStart = CAE.DisableEventStart || {};	// Plugin namespace

(function(_) {

'use strict';

	_.params = PluginManager.parameters('Cae_DisableEventStart');		// Process user parameters

	_.swID		= Number(_.params['Switch ID']);
	_.disable	= _.params['Trigger Disable'] === 'true';
	_.exDisable	= String(_.params['Disable Exception']);
	_.freeze	= String(_.params['Freeze Effect']);
	_.exFreeze	= String(_.params['Freeze Exception']);
	_.noFreezeMove	= _.params['Ignore Frozen Moves'] === 'true';

	_.exTextCheck = function(name, exText) { return exText !== '' && name.contains(exText); };

	_.isSwitchOn = function() { return _.swID > 0 && $gameSwitches.value(_.swID); };

	_.isDisabled = function(event) {
		return _.disable && _.isSwitchOn() && !_.exTextCheck(event.event().name, _.exDisable);
	};

	_.isFrozen = function(event) {
		if (_.exTextCheck(event.event().name, _.exFreeze)) return false;
		let test = true;
		switch (_.freeze.toUpperCase()) {
			case 'WAIT FOR MOVE':
				test = !event.isMoving();
			case 'INSTANT':
				test = test && _.isSwitchOn();
				return test;
			default:
				return false;
		}
	};

	// Start if not disabled.
	_.Game_Event_start = Game_Event.prototype.start;
	Game_Event.prototype.start = function() {
		if (!_.isDisabled(this)) _.Game_Event_start.call(this);
	};

	// Update if not frozen.
	_.Game_Event_update = Game_Event.prototype.update;
	Game_Event.prototype.update = function() {
		if (!_.isFrozen(this)) _.Game_Event_update.call(this);
	};

	// Turn to player when activated only if not frozen.
	_.Game_Event_lock = Game_Event.prototype.lock;
	Game_Event.prototype.lock = function() {
		if (!_.isFrozen(this)) _.Game_Event_lock.call(this);
	};

	// Skip assigning move routes to frozen events if appropriate.
	_.Game_Event_forceMoveRoute = Game_Event.prototype.forceMoveRoute;
	Game_Event.prototype.forceMoveRoute = function(moveRoute) {
		if (_.noFreezeMove && _.isFrozen(this)) return;
		_.Game_Event_forceMoveRoute.call(this, moveRoute);
	};

	// Frozen events cannot move.
	_.Game_Event_isMoveRouteForcing = Game_Event.prototype.isMoveRouteForcing;
	Game_Event.prototype.isMoveRouteForcing = function() {
		if (_.isFrozen(this)) return false;
		return _.Game_Event_isMoveRouteForcing.call(this);
	};

})(CAE.DisableEventStart);

- To get the key to the player I created these two events:


But when if the Self Switch A is activated, and therefore the page of the event changes, once the time starts moving, the event will not move, of course, from where it stopped, but from the beginning. How could I solve?
You can put everything on the first event page using another branch to check the self-switch, e.g.
Code:
◆If:Self Switch A is OFF
  ◆If:disableEvents is OFF
    ◆Text:None, Window, Bottom
    :    :"I won't give you the key!"
    ◆
  :Else
    ◆Change Items:Key + 1
    ◆Control Self Switch:A = ON
    ◆Text:None, Dim, Bottom
    :    :Key found!
    ◆
  :End
  ◆
:Else
  ◆If:disableEvents is OFF
    ◆Text:None, Window, Bottom
    :    :"Hey, where's my key?"
    ◆
  :Else
    ◆Text:None, Dim, Bottom
    :    :You've already taken the key.
    ◆
  :End
  ◆
:End
Seperate event pages are mostly for changing an event's appearance, trigger, or auto-move route. :)
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

I have game ideas, but none of them would fit the theme for IGMC. XD
Why the heck do I keep comparing my games to ones made by huge companies? I'd love them to have that level of polish but I'm simply not good enough.
Hell of a day at the London Games Market! :D

1656892272017.png

Check out my haul!

Forum statistics

Threads
123,303
Messages
1,155,648
Members
161,722
Latest member
Shattered_Angel
Top