First and foremost I should be clear: I am NOT looking for someone to write the plugin for me!
However, I do come across an area or two that I am not yet confident or proficient with, and thus a blockage on the progress of the plugin. In most cases this is mainly with windows, scenes, and sprites. I will speak briefly on the project itself, and then my request.
The Project:
Currently making a grid-based tactical system plugin to fight your battles on the map. I've decided to re-use and re-order the current systems in place ($gameTroop, $gameParty, $gameMap, BattleManager), and am now at the stage where battle "begins", I use a common event (based on player's or enemy's turn) and that will display a picture, and setup the party's initial position (where this request comes in). The rest of the sequences are handled by a mix of common events and scripts to check turn order -> execute a Move and|or Action (if anyone is familiar with these systems like the Dungeon & Dragons tabletop roleplaying game or Divinity: Original Sin, etc).
What I AM Looking For:
At the moment, at the start of battle, I need to set up the party's starting positions. I was thinking of a sequence something like this:
NOTE: The party members are just mocked up with events, and are not supposed to be actual events.
The second party member (P2) is to the player's "left" (or Screen Right, based on Step 3's order system), and is clear -> the Follower is created (if not already), moved to the right and faces the same direction as the player.
-- Update (07/22/2020) --
Progress! Using a common event (interpreters are really handy..) I was able to finally get the characters to move to their positions, however I still need to look into the re-arranging of the party thing.. (When the setup is complete, I want the camera and Player to BE the first character in the turn order, turning the other 3 into the followers. (see "progress.png") (red haired prince dude is party leader, but everyone's positions swapped when I swapped turn order).
-- Update (07/21/2020) --
Have made a few attempts, the following function doesn't work as intended though :\ (the followers appear behind me, but don't go anywhere.
* in reference to the "this.show(i)" portion; for any who might ask, it is modified so that "._visible" variable is put on the Game_Follower() object instead of Game_Followers() - so that I may control their visibility individually.
However, I do come across an area or two that I am not yet confident or proficient with, and thus a blockage on the progress of the plugin. In most cases this is mainly with windows, scenes, and sprites. I will speak briefly on the project itself, and then my request.
The Project:
Currently making a grid-based tactical system plugin to fight your battles on the map. I've decided to re-use and re-order the current systems in place ($gameTroop, $gameParty, $gameMap, BattleManager), and am now at the stage where battle "begins", I use a common event (based on player's or enemy's turn) and that will display a picture, and setup the party's initial position (where this request comes in). The rest of the sequences are handled by a mix of common events and scripts to check turn order -> execute a Move and|or Action (if anyone is familiar with these systems like the Dungeon & Dragons tabletop roleplaying game or Divinity: Original Sin, etc).
What I AM Looking For:
At the moment, at the start of battle, I need to set up the party's starting positions. I was thinking of a sequence something like this:
- If followers are not visible -> turn visible
- Turn followers "through" off
- If actor is facing "up", check in order: (left, right, down) for the first available spacing, then the next and last); if facing "left", check order (down, up, right); if facing "right", check order (up, down, left); facing "down", check order (right, left, up)
- Create follower sprite (if not already visible) -> Move character(follower) to first available spot, and next follower to the next available and so on; Ensure each is facing the same direction as Player.
- If no more spaces available, repeat Step 3 using the next character(follower) as the starting position (x,y)
NOTE: The party members are just mocked up with events, and are not supposed to be actual events.
The second party member (P2) is to the player's "left" (or Screen Right, based on Step 3's order system), and is clear -> the Follower is created (if not already), moved to the right and faces the same direction as the player.
-- Update (07/22/2020) --
Progress! Using a common event (interpreters are really handy..) I was able to finally get the characters to move to their positions, however I still need to look into the re-arranging of the party thing.. (When the setup is complete, I want the camera and Player to BE the first character in the turn order, turning the other 3 into the followers. (see "progress.png") (red haired prince dude is party leader, but everyone's positions swapped when I swapped turn order).
JavaScript:
// Re-arranges party into turn order
Game_Party.prototype.turnOrder = function() {
var turns = $gameMap._gtbs._actors;
for (var i = 0; i < turns.length; i++) {
this._actors[i] = turns[i].id;
}
console.log("turnOrder: "+JSON.stringify(this._actors));
$gamePlayer.refresh();
$gameMap.requestRefresh();
};
Game_Interpreter.prototype.setupPos = function(variableId, mode) {
var index = $gameVariables.value(variableId);
var gtbs = $gameMap._gtbs;
var f = $gamePlayer.followers();
var pc = $gamePlayer;
var s1, s2, s3;
switch (mode) {
case 1: { // Stage 1 - Show Follower
f._data[index].setPosition(pc._x, pc._y);
f._data[index].setThrough(false);
f.show(index);
$gamePlayer.refresh();
} break;
case 2: { // Stage 2 - Move Follower
var d = $gamePlayer._direction;
switch (d) {
case 8: s1=4; s2=6; s3=2; break;
case 6: s1=8; s2=2; s3=4; break;
case 4: s1=2; s2=8; s3=6; break;
case 2: s1=6; s2=4; s3=8; break;
}
f = f.follower(index);
if (f.canPass(pc._x, pc._y, s1)) {
f.setDirection(s1);
f.moveFollower(s1);
this.wait(20);
f.setDirection(d);
} else if (f.canPass(pc._x, pc._y, s2)) {
f.setDirection(s2);
f.moveFollower(s2);
this.wait(20);
f.setDirection(d);
} else if (f.canPass(pc._x, pc._y, s3)) {
f.setDirection(s3);
f.moveFollower(s3);
this.wait(20);
f.setDirection(d);
} else if (f.canPass(pc._x, pc._y, d)) {
f.setDirection(d);
f.moveFollower(d);
} else {
console.log("Debug(setupPos): Error has ocurred. No Setup can be done.");
return;
}
} break;
case 3: { // Stage 3 - Step Animation for active battler
if (!gtbs._turn.eID) { // Player Turn
// Order party according to turn order
$gameParty.turnOrder();
} else { // Enemy Turn
}
} break;
case 4: { // Stage 4 - Begin Turn (input phase)
// As first in the turn order, we disable movement until
// the "Move|Dash" action is used
$gameParty.leader()._pace = 0;
$gamePlayer.setStepAnime(true);
//BattleManager._phase = 'input';
console.log(" -- End of Debug -- ");
} break;
}
};
-- Update (07/21/2020) --
Have made a few attempts, the following function doesn't work as intended though :\ (the followers appear behind me, but don't go anywhere.
* in reference to the "this.show(i)" portion; for any who might ask, it is modified so that "._visible" variable is put on the Game_Follower() object instead of Game_Followers() - so that I may control their visibility individually.
JavaScript:
Game_Followers.prototype.setupPos = function() {
var s1, s2, s3;
var pc = $gamePlayer; // precedingCharacter
for (var i = 0; i < this._data.length; i++) {
var f = this._data[i];
this.show(i);
$gamePlayer.refresh();
f.setThrough(false);
//
switch (pc._direction) {
case 8: s1=4; s2=6; s3=2; break;
case 6: s1=8; s2=2; s3=4; break;
case 4: s1=2; s2=8; s3=6; break;
case 2: s1=6; s2=4; s3=8; break;
}
if (f.canPass(pc._x,pc._y,s1)) {
f.moveStraight(pc._x,pc._y,s1);
} else if (f.canPass(pc._x,pc._y,s2)) {
f.moveStraight(pc._x,pc._y,s2);
} else if (f.canPass(pc._x,pc._y,s3)) {
f.moveStraight(pc._x,pc._y,s3);
} else {
pc = this._data[i];
}
}
this.setupFacing();
};
Game_Followers.prototype.setupFacing = function(character) {
if (character === undefined) character = $gamePlayer;
for (var i = 0; i < this._data.length; i++) {
this._data[i].setDirection(character._direction);
}
};