Prevent scene cancel with Right Click or Back Button

Status
Not open for further replies.

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
155
Reaction score
22
Primarily Uses
Hello there!
I'm currently creating a scene (made out of Window_Selectable and Window_Base) and I want the player to exit the scene only by pressing the button I have drawn in the scene.

In the Window_Selectable part I have already a processCancel function present in which I have attempted to stop player from exiting the scene:
Code:
    Window_CardsIndex.prototype.processCancel = function() {
        Window_Selectable.prototype.processCancel.call(this);
        Window_CardsIndex.lastTopRow = this.topRow();
        Window_CardsIndex.lastIndex = this.index();
        console.log("you have exited");  // < This does not work when I right click in the window
    };
I also have a Window_CardsIndex.prototype.processTouch function present, and this is the second attempt to prevent the player from exiting the scene:
Code:
Window_CardsIndex.prototype.processTouch = function() {
    if (this.isOpenAndActive()) {
        if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) {
            this._touching = true;
            this.onTouch(true);
        } else if (TouchInput.isCancelled()) {
            console.log("you have exited"); // < this does not work
            return false; // < this does not work either. The scene still can be exited normally. 
        }
        if (this._touching) {
            if (TouchInput.isPressed()) {
                this.onTouch(false);
            } else {
                this._touching = false;
            }
        }
    } else {
        this._touching = false;
    }
};

Can someone please help me with this? I want the player just to not be able to exit the scene other way than the way I have made for him. This has a gameplay purpose.

Thank you for your time!
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
854
First Language
English
Primarily Uses
RMMV
@Hisao Shou Hmm, well, unless there is something else going on, I believe that 'Window_Selectable.prototype.processCancel.call(this)' is running the default cancel process. That line should be removed.
 

Hisao Shou

Veteran
Veteran
Joined
Jan 8, 2015
Messages
155
Reaction score
22
Primarily Uses
@Hisao Shou Hmm, well, unless there is something else going on, I believe that 'Window_Selectable.prototype.processCancel.call(this)' is running the default cancel process. That line should be removed.
I removed that line and it still does not work.
I have also tried to remove the whole Window_CardsIndex.prototype.processTouch function and no positive results.
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
854
First Language
English
Primarily Uses
RMMV
@Hisao Shou In the scene, is there a 'setHandler' that is attached to any window that is handling 'cancel', by any chance?
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
854
First Language
English
Primarily Uses
RMMV

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,836
Reaction score
5,221
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top