Topic: Launching the fighting engine directly

Hi to all, I'd like to ask how to laungh the fighting engine directly.

The situation is as follows:
I make the menus by myself, without using the menus that ship with UFE. Then in my menus I assign the two characters and the stage. The two characters are both inserted into the global info and assigned by Ufe.SetPLayer1 and 2 (the same with the stage). After that I let UFE to initialize itsefl in a different scene.

But then, what should I do in code? I've tried a lot of combinations, but it seems I cannot find the correct way.
I've tried UFE.StartFight() among other things.

Thanks a lot.

Share

Thumbs up Thumbs down

Re: Launching the fighting engine directly

You can change the ufe screens to be whatever you want

Eternal Rift Studios
    Current Projects:
         Destined Soels
Always happy to help when possible. If its something pretty minor ill just help you out. But i do commissions as well. Hit me up if you need a commission.

Share

Thumbs up Thumbs down

Re: Launching the fighting engine directly

Look in the code for how it launches the Deub "Start Game Immediately" option. That should help you out (don't have the code in front of me)

Share

Thumbs up Thumbs down

4 (edited by MrPonton 2017-05-02 18:04:41)

Re: Launching the fighting engine directly

Looking at the UFE.cs code:

// Load the intro screen or the combat, depending on the UFE Config settings
        if (UFE.config.debugOptions.startGameImmediately){
            if (UFE.config.debugOptions.trainingMode) {
                UFE.gameMode = GameMode.TrainingRoom;
            } else {
                UFE.gameMode = GameMode.VersusMode;
            }
            UFE.config.player1Character = config.p1CharStorage;
            UFE.config.player2Character = config.p2CharStorage;
            UFE.SetCPU(1, config.p1CPUControl);
            UFE.SetCPU(2, config.p2CPUControl);
            //UFE.StartGame(0);
            if (UFE.config.debugOptions.skipLoadingScreen) {
                UFE._StartGame(UFE.config.gameGUI.gameFadeDuration);
            } else {
                UFE._StartLoadingBattleScreen(UFE.config.gameGUI.screenFadeDuration);
            }
        }

You can probably just code:

UFE.gameMode =  GameMode.VersusMode; // or GameMode.TrainingMode if you want Training.
UFE.config.player1Character = p1CharAsset; // or whatever variable you have the Character Asset file set 
UFE.config.player2Character = p2CharAsset; // or whatever variable you have the Character Asset file set 
UFE.config.selectedStage = stagePrefab; // or whatever variable you have the Stage Prefab file set
UFE.SetCPU(1, false); // Set to true for AI on P1
UFE.SetCPU(2, false); // Set to true for AI on P2
UFE.StartGame(UFE.config.gameGUI.gameFadeDuration);

That should get you started. Not that you don't need the other code the methods link to, but that being called will boot up the game into the battle system.

Share

Thumbs up +1 Thumbs down

Re: Launching the fighting engine directly

No, the error I get by trying these is even totally unrelated and random for me... @@

NullReferenceException: Object reference not set to an instance of an object
UFE.get_isConnected () (at Assets/UFE/Scripts/UFE.cs:2209)
UFE.GetPlayer1Controller () (at Assets/UFE/Scripts/UFE.cs:1166)
UFE.FixedUpdate () (at Assets/UFE/Scripts/UFE.cs:2046)

It is calling: UFE.multiplayerAPI.IsConnected(); but the multiplayer API is null.

Share

Thumbs up Thumbs down

Re: Launching the fighting engine directly

I don't have P2P add-on, but i'd comment that whatever the code is doing to instantiate any null reference exceptions is what you'll have to to do to start the game.

Share

Thumbs up Thumbs down