For the grid battle based game that I'm working on, I've been intending to create several abilities that move the combatants on the grid. Some abilities would have "knockback" effects, while others would be teleport effects. However, none of the settings for abilities seem to include moving the combatants.
What would be the best way to accomplish this in ORK? I'm guessing that I'm going to have to use events called by the abilities to move the combatants somehow?
public void TeleportCharacter()
{
Debug.Log("Running TeleportCharacter!");
List<Combatant> battleGroup = ORK.Game.ActiveGroup.GetBattle();
BattleGridCellComponent combatantGridCell = battleGroup[0].GridCell;
ORK.Battle.Grid.GetCell(combatantGridCell.CubeCoord.x, combatantGridCell.CubeCoord.y).Combatant = null;
ORK.Battle.Grid.GetCell(combatantGridCell.CubeCoord.x, combatantGridCell.CubeCoord.y+2).Combatant = battleGroup[0];
ORK.Battle.Grid.FireGridChanged();
}
Instead of having the path from the move selection, you'd need to find the cell you want to move to manually, e.g. searching for the nearest cell from a position (e.g. raycast).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I have a clearer idea of how this would work now. I have another question however: how do you get the grid cell that a character has targeted with an ability? I see how to get the last cell in a movement path from "Store Grid Path", but I don't believe that would apply when using an ability for movement.
Is there a tutorial that you would suggest reading for selecting combatants and grid cells within a grid battle?
There's no tutorial especially on that topic. In battle events, you can use the different search nodes (e.g. Search Combatants) to store them as found objects and use them in the event.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Anyway, I'm trying out using "target actor" to get the cell like you suggested, but I am still having some issues getting the event to work. Does anything look incorrect in the screenshots below?
Thanks the help btw, I really appreciate it!
Since you're searching for grid cells, you should set the Search Name to BattleGridCellComponent.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Edit: So, I've been able to confirm that the event is finding the "BattleGridCellComponent" by using a "Found Objects Count" step to verify that there is at least one object under the "targetCell" key. A "Is Grid Cell Empty" check is succeeding on it as well. However, the "Set Grid Cell Combatant" step still doesn't seem to be doing anything, hmm.
Selecting the cell in the scene should display which combatant is currently placed on it in the inspector.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I may as well mention one odd thing to you. The 'teleport' initially started seeming to work once I added a "Grid Cell Event" to move the character. However, I currently have the character teleporting between cells using only "Set Grid Cell Combatant". It could have been that the game just started selecting a different target sell for some reason (I hadn't set the search range yet), but I thought I should mention this to you.
Anyway, thanks for the help!