I'd like to start a grid battle, using multiple player and enemy (and possibly ally) combatants who are already in a scene, which will start normally but auto-select and move all of the combatants within a certain range to their closest approximate free cell, without destroying and respawning any of them, and also using the movement animation rather than just instantly blinking them onto a random cell. My thought is to place enemies strategically and keep them near the middle of a grid, and to make grids large enough as to ensure plenty of space for player combatants to find a nearby starting cell. If any player combatants are outside of the immediate battle range, I'd like to check their distance from the grid's edge and spawn them in after a determinate amount of time. Will that be possible?
  • Hm ... might be a bit tricky, but I think it's possible.

    Use a Set Grid Cell Combatant to select a cell for the combatnats, enabling Use Nearest Cell (and disabling Place At Cell) would use the nearest free cell (that's not blocked). Now you have a cell assigned to your combatants.

    Next, set up a game event that moves the combatant to its cell and set it up as a custom event for your combatants. Either in Battle System > Battle Settings in the Default Events or in your individual combatants. Use a Custom Combatant Event node in your battle start event to use the evemt, which will proceed to move the combatants to their cells.
    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 advice, I'll give that a try! Incidentally, what's the largest amount of nodes you'd recommend adding to a grid?
  • Would the best way to achieve the move event be to store the grid cell as a vector3 and move the combatants to the vector 3? They're already assigned to the grid cell, correct?
  • The number of cells on a grid isn't really that much of an issue (at least in-game, working on a large chunk of a grid in the editor can be a bit of a pain, so zooming in is a good way to work on large grids). It's rather the large ranges that can cause issues - e.g. if you have a large use range or move range and hundreds of cells need to spawn their selected prefab for the first time, that'll take a (temporary) bite of your performance :)

    Yeah, they're already assigned to the cell via the Set Grid Cell Combatant node. You could either store the cell's position as you suggest, or use a Store Grid Cells node to store the combatant's cell into found/global objects and use that to move to.
    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!
  • "The number of cells on a grid isn't really that much of an issue (at least in-game, working on a large chunk of a grid in the editor can be a bit of a pain, so zooming in is a good way to work on large grids). It's rather the large ranges that can cause issues - e.g. if you have a large use range or move range and hundreds of cells need to spawn their selected prefab for the first time, that'll take a (temporary) bite of your performance :)"

    -That's excellent news! Theoretically, then, I could use a single grid to cover an entire scene. Making large grids in the editor had me afraid that it would break my game. Is the editor lag mostly due to an excessive GPU load?

    "Yeah, they're already assigned to the cell via the Set Grid Cell Combatant node. You could either store the cell's position as you suggest, or use a Store Grid Cells node to store the combatant's cell into found/global objects and use that to move to."

    -How do I access that information in the custom combatant event? I'm keeping things simple to begin with, using a battle start event that opens into three 'Set Grid Cell Combatant' nodes for the player, enemy and ally groups and then running the custom events for each. If I use a 'Store Grid Cells' node for each of these player groups, I suppose that I'd first of all need to use three separate custom events for each group to find the appropriate tag, but will the individual combatants be able to find their own cell that way? Also, should I store the cells as a 'Path', 'Battle Range Template' or 'Custom', and should I check the box for 'Separate User'?
  • Editor lag is due to the scene handles on every visible cell.

    The custom events run on each individual combatant, i.e. you can use a Store Grid Cells node (e.g. with a battle range that just uses the origin cell) to get the combatant's cell.
    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!
  • "Editor lag is due to the scene handles on every visible cell."

    -Those scene handles are loaded into the scene during game play as well, though, right?
  • No, during play mode the grid handles will not be displayed - only the regular Unity handles when having a single game object selected, but not the handles for all visible cells.
    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!
  • Two further questions (for now:)

    -Can we display/activate only part of a grid upon starting battles?

    -Is there a method to link the cells together by their points so they can retain a solid pattern on slopes and the like--sort of like how the UI can be setup to adjust itself to any screen size?
  • ThreeNippledWanda said: -Can we display/activate only part of a grid upon starting battles?
    No.
    ThreeNippledWanda said: -Is there a method to link the cells together by their points so they can retain a solid pattern on slopes and the like--sort of like how the UI can be setup to adjust itself to any screen size?
    The Use Slope option when generating the grid will use the slope on the position of the cell for it's rotation - anything further needs to be adjusted manually by rotating the cell.
    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.