Hi,

I've been following the grid battle tutorial, and so far I've got the grid set up, and I can even move on the grid with player combatant.

However, I seem to have troubles in deploying the player and enemy combatants correctly on the grid.

I've created a phase Battle component with autostart (this differs from the tutorial, but I assume it is not the issue here?). I've painted grid cells for player and enemy deployment areas. I have one combatant group for player, that includes only one combatant. Additionally I have one combatant group for enemies with two combatants included.

Now, in the battle component itself I've selected only the enemy group as combatant (the battle component requires at least one combatant specified). When the deployment phase starts, I'm being requested to deploy two instances of the single player combatant in my player combatant group, which is odd. If I modify the battle start script in so, that in the beginning both destroy the existing player gameobject AND leave the active player group --> I get to deploy correctly only one player combatant, but another instance of the player combatant is spawned automatically in the location where I have the battle component placed.

In the battle start event I'm spawning the enemy group and expected it to be placed on the grid where I've defined the enemy deployment zone. Instead, the enemy combatants are spawned exactly at the location of the battle component in the scene, and they are not placed on the grid. I tried to fix this in the battle start event, by adding "Place on grid" for the enemy combatant group after I spawned it, but with no luck.

Any suggestions on where to start solving this?
  • Having 2 player combatants although you only added one is usually a hint that your game start event is used twice. The start event should only be set up in Menus > Main Menu or as an Autostart event in the scene, not both.

    Are you testing this directly in the scene with a game starter set up for quick game testing? In that case you need to add a small delay to the autostart battle (e.g. start after 0.1s).
    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!
  • I'm testing it without the "quick game testing", so I have the following scenes set up:

    1. Main menu (this is only scene that has the game starter component attached)
    2. Free roam scene
    3. Battle scene

    In main menu -> new game settings I've set the game start event which adds the player to active group, and also defined that the Free roam scene is to be loaded.

    In Free roam scene I have scene changer to Battle scene, and I test it just by moving to scene changer.

    I noticed that when I move to Battle scene and the deployment phase begins --> the enemy group is spawned to the scene (not where the grid area is but at the zero-origin in space). There is no player spawned at this point.

    After I deploy the player and the grid battle start event has exited --> another instance of the player is spawned along with additional enemy group in the scene at the location of the battle component. So eventually if I pause the game, and see what got spawned in the scene, the result is 4 enemies (with two of them at zero-origin and two at the battle component location), and 2 player combatants (one at the battle component location, and one where I deployed it on the grid).
  • Ooops, found out the reason for duplicate player. There were as GiL suggested an additional start event launched. This was hidden inside the Free Rome scene as a gameobject. Removed it and now only one player combatant is spawned after deployment.

    But the issue with the enemy group deployment still exists. The enemies are spawned correctly, but they are not placed on to the grid as expected.

    The "Spawn combatant" step in the event seems to work, as the enemies are indeed spawned in the location that I specify, but after spawning they don't settle down inside deployment grid cells.
  • Ok, enemy deployment issues were another stupid user error:
    - I was using event action Combatant/Combatant/Spawn combatant, when I should've used Battle/Combatant/Spawn combatants

    Changed to that, and now the enemies are placed on the grid nicely
  • Yeah ... probably have to change the name on one of these nodes, this can be pretty confusing :D
    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.