LUELLAMAJOR'S PROFILE

Search

Filter

[RMMZ] Remove Attack (Skill 1) from an autobattler's list of actions.

author=Marrend
So, here's what I'm suspecting is the function that occurs in MZ's auto battle algorithm with the default code.

Game_Actor.prototype.makeAutoBattleActions = function() {
    for (let i = 0; i < this.numActions(); i++) {
        const list = this.makeActionList();
        let maxValue = -Number.MAX_VALUE;
        for (const action of list) {
            const value = action.evaluate();
            if (value > maxValue) {
                maxValue = value;
                this.setAction(i, action);
            }
        }
    }
    this.setActionState("waiting");
};


What's popping out to me with this is the line that reads `const list = this.makeActionList();`. What this calls is...

Game_Actor.prototype.makeActionList = function() {
    const list = [];
    const attackAction = new Game_Action(this);
    attackAction.setAttack();
    list.push(attackAction);
    for (const skill of this.usableSkills()) {
        const skillAction = new Game_Action(this);
        skillAction.setSkill(skill.id);
        list.push(skillAction);
    }
    return list;
};


...this function. The line `attackAction.setAttack();` from that code probably calls...

Game_Action.prototype.setAttack = function() {
    this.setSkill(this.subject().attackSkillId());
};


...this method. So, my current guess is that it could be replaced with `attackAction.setSkill(skillID)`...

Game_Action.prototype.setSkill = function(skillId) {
    this._item.setObject($dataSkills[skillId]);
};


...or, somehow rework that line that it reads off of the list of possible skills that you've set up. I imagine this is done through metadata/tags?


wordle
*Edit: Or... I guess you could, theoretically, comment out the line `attackAction.setAttack();` from the `Game_Actor..makeActionList()` function entirely? Re-looking at the code, and what you want to do versus what it already does, that might be the easiest solution.

Thx Marrend...all clear for me
Pages: 1