Hello friends!
I'm making a plugin. And in that, I use the function below to check two things, like this:
So I added more conditional branches for checking some conditions, if it were true then "return stuff".
However, the use of multiple "return" was not working to check all conditions, I think none maybe.
Then I discovered that
So I just took the "return" code and left only the commands to activate the switch, for example:
And it works! All the checks.
My question is:
Adding multiple conditional branches to the SceneMap Update function is something I should be worried about that might disrupt performance? Or cause incompatibility with other plugins?
Should I put some things in GamePlayerUpdate for example (in case I want to activate a switch when the player is in some vehicle or on a damage floor)?
Thanks!!
I'm making a plugin. And in that, I use the function below to check two things, like this:
Code:
var _Elimobpc_Scene_Map_updateScene = Scene_Map.prototype.updateScene;
Scene_Map.prototype.updateScene = function() {
_Elimobpc_Scene_Map_updateScene.call(this);
if (Utils.isMobileDevice()) {
return $gameSwitches.setValue(Eli.Param.DevelopmentSwitch.mobile, true);
}
if ($gameSwitches.value(Eli.Param.DevelopmentSwitch.mobile) == false) {
return $gameSwitches.setValue(Eli.Param.DevelopmentSwitch.desktop, true);
}
};
So I added more conditional branches for checking some conditions, if it were true then "return stuff".
However, the use of multiple "return" was not working to check all conditions, I think none maybe.
Then I discovered that
So I just took the "return" code and left only the commands to activate the switch, for example:
Code:
if (Utils.isMobileDevice()) {
$gameSwitches.setValue(Eli.Param.DevelopmentSwitch.mobile, true);
}
And it works! All the checks.
My question is:
Adding multiple conditional branches to the SceneMap Update function is something I should be worried about that might disrupt performance? Or cause incompatibility with other plugins?
Should I put some things in GamePlayerUpdate for example (in case I want to activate a switch when the player is in some vehicle or on a damage floor)?
Thanks!!