Yanfly Event Chase Stealth help with conditional branch

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
86
Reaction score
20
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
286
Reaction score
104
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
86
Reaction score
20
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
286
Reaction score
104
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 Posts

Latest Profile Posts

Ami
4 days im not using my laptop to waiting someone to reinstall (sigh)
Stream will be live shortly with some Donkey Kong 64! Feel free to drop by!
Working on a test Boss for the new No Travel Game Jam
- Name Plugin by Moghunter -
Free RPG Maker Ready Charging Up Animation

Enjoy -No Credit Needed But Appreciated -
Download it at https://lvgames.itch.io/free-charging-up-pixel-animation-fx-rpg-maker-ready
:/ .... so, thought I’d go to the park to sit in the cool breeze and get out of the house a little. Nope, guess that’s quarantined too. Ok...

Forum statistics

Threads
95,486
Messages
929,524
Members
125,733
Latest member
whypzk
Top