ive been following seargent indie's tutorial on strategy rpg (dungeons and dragons style), and ive been successful in making it more like final fantasy tactics so far.
so, ive run into an issue with the sneak attack part, it works perfectly for ranged attacks, but with melee, depending on the attacker's position, the attack target's unit team check seems to not be checking every grid space around the attack target.
positions that didnt work:
unit1 on the right of the enemy unit, unit2 on the left
unit1 on bottom of the enemy unit, unit2 on left or top or right
unit1 on top of the enemy unit, unit2 on right and left
positions that worked correctly
unit1 on right of the enemy unit, unit2 on the top or bottom
unit1 on left of the enemy unit, unit2 on top right and bottom work
unit1 on top of the enemy unit, unit2 on bottom worked
unit 1 is the one with sneak attack.
unit 2 is another party member.
inside my hit check script (takes _attacker and _attackTarget arguments)
//if the attacker has sneak attack
if(_attacker.sneakAttack == true){
tempNode = combatGridMap[_attackTarget.gridX, _attackTarget.gridY];
//look at the targets neighbors and find out if any of them are not on the same team
for(var i = 0; i < ds_list_size(tempNode.neighbors); i++){
current = ds_list_find_value(tempNode.neighbors, i);
//if the target is next to something hostile to it, apply sneak attack
if(current.occupant != noone){
if(current.occupant != _attacker){
if(current.occupant.unitTeam != _attackTarget.unitTeam){
_attacker.applySneakAttack = true;
}
} else {_attacker.applySneakAttack = false;}
}
}// for loop end
}//if the attacker has sneak attack check end
the code for how im making the grid is too long for this post and apparently i cant make another one