Hi!

I'm trying to set up a schematic to bring enemy reinforcements to the battle.

Right now, what I'm doing, is using the combination of these three nodes: Spawn Combatant --> Set Grid Cell Combatant --> Join Battle

So I spawn the combatant at the map coordinates that match the cell I want, then in the next node, Set Grid Cell Combatant, I check ''Use Nearest Cell''.

Now, my schematic works properly when the cell is empty. However, when I have a character blocking the cell, the reinforcement shows up... completely elsewhere. I have no clue how the cell was chosen, but it's certainly not the closest one.

image

In this image, the two characters are blocking the cells where the 2 blobs facing up where supposed to spawn. However, for some reason, they spawned... there. The pic shows the positions of the combatants immediately after spawning.

So my question is: how can I get the blobs to spawn in nearby cells instead of... there?

Thank you!
  • Try adding a Wait node after Spawn Combatant with a 0 second wait to continue in the next frame. This gives Unity time to actually spawn it - otherwise it's position might not be correct for getting the nearest cell.

    Also - the Place On Grid node could be the better choice instead of the Set Grid Cell Combatant node, though both do the job :)
    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!
  • Thank you, it works now! Using the Place on Grid node did the trick, the Wait node wasn't necessary in the end.

    But, just for my understanding, what is the difference between Place on Grid and Set Grid Cell Combatant? I've read both descriptions and can't tell the difference :s

    Thanks :)
  • The Place On Grid node is intended for the battle start schematic to place spawned combatants on nearby cells.

    The Set Grid Cell Combatant is intended for setting a specific cell's combatant and also has more options (e.g. instead of setting the combatant as the cell's combatant, it can be used as move combatant during movement, which allows having 2 combatants on the cell).

    So, they do a similar job, but with different objectives in mind :)
    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 July 2022
    OK! Thank you for taking the time to enlighten me :)

    (I just realized I am indeed using Set Grid Cell Combatant for grid movement, as shown in the tutorials!)
    Post edited by max_power on
Sign In or Register to comment.