Yanfly Event Chase Stealth help with conditional branch

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
134
Reaction score
30
First Language
English
Primarily Uses
N/A
Hello!

This is short and simple. I just am unsure how to UTILIZE the tools at my disposal in the correct way.

Basically, I want to allow the player to STEAL from NPC's when under the influence of 'stealth'. So I want to create a conditional branch that if you speak to the NPC while in stealth, you will be given the option to steal.

Now, the plugin it self says I can use $gamePlayer.isStealthMode() to check the true/false value in a conditional branch script field. I tried typing in = true or putting true between the () but neither worked.


If anyone can tell me exactly how I might pull this off (or, if I am just bat **** crazy and i actually CAN'T as is), that would be super helpful! Thank you!
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
120
First Language
English
Primarily Uses
RMMV
I would assume it's because you put = instead of == or ===, you might not even need an equal sign at all as if it's a Boolean true or false you can just put $gamePlayer.isStealthMode() or !$gamePlayer.isStealthMode() in the conditional branch script.
 

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
134
Reaction score
30
First Language
English
Primarily Uses
N/A
I would assume it's because you put = instead of == or ===, you might not even need an equal sign at all as if it's a Boolean true or false you can just put $gamePlayer.isStealthMode() or !$gamePlayer.isStealthMode() in the conditional branch script.
I tried with the ==, by itself, and with the !

With the ! at the start, it will activate as though it is true. Whether I am in stealth mode or not. All the other ones will activate the ELSE case.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
120
First Language
English
Primarily Uses
RMMV
I tried with the ==, by itself, and with the !

With the ! at the start, it will activate as though it is true. Whether I am in stealth mode or not. All the other ones will activate the ELSE case.
Well the ! should be active if not in stealth, rest if you are, the only code that runs is
Code:
Game_Player.prototype.initEventChaseStealth = function() {
    this._chaseStealthTimer = 0;
    this._chaseStealthPerm = false;
    this._disableStealthDash = Yanfly.Param.ECSStealthDash;
    this._stealthMoveSpeed = Yanfly.Param.ECSMoveSpeed;
};

Game_Player.prototype.isStealthMode = function() {
    if (this._chaseStealthTimer === undefined) this.initEventChaseStealth();
    if (this._chaseStealthTimer > 0) return true;
    return this._chaseStealthPerm;
};
Which will only ever return true if stealth timer is > 0, so I guess you could also do
Code:
$gamePlayer._chaseStealthTimer > 0;
EDIT:
Actually maybe the problem is it removes stealth whenever you trigger things? Maybe you could remove this from the code.
Code:
Yanfly.ECS.Game_Player_triggerAction = Game_Player.prototype.triggerAction;
Game_Player.prototype.triggerAction = function() {
    var value = Yanfly.ECS.Game_Player_triggerAction.call(this);
    if (value) this.setStealthMode(false);
    return value;
};

Yanfly.ECS.Game_Player_triggerButtonAction =
    Game_Player.prototype.triggerButtonAction;
Game_Player.prototype.triggerButtonAction = function() {
    var value = Yanfly.ECS.Game_Player_triggerButtonAction.call(this);
    if (value) this.setStealthMode(false);
    return value;
};
 
Last edited:

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,547
Members
137,835
Latest member
yetisteven
Top