Hi,
Last week I asked if someone could create a plugin for vehicle combat like in phantasy star 4. RMMZ vehicle battle like Phantasy Star 4
However, there was no one whiling to do it. So, I decided to learn some JavaScript and try to do it myself.
The plan is
1. set on actor to be the vehicle battler and add him to the party when get on the vehicle, and inform it to the script through parameter (done)
2. change the party maxBattlers to 1 (done)
3. add a battler the Vehicle actor in the party as a hidden member (hidden part not done yet)
4. activate all of this only when inside the vehicle
Now I need to learn how to revert the changes after the party get off the vehicle. As I changed the values of $gameParty.maxBattleMembers and $gameParty.battleMembers, I need them the return to the values defined on the class Game_Party.prototype. maxBattleMembers and Game_Party.battleMemberson the getOff Vehicle, but I don’t know how to do it.
Can you guys please help my to find a way to restore the values of $gameParty.battleMembers to the defined on Game_Party.prototype.battleMembers?
This is what did so far.
Last week I asked if someone could create a plugin for vehicle combat like in phantasy star 4. RMMZ vehicle battle like Phantasy Star 4
However, there was no one whiling to do it. So, I decided to learn some JavaScript and try to do it myself.
The plan is
1. set on actor to be the vehicle battler and add him to the party when get on the vehicle, and inform it to the script through parameter (done)
2. change the party maxBattlers to 1 (done)
3. add a battler the Vehicle actor in the party as a hidden member (hidden part not done yet)
4. activate all of this only when inside the vehicle
Now I need to learn how to revert the changes after the party get off the vehicle. As I changed the values of $gameParty.maxBattleMembers and $gameParty.battleMembers, I need them the return to the values defined on the class Game_Party.prototype. maxBattleMembers and Game_Party.battleMemberson the getOff Vehicle, but I don’t know how to do it.
Can you guys please help my to find a way to restore the values of $gameParty.battleMembers to the defined on Game_Party.prototype.battleMembers?
This is what did so far.
JavaScript:
// ============================================================================
// Sabio Plugin - Vehicle Battle
// HDK_VehicleBattle.js
// ============================================================================
/*:
* @target MZ
* @plugindesc v0.1 Vehicle Battle
* @author Sabio
*
* @param vehicleBattlerID
* @text ID of the Vehicle Battler
* @type number
* @desc Actor ID of the Vehicle
*
*
* @help VehicleBattle.js
*
* This plugin add a battle system for vehicles, where the vehicle fights in place of the party
* You must to create an actor specific for the vehicle, and set it's ID on the plugin parameter.
*
*/
// ============================================================================
// Header and parameters reading
// ============================================================================
var Imported = Imported || {};
Imported.HDK_VehicleBattle = true;
var HDK = HDK || {};
HDK.VehicleBattle = HDK.VehicleBattle || {};
HDK.VehicleBattle.version = 0.1;
HDK.VehicleBattle.parameters = PluginManager.parameters('HDK_VehicleBattle');
HDK.VehicleBattle.VehicleActorID = Number(HDK.VehicleBattle.parameters["vehicleBattlerID"]);
//-----------------------------------------------------------------------------
// Customized functions
//-----------------------------------------------------------------------------
//set the max battlers during vehicle combat to 1
HDK.VehicleBattle.VehicleMaxBattlers = function () {
return 1;
};
//reverse the battleMembers function, so the last member joins the battle
HDK.VehicleBattle.battleMembers = function () {
return this.allMembers()
.reverse()
.slice(0, this.maxBattleMembers())
.filter(actor => actor.isAppeared())
;
};
//-----------------------------------------------------------------------------
// Changes the party to add a Vehicle Actor as a hidden part member
//-----------------------------------------------------------------------------
HDK.VehicleBattle.getOnPartychange = function () {
$gameParty.addActor(HDK.VehicleBattle.VehicleActorID)
$gameParty.maxBattleMembers = HDK.VehicleBattle.VehicleMaxBattlers; //Set the max battlers to 1
$gameParty.battleMembers = HDK.VehicleBattle.battleMembers; //Set the last member a leader
};
//-----------------------------------------------------------------------------
// Alias the Vehicle getOn to activate the battle system changes
//-----------------------------------------------------------------------------
var alias_HDK_VehicleBattle_getOn = Game_Vehicle.prototype.getOn;
Game_Vehicle.prototype.getOn = function() {
};