edited January 25 in ORK Support
So what I'd like to have happen is....

If the player hit the left arrow key during an attack within the attack time window, the enemy they hit will be moved one cell to the left on the grid.

If the player hit the right arrow key during an attack within the attack time window, the enemy they hit will be moved one cell to the right on the grid.

If the player hit the up arrow key during an attack within the attack time window, the enemy they hit will be moved one cell back on the grid.

All of this assuming the cell they would be moved to exists, and isn't already occupied.

What I can't seem to figure out is how to do this in the schematic. I figure you'd need to get the enemy's current position and then add or subtract from that cells row/column position based on the key the player hit to get the new position.

Here's what my schematic currently looks like. I have the inputs set up, and they log to the console fine if hit, but currently the best I can do is get the enemy to run completely off screen when they are hit instead of going to a controlled position on the grid.

https://ibb.co/VWzNj9L

Thanks.
Post edited by racefan56 on
  • You can use a Select Grid Cells node to get cells based on a defined cell (e.g. from the target) using battle range (templates). So, based on the input, select a different cell around the target - afterwards the cell is stored in selected data and can be used to do checks on it (e.g. Is Grid Cell Empty node to check if the cell is empty) and move to it.

    Don't forget to use a Set Grid Cell Combatant node to actually make the combatant occupy the cell. Or, you can set a path to the cell and do regular grid movement mechanics.
    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 reply.

    Though I'm still not understanding how to "based on the input, select a different cell around the target - afterwards the cell is stored in selected data"

    How are you selecting what the new cell is based on the original one? I don't see a way to access the selected data, and modify it. I believe I see how once I had that info I could move the combatant there.

    Here's my schematic now after your response...

    https://ibb.co/L5ns9w3

    Thanks
  • Based on which input was pressed in the Wait For Input node use a different Select Grid Cells node setup. E.g. for the Grid Stike Left key use a battle range template that selects a cell left of the target (Starting Object as the origin object).

    Battle range templates using Mask shape type can define individual cells to use. The whole thing can also be roated within local space of the combatant on the used cell by enabling Local Space in the grid shape (or in local space of the user by also enabling In User Space - to use this in the Select Grid Cells Node you can define a separate user combatant for that).
    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 January 25
    Ok, so after messing with it for a bit it seems to be functioning now! Yay!

    For anyone who may be interested in something like this in the future here is what my working schematic and template look like...

    Schematic screenshots
    https://ibb.co/phHkWwD
    https://ibb.co/QnxJQH9

    Template
    https://ibb.co/dcX6fd8

    Thank you!

    Post edited by racefan56 on
  • While the Set Grid Cell Combatant node has an option to place the combatant on the cell (i.e. change the position) as well, if you want to move the combatant (e.g. over time or by speed) you should use a movement node like Change Position. Just like in the grid move command's schematics.
    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.