Hey again. I am working on creating a function that will replace Ork Framework's "Player Grid Placement" event step at the start of grid battles. My end goal is for this function be called in my "gridBattleStartEvent" Event, find the nearest grid cell to the player, and place the player's combatant in that grid cell.
So far I have been able to find the objects for the "leader" combatant, BattleGridComponent, and the GridCells. However, when I add the combatant to one of the grid cells he does not seem to appear when the battle starts. Are there any additional steps I am missing for adding a character to a battle?
public void PlaceCombatantsOnGrid ()
{
List<Combatant> playerBattleGroup = new List<Combatant>();
ORK.Game.ActiveGroup.GetMembers(MenuCombatantScope.Battle, ref playerBattleGroup);
BattleGridComponent gridBattle = ORK.Battle.BattleArena.gridObject;
foreach (Combatant combatant in playerBattleGroup)
{
if (combatant.IsLeader)
{
gridBattle.GetCell(0, 0).AddGuest(combatant);
}
}
}
This is my first real attempt at scripting in ORK, so I am making a few assumptions. Such as that "ORK.Battle.BattleArena.gridObject" will give me the actual grid object of the current active battle.
Thanks!
When setting a combatant on a grid cell via script, do it like this:
cell.Combatant = combatant;
Using the AddGuest function is only temporarily adding the combatant to the cell, e.g. used when the combatant is moving over a cell.
If you want to get the battle's active grid, use this:
ORK.Battle.Grid
While your attempt will usually also return the same grid, it's not always the case (e.g. you can set a different grid in events).
Also, to get the battle group, you can just use this function:
List<Combatant> battleGroup = ORK.Game.ActiveGroup.GetBattle();
When a combatant isn't spawned yet, (i.e. combatant.GameObject == null), you need to spawn it using the combatant.Spawn function.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Are there any additional steps that I should be taking in order to get this node to work? I have an attached an image to show you what I am doing.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
When I select the move command no grid spaces showing where I can move are highlighted. If I click on the grid to try and move, I get a NullReferenceException. If I end the character's turn the enemy doesn't do anything. The enemy acts as if there isn't anything on the grid for him to attack.
Thanks for the help! Sorry, I know at this point this isn't exactly a scripting line of questions. Just let me know if I should move this into the main ORK support forum.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!