1 (edited by Yin 2019-01-29 17:03:54)

Topic: [PAID?] How To Initialize CPU Control on a player that's not 1 or 2

I am trying to create a system where enemies are spawned and controlled using the fighting engine's AI. But when they are spawned, they do nothing and I can't attack them either. They have all of the necessary scripts, but they are completely inactive.

Here's my spawning code.

ControlsScript enemyControls = UFE.SpawnCharacter(enemyData.enemyData, UFEIntegration.EnemyCount + 3, -1, UFE.config.selectedStage.position, false, null, null, -1, enemyData.enemyGroup);
            enemyList.Add(enemyControls);
            UFEController enemyAI = gameObject.AddComponent<UFEController>();
            UFEIntegration.enemyAIList.Add(enemyAI);

            SimpleAI enemySimpleAI = gameObject.AddComponent<SimpleAI>();
            enemySimpleAI.player = UFEIntegration.EnemyCount + 3;
            UFEIntegration.enemySimpleAIList.Add(enemySimpleAI);

            RandomAI enemyRandomAI = gameObject.AddComponent<RandomAI>();
            enemyRandomAI.player = UFEIntegration.EnemyCount + 3;
            UFEIntegration.enemyRandomAIList.Add(enemyRandomAI);

            AbstractInputController enemyFuzzyAI = null;
            if (UFE.isAiAddonInstalled && UFE.config.aiOptions.engine == AIEngine.FuzzyAI) {
                enemyFuzzyAI = gameObject.AddComponent(UFE.SearchClass("RuleBasedAI")) as AbstractInputController;
                enemyFuzzyAI.player = UFEIntegration.EnemyCount + 3;
                enemyAI.cpuController = enemyFuzzyAI;
            } else {
                enemyAI.cpuController = enemyRandomAI;
            }
            enemyAI.isCPU = true;
            enemyAI.player = UFEIntegration.EnemyCount + 3;

            enemyAI.Initialize(UFE.config.player2_Inputs);
            UFE.SetAI(UFEIntegration.EnemyCount + 3, enemyData.enemyData);

And in my controls script, I set the opponent control script to player 1's control script. Still nothing happens.

So, where am I going wrong when it comes to starting the AI?

I am willing to pay for help with this!

Share

Thumbs up Thumbs down