[RMMV] Changing Battle Screen Transition Animations

studwb22

Veteran
Veteran
Joined
Dec 30, 2020
Messages
52
Reaction score
12
First Language
English
Primarily Uses
RMMV
I am using KMS_SpiralEncount to create a spiral effect when transitioning from field map to battle screen. However I want to change the "Tint" of that transition based on whether or not the battle is a surprise attack (player surprises enemy), an ambush (enemy surprises player) or neutral battle (normal encounter). Does anyone know of a way to do this?

I am also using YEP_ForceAdvantage which allows for a common event to be set with each of these scenarios see attached screenshot. Is there a way to take advantage of these common event links to accomplish the screen tint on the transition?

[EDIT] Ok so I have figured out how to tint the screen using the Tint Screen Command. I have this set up on a common event with a parallel trigger but it keeps automatically triggering as soon as the map is loaded up and not only when there is a pre-emptive battle. Any help is greatly appreciated. New screenshot added to show the common event.
 

Attachments

  • BattleAdvantageIssue1.png
    BattleAdvantageIssue1.png
    183 KB · Views: 2
  • EventMapping.png
    EventMapping.png
    109.6 KB · Views: 2
  • Screenshot_8.png
    Screenshot_8.png
    94.7 KB · Views: 1
Last edited:

MechPen

Villager
Member
Joined
Nov 4, 2018
Messages
28
Reaction score
41
First Language
English
Primarily Uses
RMMV
Parallel does that; just set it up as normal.

One could very easily set up the tint from code, but then how could it be changed back? and how could the previous tint be saved and restored?
 

studwb22

Veteran
Veteran
Joined
Dec 30, 2020
Messages
52
Reaction score
12
First Language
English
Primarily Uses
RMMV
Parallel does that; just set it up as normal.

One could very easily set up the tint from code, but then how could it be changed back? and how could the previous tint be saved and restored?
Thank you.
 

MechPen

Villager
Member
Joined
Nov 4, 2018
Messages
28
Reaction score
41
First Language
English
Primarily Uses
RMMV
SpiralEncount calls the original updateEncounterEffect.

this should get you close.


JavaScript:
Yanfly.FAdv.BattleManager_setup = BattleManager.setup;
BattleManager.setup = function(troopId, canEscape, canLose) {
    Yanfly.FAdv.BattleManager_setup.call(this, troopId, canEscape, canLose);
    this.checkForceAdvantage(this._forceAdvantage);
};

Scene_Map.prototype.updateEncounterEffect = function() {
    if (this._encounterEffectDuration > 0) {
        this._encounterEffectDuration--;
        var speed = this.encounterEffectSpeed();
        var n = speed - this._encounterEffectDuration;
        var p = n / speed;
        var q = ((p - 1) * 20 * p + 5) * p + 1;
        var zoomX = $gamePlayer.screenX();
        var zoomY = $gamePlayer.screenY() - 24;
        if (n === 2) {
            $gameScreen.setZoom(zoomX, zoomY, 1);
            this.snapForBattleBackground();
            this.startFlashForEncounter(speed / 2);
        }
        $gameScreen.setZoom(zoomX, zoomY, q);
        if (n === Math.floor(speed / 6)) {
            this.startFlashForEncounter(speed / 2);
        }
        if (n === Math.floor(speed / 2)) {
            BattleManager.playBattleBgm();
            this.startFadeOut(this.fadeSpeed());
        }
        
        // screen tint stuff.
        if (this._encounterEffectDuration == 58) {
            var tintColor = [0,0,0,0];
            if (BattleManager._preemptive) { tintColor = [255, 0, 0, 0]; }
            else if (BattleManager._surprise) { tintColor = [0, 0, 255, 0]; }
            $gameScreen.startTint(tintColor, 50);
        } else if (this._encounterEffectDuration == 1) {
            var tintColor = [0, 0, 0, 0];
            $gameScreen.startTint(tintColor, 1);
        }
    }
};
 

Latest Threads

Latest Posts

Latest Profile Posts

I wrote RPGMakerMZ JavaScript reference in Japanese.
But I think you'll be able to read it through the translator.

back in April of 2019, I watched my friend's art stream on twitch. that was when I got inspired to draw most of the assets for my game. it's been a LONG journey since, but totally worth it.
RPG MZ multiplayer in development
Square-Enix, why you didn't released the classic Dragon Quests on Steam yet? :kaocry:
This is by far my most favorite boss monster I've made, its name is Gosck

Forum statistics

Threads
109,139
Messages
1,042,482
Members
141,647
Latest member
Juckz
Top