I use Dialogue System with ORK and I want to start a battle in the middle of a conversation. The way I made it work was to use a SendMessage Sequence command in Dialogue System calling a C# function on an enemy combatant of my scene. In this function, I have:
bc = GameObject.Find(battleGOName).GetComponent<BattleComponent>();

That's working ok for a fight against one enemy, however, I have trouble with multiple enemies. The reason is that, in my game, my enemies are spawned at scene start with a CombatantSpawner component on which I specify the battle object they should use. However, if I don't use the JoinOnStart command, nobody join the battle, even if it's specified in the CombatantSpawner. So I need to add all the enemy combatants of my battle by code (using JoinOnStart with a list). However, since the combatants are instances, I need to add them to that list at runtime, which is not practical, since most of the battles in my game are predetermined. What I'd like to do is to specify the combatants I want to spawn in the editor (in the CombatantSpawner component), associate them with a battle, and then, when I start my battle, have the spawned combatants join that battle automatically.

What is the best way to achieve this, by code preferably (since SendMessage from DS calls a function)?
  • Ok, so I managed to solve my problem using the auto-join feature of the battle component. This way, my combatants are joined to the battle as soon as they're spawned and I don't have to use JoinOnStart anymore!
Sign In or Register to comment.