Unable to apply special abilities to more than one character

Hello! I’ve finished the RPG Core Combat course and I was trying to apply the Special Abilities code framework to a multiplayer game I was working on.

Unfortunately it looks like when I attach components to more than one player, the first player tends to “steal” commands from the other plays. It looks like whenever you set the player component, the AbilityBehavior file will simply set the player you set in the Start() function to whoever sets it first (or last? I can’t tell).

Just wondering if anyone has seen this before and/or has a solution to this. I can provide more details if anyone asks.

I also had this issue. My solution was to add a collection of AbilityBehaviour within the AbilitySystem class and during the AttachIntialAbilities() call i added the specific behaviour to this collection. Like as follows.

for (int abilityIndex = 0; abilityIndex < abilities.Length; abilityIndex++)
{
abilities[abilityIndex].AttachAbilityTo(gameObject);
equippedAbilityBehaviours.Add(abilities[abilityIndex].Behaviour);
}

using this new collections allows access to the specific behaviour attached to the correct game object and you can go from there. It is likely I am missing something in regards to the inner workings of this system and this might not be necessary but it was a solution to my problem.

Privacy & Terms