Hi, I want to learn as much as I can about the battle scene code so that I can modify it for my goals.
For this reason I'm trying to replicate some parts of the code to see if I'm able to let it run properly.
I'm having a problem with my version of the skill activation function "onSkillOk". When I select a skill (with scope 1 enemy, not random) it just activate skill on a random enemy, and only after that it let me take a choice about the enemy.
The functions I'm using are the following. I can post all the plugin code if needed but it's a mess since I'm not a programmer at all.
I have noticed that "action.setSkill(skill.id);" is the line that execute the skill, while "this.onSelectAction();" the one that let's start enemy selection. Using "onSelectAction" before "action.setSkill" gives me the error: "Cannot read property 'scope' of null".
What could be the problem? My function are so similiar to the official ones.
Thanks
For this reason I'm trying to replicate some parts of the code to see if I'm able to let it run properly.
I'm having a problem with my version of the skill activation function "onSkillOk". When I select a skill (with scope 1 enemy, not random) it just activate skill on a random enemy, and only after that it let me take a choice about the enemy.
The functions I'm using are the following. I can post all the plugin code if needed but it's a mess since I'm not a programmer at all.
JavaScript:
// This one is the new onSkillOk
Scene_Battle.prototype.onMaskSkillOk = function () {
BattleManager.selectActor();
const skill = this._MaskSkillWindow.item();
const action = BattleManager.inputtingAction();
action.setSkill(skill.id);
BattleManager.actor().setLastBattleSkill(skill);
this._MaskSkillWindow.close();
this._helpWindow.hide();
this.onSelectAction();
};
Scene_Battle.prototype.onSelectAction = function() {
const action = BattleManager.inputtingAction();
if (!action.needsSelection()) {
this.selectNextCommand();
} else if (action.isForOpponent()) {
this.startEnemySelection();
} else {
this.startActorSelection();
}
};
I have noticed that "action.setSkill(skill.id);" is the line that execute the skill, while "this.onSelectAction();" the one that let's start enemy selection. Using "onSelectAction" before "action.setSkill" gives me the error: "Cannot read property 'scope' of null".
What could be the problem? My function are so similiar to the official ones.
Thanks