Respawning a subclass AI skeletal mesh inside a parent class behavior tree

I have many AI in my game, all with the same behavior (ie. using the same behavior tree) but each with different skeletal meshes.

I’ve created a BP_Base_AICharacter and all the other AI characters are subclasses of this. The BP_Base_AICharacter uses a BT_Base_BehaviorTree and the subclass AI use that too, and it’s all working nicely.

However, in my BT_Base_BehaviorTree I have a BTT_RagdollAndRespawn task that kills and then respawns the AI using a SpawnAIFromClass node. The selected PawnClass in this node is the BP_Base_AICharacter but this means that when the subclass AI respawn they come back as the base skeletal mesh, not their own original mesh.

I’m trying to work out what I need to do to make the respawning adopt the relevant subclass skeletal mesh. I was hoping to be able to select Self in the PawnClass but this doesn’t appear to be possible.

I could perhaps add a decorator to the BTT_RagdollAndRespawn that somehow selects for a specified skeletal mesh and then replicate that task so that each subclass AI has its own kill and respawn task selected by its decorator but this could get very messy with many subclass AI.

Is there a cleverer way to do this?

Don’t destroy the the class! Re-use it.

Death → unpossess → deactivate the class (CMC, collisions, hide mesh etc).
Teleport to spawn location → Activate the class (CMC, collisions, unhide mesh etc) → Possess.

1 Like

Ah, yes, of course! Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.