edited November 2017 in ORK Support
I'm trying to setup functionality, where combatant's grid move can be interrupted by an event ie. when combatant detects an enemy when moving through the grid path.

My grid move battle event is based on the tutorial: I have a loop that checks the grid path length to be greater than zero, and stores the next cell in the path and moves the combatant to that cell. If path length is zero, the combatant plays idle animation and colliders and navmesh agents are enabled.

I've added a custom component CombatantDetectBehaviour which puts up a flag if the combatant detects an enemy (this I've checked that it works), I included a Check Fields event node into the event just after the next cell in the path is stored, basically it checks if the detection flag is up --> it should clear the whole remaining grid path and jump in to the same path in the event where it would end if the "Check grid path length > 0" condition should fail.

image

The grid move now behaves so, that when combatant detects an enemy, the combatant does not traverse cell by cell to the final destination in the path; Instead, the combatant instantly "teleports" to the final destination.

I'm definetly missing something here, any clues what it might be :/?
Post edited by l3p1 on
  • edited November 2017
    First of all, do this after the Check Grid Path Length node, before the Grid Cell Event node.

    Now, you'll need 3 nodes instead of the Remove Grid Path node:
    - Set Grid Cell Combatant node to set the user as the cell's Combatant (i.e. the last cell that was stored, where the combatant moved to).
    - (optional) Consume Grid Path Cost node to consume the move costs.
    - Clear Grid Path node to remove the path and prevent the combatant from being set to the target cell of the path.
    Afterward, continue with the Grid Cell Event node that handles Move To events.
    Post edited by gamingislove on
    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, that seemed to do the trick!
  • I'll continue my next question right here, because it closely relates to this original grid move interruption. So, I have phase battle with battle grid setup and custom action point system to control the combatant actions and movements.

    What I would like to achieve, is to implement an actual interruption system just like in X-COM's or Jagged Alliance games. At first I figured I would create a separate battle event for the whole interruption logic being something like this:

    1. store each player combatant's remaining action points
    2. end the current phase
    3. set action points to zero for each enemy combatant EXCEPT the one that initiated the interrupt event (ie. the enemy that detected the player combatant during grid move)
    4. execute ai battle logic
    5. end the enemy faction's phase
    6. set each player combatants action points to the values that were stored in step 1

    Sounded simple, but I managed to pull out something which included steps 1,2 and 3 where step 2 (ending the phase) does not even work :D...I'm calling this interrupt event from the grid move event, when the player's grid move has been interrupted by an enemy.

    Basically I'd like to know, is this at all the right way to go on with, or is there a simpler way to achieve this (ie. using counter attacks somehow?)
  • Hm, so basically you want an enemy combatant to perform an action during the player's turn?

    You could do that much easier by just using a Use Battle Action node, e.g. as a Sub Action during a combatant's action ...
    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!
Sign In or Register to comment.