Recover All and Reserve Actors

● ARCHIVED · READ-ONLY
Started by Frogboy 8 posts View original ↗
  1. I've run into a weird anomaly and was wondering if anyone has discovered the code that controls this. If I use the Change Level with Entire Party, all actors including reserve members gain the indicated levels. If I use Change HP with Entire Party, same thing happens. Great! If I use Recover All with Entire Party, all party members gain all of the HP and MP, including reserve members ... BUT Game_BattlerBase.recoverAll is only called on the 4 party members, not on the reserve members. Anyone know what's going on here? It appears to be calling Game_Interpreter.prototype.command314 which calls Game_BattlerBase.recoverAll but only on the 4 party members. The reserve members are still getting all of their HP and MP some other way, though.

    Thanks!
  2. can you show the contents of command314?
  3. if you need help in js section, you should publish js code.
  4. Never mind. I'm an idiot. It's working the way it's supposed to, it just didn't look like it was and I went searching down a rabbit hole.
  5. It was using iterateActorEX which was iterating $gameParty.members, which means all party members not the first 4 (which is battleMembers something)
  6. When you use the "Recover All" event command on the whole party, the parameters passed to the game interpreter are 0, 0
    Spoiler
    recoverall.png

    It then calls iterateActorEx with arguments of 0, 0, and the callback function to recoverAll()
    Code:
    // Recover All
    Game_Interpreter.prototype.command314 = function() {
        this.iterateActorEx(this._params[0], this._params[1], function(actor) {
            actor.recoverAll();
        }.bind(this));
        return true;
    };

    iterateActorEx calls iterateActorId with arguments of 0 and the callback
    Code:
    Game_Interpreter.prototype.iterateActorEx = function(param1, param2, callback) {
        if (param1 === 0) {
            this.iterateActorId(param2, callback);
        } else {
            this.iterateActorId($gameVariables.value(param2), callback);
        }
    };

    iterateActorId executes the callback for every member of the party
    Code:
    Game_Interpreter.prototype.iterateActorId = function(param, callback) {
        if (param === 0) {
            $gameParty.members().forEach(callback);
        } else {
            var actor = $gameActors.actor(param);
            if (actor) {
                callback(actor);
            }
        }
    };
  7. Yep, you're right. It is/was. I was sure that something I had coded in would execute on actor 5 and it wasn't and I thought that the only reason could be that it wasn't calling recoverAll. I was wrong, though. The data on actor 5 wasn't what I thought it was. Just a dumb mistake on my part.

    That's the problem with being an experienced programmer. Sometimes you're too sure you know what's going on and the solution is something simple that you've already discounted. :kaoblush:

    Edit:
    Just found out what's going on. Somehow, the same exact string when being compared to the same exact value was registering as true for one and false from the other. There was an invisible character added on to the one giving me the issue that thankfully was removable with a trim(). The weird thing is that both were being drawn from the same Select plugin parameter and were set to the same dropdown value. Very strange. So I did actually have my data correct, JavaScript just kind of flaked out on me there.

    Edit 2:
    Found out what caused the anomaly. I inadvertently corrupted my plugin parameters. The way I usually comment out a plugin parameter is my simply removing the @ at the beginning of each line in the parameter. This removes it from the editor. I "commented out" some of the drop-down selections and while everything appeared completely normal in the edit and also in the code, an invisible character attached itself to this value. To make matters worse, one of the values I had saved before doing this and the other after so only one of my "Hybrid" values was corrupting resulting in the comparisons coming back different. You can see what I did.

    Code:
     * @param Caster Type
     * @type select
     * @desc Define what magic system this class uses.
     * @default Prepared
     * @option Prepared - Prepare which spells or abilities you want to cast
     * @value Prepared
     * @option Spontaneous - Cast any spell or ability that you know
     * @value Spontaneous
     * @option Hybrid - Prepared spells that aren't consumed when used
     * @value Hybrid
     * option Innate - Power
     * value Innate
     * option Default - Mana
     * value Default

    So make sure you don't do this. If you use this method to comment out a parameter, make sure you do the whole thing or weird stuff might happen.
  8. [closed]IgnoreMe[/closed]