In RealtimeBattle, there are two combatants: PlayerCombatantA, and AllyCombatantB, who is controlled by AI. When the switch key is pressed, I want to switch from controlling PlayerA to controlling AllyB. (At that time, the factions of A and B will also be swapped between Player and Allies.)

I tried to create a schematic for this,

(Actor1= PlayerCombatantA, Actor3 = AllyCombatantB)
https://imgur.com/Qp0bAtX

I was able to switch between A and B’s movements, but when I press the attack key, instead of B, the original A performs action.

How can I switch the combatant I’m controlling?
  • Is there a reason why the ally isn't just part of the player group (and set to be AI controlled)? That'd allow using the player change keys (Base/Control > Game Controls) and have all of that handled automatically.
    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 for your response.

    The main reason is that I would like to enable the switching between states of manual control through key input and states where the character is operated by AI, regardless of whether they are players, enemies, or third-party entities.
    While there may be a solution using PlayerChangeKeys, if it's possible to achieve the switching using Schematic, I would prefer to use that approach.
  • Generally should be ok that way - in real time battles the controlled player is the one you can input actions for (e..g via the control maps). So based on your screenshot that should work.

    One thing to keep in mind here is the player group's battle group size (defined in Game > Game Settings in the player/group settings). Also, that combatant should be part of the battle (e.g. check the combatant's inspector and check the Combatant Component for the battle state information.
    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.