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?
  • I tried throwing together a test script to see if I could move a combatant using a function called as an animation Battle Event, though no luck so far.

    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();
    }
  • You'd do grid movement in the battle event using the grid steps (similar to the grid move event).

    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).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks for the tip! I'll try that one out.
  • edited December 2016
    I see now: this was in the Active Time Grid Battle tutorial. I skipped that one because I was too focused on turn based battles, lol.

    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?
    Post edited by MatrixDragon on
  • If an ability targets a grid cell instead of combatants, the target actor contains the grid cell as well.

    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.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2016
    Hmmm. This is going to make complex targeting and movement on the cells interesting. I'm guessing that I'm going to have to use a function if I want to do something like finding a cell *behind* an enemy that I target with an ability.

    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?

    targetCellSearch

    setGridCellCombatant

    Thanks the help btw, I really appreciate it!
    Post edited by MatrixDragon on
  • Well, in your setup you're searching for objects based on the name of a component that is attached to it - without having the component name defined, i.e. it wont find anything :)

    Since you're searching for grid cells, you should set the Search Name to BattleGridCellComponent.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2016
    Ahh, I had tried searching for "Battle Grid Cell Component" since that was how the name was displayed. Thanks!

    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.

    teleportCombatantEvent
    Post edited by MatrixDragon on
  • Well, Set Grid Cell Combatant on itself will just set the combatant of a grid cell, i.e. the cell will be occupied by the combatant, but that doesn't move the actual game object of the combatant there :)

    Selecting the cell in the scene should display which combatant is currently placed on it in the inspector.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2016
    Hmmmm, after messing with it a bit I think I found the problem. "Set Grid Cell Combatant" was working just fine by itself. (At least it is now? It seems inconsistent.) The problem was that I needed to set a distance limit on the grid cell search. The grid cell search was selecting the wrong cell instead of the one that I had targeted. Setting a range limit on the search seems to have helped with that.

    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!
    Post edited by MatrixDragon on
Sign In or Register to comment.