edited November 16 in ORK Support
Hello,

I'm using Turn Based battles (Active Turn Based Mode), Hex grid.

In the battle Start Event, I intend to use "Place On Grid" node to place all roaming combatants (both NPCs and player group) on an available cell, closest to combatant's actual position. I believe that's what the "Place On Grid" node was meant for. But after experimenting with several setups, I'm still facing following issues(s):

Issue #1: On the first battle turn, Player turn is skipped and NPC AI battle script starts running in never ending loop. I guess, that for some reason Player combatant or NPC combatant (or both) is not placed on the grid propperly, so the AI script does not find any enemy on the grid.

Issue #2: Only available action for Player combatant is "No action/End turn". Turns are being cycled OK (not looping forever as in Issue #1), but NPC AI battle script does not register any target again.


For further information, I tried following setups:

SETUP A
NPC combatants are spawned by the Battle Event component, which is linked to the nearest Battle Grid. Player group is roaming freely and battle starts when player enters the Battle Event area. Please note this is not desirable scenario, since NPC conbatants should be pre-spawned and roaming the area already... but this is the only scenario where I'm able to achieve some functionality (in variant #1).

Variant A1: Using "Player Grid Placement" node -> NPC combatant is placed automatically on a free deployment spot, battle usually all works fine, but sometimes Issue #1 happens. Issue appearence seems to be related to the case, on which cell the Player combatant is placed.

Variant A2: Using "Place On Grid", Use Deployment Cells: Enabled, Place All: Enabled -> No Player combatant is placed/shown at all on the grid and Issue #1 happens.
Variant A3: Using "Place On Grid", Use Deployment Cells: Disabled, Place All: Enabled -> Player combatant is placed and visible, but Issue #2 happens.
Variant A4: Using "Place On Grid", Use Deployment Cells: Enabled, Place All: Disabled, Actor: Player group -> Player combatant is placed and visible, but Issue #2 happens.
Variant A5: Using "Place On Grid", Use Deployment Cells: Disabled, Place All: Disabled, Actor: Player group -> No Player combatant is placed/shown at all on the grid and Issue #1 happens.

SETUP B
NPC combatants are pre-spawned by the Combatant Spawner (single) linked to the nearest Battle Event, which again points to the nearest Battle Grid. There is no combatant spawned by the Battle Event itselves ... probably due to this, battle does not start by Battle Event trigger (combatant enterring the area). This seams bit weird. But, the battle is triggered when player group enters the agro area of the copmbatant, which is OK. This is wanted scenario, but in this setup I'm not able to run the battle, since Issues #1 and #2 are happening all the time.

Variant B1: Using "Player Grid Placement" node -> Player combatant is visible, but after manual placement Issue #1 happens.
Variant B2: Using "Place On Grid", Use Deployment Cells: Enabled, Place All: Enabled -> No Player combatant is placed/shown and Issue #1 happens.
Variant B3: Using "Place On Grid", Use Deployment Cells: Disabled, Place All: Enabled -> No Player combatant is placed/shown and Issue #1 happens.
Variant B4: Using "Place On Grid", Use Deployment Cells: Enabled, Place All: Disabled, Actor: Player group -> No Player combatant is placed/shown and Issue #1 happens.
Variant B5: Using "Place On Grid", Use Deployment Cells: Disabled, Place All: Disabled, Actor: Player group -> No Player combatant is placed/shown and Issue #1 happens.

Issues occurence also seems to be somehow linked to the Battle grid itselves, the behaviour is not same on all the battle grids!

Thanks for your support!
Post edited by Riffage on
  • Which ORK version are you currently using? There's been a bug in 2.30.0 and 2.30.1 that sounds similar to your issues - was fixed in 2.30.2.
    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 November 16
    Indeed, I'm using 2.30.1
    I will update and check!

    TY!
    Post edited by Riffage on
  • edited November 18
    I updated the framework to ver. 2.30.2, but sadly issue is even worst, battle is not working now in any variant. Seems NPC is placed incorrectly - it does not stend in the grid cell obviously, not moving. But when player character gets closer, it is detected and attack is made. But it happens even if the characters are still outside of the attack range and also NPC is not turning towards the player combatant. So, obviously, ORK thinks that the combatant is elswhere as it is placed...
    Post edited by Riffage on
  • edited November 18
    Ok, first of all it's probably best to take note of what the individual nodes do:

    The Player Grid Placement node will call the call the, well, player grid placement as it's set up in the Combatant Placement settings in Battle System > Battle Grid Settings and lets the player select the cells on which he wants to place his combatants. Combatants that aren't yet spawned will be spawned when placing them.

    The Spawn Combatants node will spawn combatants that participate in battle but are not yet spawned, depending on your setup either for all combatants or only the selected groups (e.g. player or enemy). If it's a grid battle, it'll also set the combatant's cell and place it on the cell. It'll first try to find a deployment cell, followed by any free cell if no deployment cell is found.

    The Place On Grid node will place all combatants that are already spawned and don't have a grid cell yet. It'll use either a deployment cell or a free cell (depending on your setup) for this and also position the combatant on the cell's position.

    So, in short, it'd be best to use both nodes, to be sure that all combatants are spawned and placed on the grid. If a combatant isn't placed, it might be due to not finding a suitable cell, e.g. when using deployment cells in the Place On Grid node and there's no matching (and free) deployment cell for that combatant, it can't be placed if you don't also use another node to place the remaining combatants on free cells.
    Btw, you can check if (and which) combatant is placed on a cell by selecting the cell's game object in the scene and checking the Occupant in the inspector.


    I just did a quick test with a similar setup as you want, i.e. using a Combatant Spawner for roaming enemies, using the nearest Battle component using the nearest battle grid. Worked fine here.

    Some things to consider with that setup:
    - make sure the Nearest Range of the combatant spawner for finding the nearest battle component is large enough
    - make sure the various range settings in Battle System > Battle Settings are large enough or not used, e.g. if combatants are out of Battle range, they'd not really participate in battle
    - if you want nearby combatants to automatically join into a battle, check the Auto Join Settings in the battle settings
    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!
  • Finally, I resolved the issue by removing the "Destroy Object (Player)" node from the Battle start event. I thought it would be re-spawned by the following "Spawn Combatants (All)" node, but it was not the case thou. Anyway, without destroying the Player combatant it works now.

    Thank you for your help!
  • Unity doesn't destroy game objects immediately, i.e. if there's no wait time (e.g. via a Wait node) between destroying the player and spawning the combatants, the player's combatant will still be spawned and not spawn again.

    Even a Wait node with a 0 second wait (i.e. continues next frame) should be enough.
    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.