I'm using Yanfly's plugins, the relevant ones here being Selection Control, Row Formation, and Target Core.
My project's battle system has two rows for combatants, a front row and a back row, set up in Row Formation. Each has a state associated with it.
I'm having trouble with the <melee> and <ranged> settings on items and weapons and how that interacts with the rows. I'm essentially trying to copy Etrian Odyssey, in which a party member in the front row with a melee weapon can target enemies on both rows (though back row enemies have a defense bonus), while if you have a melee weapon while in the back row you are only able to target front row enemies. Notably, this is only true for the basic attack action- skills are an entirely separate question. The easiest way to implement this seems to be to basically ignore the whole melee/ranged thing altogether and just restrict the available targets when they're using basic attacks from the second row.
So my question is this- what do i put into the notebox for the basic attack action that would allow this interaction? Basically I want to check if the weapon used is of a certain weapon type. if this is true, and if the actor is in the second row (the rows have unique states to them, so i can just check for the state the second row has attached to it), then i want to limit their potential targets to the first row (and the first row also has a unique state to it so i can also just check for that).
here's the example code off of yanfly's site for the Selection Control plugin
as far as I understand, the above checks if the target is named harold, and if that's true it flags said entity as targetable for whatever skill this tag is placed in.
and here's one of the examples from the target core plugin:
and lastly, here's some script calls that the row formation plugin gives
if I could figure out how to use conditional statements in a skill or state notebox and just use the plugin tags instead of javascript i'd be able to implement this myself, but i dont know how to do that.
I feel like I should be able to just do something like this and post it in the basic attack skill notebox, but it doesnt work.
I wish i knew more javascript, i just have vague memories of a c++ class from a long time ago, so while i understand stuff like booleans and needing to ; the ends of lines i dont know any of the basic javascript function calls and commands. it could also be something as simple as not doubling the == for whatever that does
(oh, maybe the $gameTroop.rowAliveMembers(x) would work here? but that returns a number, not a boolean... i dont know what the standard $prefix script calls are in rpgmaker and its hard to find a reference page)
EDIT: found the script calls reference! I still dont know how to use them properly but its certainly helpful
My project's battle system has two rows for combatants, a front row and a back row, set up in Row Formation. Each has a state associated with it.
I'm having trouble with the <melee> and <ranged> settings on items and weapons and how that interacts with the rows. I'm essentially trying to copy Etrian Odyssey, in which a party member in the front row with a melee weapon can target enemies on both rows (though back row enemies have a defense bonus), while if you have a melee weapon while in the back row you are only able to target front row enemies. Notably, this is only true for the basic attack action- skills are an entirely separate question. The easiest way to implement this seems to be to basically ignore the whole melee/ranged thing altogether and just restrict the available targets when they're using basic attacks from the second row.
So my question is this- what do i put into the notebox for the basic attack action that would allow this interaction? Basically I want to check if the weapon used is of a certain weapon type. if this is true, and if the actor is in the second row (the rows have unique states to them, so i can just check for the state the second row has attached to it), then i want to limit their potential targets to the first row (and the first row also has a unique state to it so i can also just check for that).
here's the example code off of yanfly's site for the Selection Control plugin
Code:
Skill and Item Notetags:
<Custom Select Condition>
if (target.name() === 'Harold') {
condition = true;
} else {
condition = false;
}
</Custom Select Condition>
The 'condition' variable determines if the condition will pass or not. If
the variable returns 'true', the condition will pass. If the variable is
'false', the condition will fail and the target will not be a valid target
for the action. Even if the <Custom Select Condition> notetag passes, all
other selection conditions must pass, too.
as far as I understand, the above checks if the target is named harold, and if that's true it flags said entity as targetable for whatever skill this tag is placed in.
and here's one of the examples from the target core plugin:
Code:
For users that are proficient with JavaScript, these notetags can be used to
make custom target selections. For the targeting aspect, this will refer to
the skill/item's current scope and the targets made here will be made
independent of the scope with the exception of the target, where if a target
is selected, it will become the 'target' value.
<Custom Target Eval>
for (var i = 0; i < foes.aliveMembers().length; ++i) {
var member = foes.aliveMembers()[i];
if (member.level % 3 === 0) targets.push(member);
}
</Custom Target Eval>
The 'targets' variable is an array that determines which are the targets
to be used during the selection process. Push the desired targets into
the 'targets' array.
and lastly, here's some script calls that the row formation plugin gives
Code:
For those with JavaScript proficiency, you can make use of some of these
newly added functions when you do an eval check for the battler info:
battler.row()
This will return the row the battler is currently resided in.
battler.rowIndex()
This will return the battler's index in relation to the other battlers of
the same team in the same row.
battler.isRowLocked()
This will return a true/false if the battler is row locked.
battler.setRow(x)
This will set the battler's row to x. In battle, this will visually move
the battler there, unless the battler is the active battler.
battler.alterRow(x)
This will alter the battler's row by x. In battle, this will visually move
the battler there, unless the battler is the active battler.
$gameParty.rowSize(x)
$gameTroop.rowSize(x)
This will return the number of members found in that group in row x.
$gameParty.rowAliveSize(x)
$gameTroop.rowAliveSize(x)
This will return the number of alive members found in that group in row x.
$gameParty.rowDeadSize(x)
$gameTroop.rowDeadSize(x)
This will return the number of dead members found in that group in row x.
$gameParty.rowMembers(x)
$gameTroop.rowMembers(x)
This will return each member of the group in row x.
$gameParty.rowAliveMembers(x)
$gameTroop.rowAliveMembers(x)
This will return each alive member of the group in row x.
$gameParty.rowDeadMembers(x)
$gameTroop.rowDeadMembers(x)
This will return each dead member of the group in row x.
$gameParty.updateRows();
$gameTroop.updateRows();
This is a special command. This will check each row in the party. If a row
is empty and/or doesn't have any alive members, all the remaining members
behind that row will move forward one row until all the empty rows are gone.
if I could figure out how to use conditional statements in a skill or state notebox and just use the plugin tags instead of javascript i'd be able to implement this myself, but i dont know how to do that.
I feel like I should be able to just do something like this and post it in the basic attack skill notebox, but it doesnt work.
Code:
<Custom Select Condition>
if (battler.row() = 2, target.row() = 1, battler.isWtypeEquipped(1,2,3)){
condition = true;
} else {
condition = false;
}
</Custom Select Condition>
I wish i knew more javascript, i just have vague memories of a c++ class from a long time ago, so while i understand stuff like booleans and needing to ; the ends of lines i dont know any of the basic javascript function calls and commands. it could also be something as simple as not doubling the == for whatever that does
(oh, maybe the $gameTroop.rowAliveMembers(x) would work here? but that returns a number, not a boolean... i dont know what the standard $prefix script calls are in rpgmaker and its hard to find a reference page)
EDIT: found the script calls reference! I still dont know how to use them properly but its certainly helpful